Reputation: 1413
My embedded C compiler generates a batch file to run various build outputs in a processor simulator from the command line. I'd like to create a batch file to call that auto generated batch file that is somewhere convenient, and I'd like to be able to rerun it just by clicking a key as often as I want all day long.
Here's what I've tried
cd "C:\foo\project name\settings\"
:repeat
cls
"Project Name.Unit Test Ouput.cspy.bat" & pause
goto repeat
I see the output I expect from the batch file, followed by a:
Press any key to continue . . .
When I press enter the script ends and never executes the goto. If I remove the pause statement the script just ends immediately. If I type & goto repeat the script still ends immediately.
CDing to the batch file from the command line, running it, and then click the up arrow and enter effectively does what I want... I am trying to automate it a tiny bit more.
Upvotes: 1
Views: 1114
Reputation: 17856
To run a batch file from another batch file, you have to use the call
statement. If you don't, then your outer batch file will end when the inner one does.
call "Project Name.Unit Test Ouput.cspy.bat" & pause
Upvotes: 2