Jecfish
Jecfish

Reputation: 4189

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.

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? Please help. Thanks.

Upvotes: 1

Views: 966

Answers (1)

MC ND
MC ND

Reputation: 70923

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. UNLESS the call of the second batch file is done with call command. So, your code should be

pushd C:\src&call ant -Dinifile=C:\repo\IR.ini -Dfilelist="label.xml" >> %outputfile% 2>&1&popd

Upvotes: 4

Related Questions