Reputation: 5738
I couldn't able to pause the running batch file for asking user input intermediately. I tried the commands like PAUSE
and SET /P aaa="Press enter to exit"
and also as following but nothing worked out.
@ECHO OFF
SET /p aaa="Press enter to exit"
ECHO you typed %aaa%
PAUSE
My batch file internally invokes another batch to build all visual studio projects under the root of the baseline.
One of the project build is getting failed and finally it returns '1' as BUILD FAILED to the main batch file processor. This terminates the MS DOS console immediately and not waiting for user input.
I'm unable to see the MS DOS console window with the end results.
There are various steps to see the end results(Writing the execution output to a text file as like C:\CurrentApp\MyBuild>ABC.bat MyApp.New.BUILD > output.txt
) but i would like to see in MS DOS console screen itself with blinking cursor waiting for any user input key.
My batch file looks like:
cd C:\CurrentApp\MyBuild
ABC.bat MyApp.New.BUILD
SET /p aaa="Press enter key to exit"
PAUSE
@ECHO OFF
SET /p aaa="Press enter key to exit"
ECHO you typed %aaa%
PAUSE
Upvotes: 3
Views: 5988
Reputation: 3685
You must call your second batch: call ABC.bat MyApp.New.BUILD
. Otherwise control passes to ABC.bat but never returns so your pause
is never executed. You may think of it as of ABC.bat overwriting your current batch contents and then executing itself.
Upvotes: 6