Suppress the 'press any key to continue' in batch script
69,514
Solution 1
That's the output of the PAUSE
command:
The problem with PAUSE is that it's often necessary when you run a batch file from Windows explorer (or you cannot read the output) but it's annoying in the command prompt. I asked about it here and I was suggested a nifty trick:
Conditional PAUSE (not in command line)
Solution 2
Pause>nul Will make it not echo 'press any key to continue . . .'
Solution 3
you can call other script like this from source, @echo | call otherScript.bat
please find the detailed answer here Another thread with example
Related videos on Youtube
Author by
Venu
Updated on July 09, 2022Comments
-
Venu almost 2 years
I am writing a batch script. After a stage in the command window it says 'press any key to continue' and halts, and after something is pressed the script continues. How can I prevent this in the script?
-
ykatchou over 13 yearsCould we see the source code ? :/
-
papo almost 6 yearsThis question doesn't specify if you want to avoid the text or the stopping of the script. @Silly's answer will hide the text, @user1066231's answer will cause the script will not stop and wait. This could actually also be achieved by
pause<nul
, which looks similar topause>nul
but has different result
-
-
Massimo almost 3 yearsBrilliant! And since PAUSE seems to wait too long I now use this :
timeout /t 1 >nul