从批处理文件运行 ant:以后的命令不运行 [英] Running ant from a batch file: Later commands don't run

查看:25
本文介绍了从批处理文件运行 ant:以后的命令不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行 ant 的批处理文件,然后复制生成的文件之一:

I have a batch file that runs ant and then copies one of the files that were produced:

ant -Dproject.version=1.1.2 release published
copy /Y D:\dir1\MyJar.jar   D:\dir2\MyJar.jar

当我运行批处理文件时,ant 运行成功,但复制语句永远不会发生,尽管如果我输入它并在 ant 任务完成后按 Enter 它将工作得很好.

When I run the batch file, ant runs successfully, but the copy statement never happens, although it will work just fine if I type it in and hit Enter after the ant task has finished.

这里发生了什么?

推荐答案

我曾经遇到过同样的问题,神奇的 call 解决了.

I had the same problem once and the magic call did it.

在你的那个批处理文件中尝试:

In that batch file of yours try:

call ant -Dproject.version=1.1.2 release published
copy /Y D:\dir1\MyJar.jar   D:\dir2\MyJar.jar

虽然不能告诉你为什么它有效.猜猜这是微软的逻辑.

Cannot tell you why it worked, though. Guess it's Microsoft logic.

这篇关于从批处理文件运行 ant:以后的命令不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆