2011/12/06

Pause Batch Files with a User-Defined Message

To pause a DOS batch file in Windows XP from continuing to the next command, you can use the PAUSE command. Doing so prompts the user with the text:

Press any key to continue . . .

Then the batch file waits for the user to press a key. However, what if you want to pause a batch file and not display anything? Just pipe the results to nul like so:

pause > nul

Since this may not be very useful (how will the user know they need to press a key to continue the batch file?) you should display a different prompt. Issue an ECHO command with your desired prompt, then issue the above pause > nul command.

For example, to pause a Windows XP batch file with the prompt "Press ENTER to execute the command", use the following commands:

echo Press ENTER to execute the commandpause > nul

No comments:

Post a Comment