Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress the 'press any key to continue' in batch script

Tags:

batch-file

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?

like image 576
Venu Avatar asked Dec 29 '10 08:12

Venu


2 Answers

That's the output of the PAUSE command:

http://ss64.com/nt/pause.html

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)

like image 129
Álvaro González Avatar answered Sep 28 '22 06:09

Álvaro González


Pause>nul Will make it not echo 'press any key to continue . . .'

like image 23
Silly Avatar answered Sep 28 '22 08:09

Silly