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?
Asked
Active
Viewed 8.1k times
9
-
2Could we see the source code ? :/ – ykatchou Dec 29 '10 at 08:49
-
2This 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` but has different result – papo May 13 '18 at 20:34
3 Answers
9
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:

Community
- 1
- 1

Álvaro González
- 142,137
- 41
- 261
- 360
8
Pause>nul Will make it not echo 'press any key to continue . . .'

Silly
- 217
- 5
- 9
-
1Brilliant! And since PAUSE seems to wait too long I now use this : `timeout /t 1 >nul` – Massimo Jul 08 '21 at 07:56
2
you can call other script like this from source, @echo | call otherScript.bat
please find the detailed answer here Another thread with example

user1066231
- 551
- 1
- 7
- 27