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

69,514

Solution 1

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)

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

Share:
69,514

Related videos on Youtube

Venu
Author by

Venu

Updated on July 09, 2022

Comments

  • Venu
    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
      ykatchou over 13 years
      Could we see the source code ? :/
    • papo
      papo almost 6 years
      This 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 to pause>nul but has different result
  • Massimo
    Massimo almost 3 years
    Brilliant! And since PAUSE seems to wait too long I now use this : timeout /t 1 >nul

Related