PAUSE

Pause the execution of a batch file

Syntax
      PAUSE

Displays the message "Press any key to continue . . ."

To suppress the message:
PAUSE >nul

To display a different message:
Echo Pulse cualquier tecla para continuar
PAUSE >nul

Execution of a batch script can also be paused by pressing CTRL-S (or the Pause|Break key) on the keyboard, this also works for pausing a single command such as a long DIR /s listing.
Pressing any key will resume the operation.

Pause is often used at the end of a script to give the user time to read some output text.
An alternative to this is to run the script using CMD /K:

START CMD /k C:\demo\yourscript.cmd

That will run the script and the window will remain open for any further input. The advantage of CMD /K is that you can then run the same script in 'unattended mode' without having to edit it. The limitation is that this only acts like PAUSE at the very end of a script.

PAUSE does not set or clear the Errorlevel.
PAUSE is an internal command.

“Advertising may be described as the science of arresting the human intelligence long enough to get money from it” - Stephen Leacock

Related commands:

SLEEP - Wait for x seconds.
TIMEOUT - Delay that allows the user to press a key and continue immediately.
PowerShell: Pause
Equivalent bash command (Linux): read -p "press any key to continue" or ctrl-z & fg


 
Copyright © 1999-2021 SS64.com
Some rights reserved