Programming Field

Pause - DOS/Command Prompt Reference

Pauses the batch program and waits for key input.




Usage of Pause

Pause is a command which waits for user input. Choice only accepts specific characters, but Pause accepts any key and exits waiting when one key is pressed. Note that you cannot get the key input by using Pause (You must use Choice command with devising).

[Windows NT series] [Extensions] You can not only waiting for input but also get input text by using ‘set /P’.


Sample 1


Displays following message and waits for key input. Proceeds next step when any key is input.

Press any key to continue . . .

Note that the batch program will exit if Ctrl+C is pressed.

Sample 2 (Batch file)

echo An error has occurred. Press any key to continue.
pause > NUL

To change the message waiting for key input, you can suppress the default message by controlling output with ‘>’.

See also