[英]Batch file ECHO not working after PUSHD command
I have a .bat (batch) file with the following line, the last line echo isn't run. 我有一个带有以下行的.bat(批处理)文件,最后一行回显没有运行。
set outputfile=C:\DeployLog-label-test.txt
echo ----- Start File 1 of 1 ----- >> %outputfile%
pushd C:\src&ant -Dinifile=C:\repo\IR.ini -Dfilelist="label.xml" >> %outputfile% 2>&1&popd
echo ----- End File 1 of 1 ----- >> %outputfile%
Is it because of pushd command? 是因为pushd命令? Please help.
请帮忙。 Thanks.
谢谢。
No, in this case the "problem" is that ant
is a batch file, and if from inside a batch file (your batch file) you call another batch file, execution flow is transfered to the called batch and it does not return to the caller. 不,在这种情况下,“问题”是
ant
是批处理文件,如果从批处理文件(批处理文件)内部调用另一个批处理文件,则执行流程将转移到被调用的批处理,并且它不会返回到呼叫者。 UNLESS the call of the second batch file is done with call
command. 除非使用
call
命令完成第二个批处理文件的call
。 So, your code should be 所以,你的代码应该是
pushd C:\src&call ant -Dinifile=C:\repo\IR.ini -Dfilelist="label.xml" >> %outputfile% 2>&1&popd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.