Name
pause
Synopsis
Suspends processing of a batch program and prompts the user to press any key to continue.
Description
Include the pause
command whenever you want your
batch file to stop and wait for user input, giving the user a chance
to read the text on the screen, insert a floppy disk, or press Ctrl-C
to abort the batch file.
The message “Press any key to
continue...” is automatically displayed whenever the
pause
command is used; it is not affected by the
echo off
statement.
Examples
Prompt the user to change disks in one of the drives in a batch program:
@echo off echo Insert next disk in drive A, and pause
When this batch file is executed, the following message will appear:
Insert next disk in drive A, and Press any key to continue ...
Something like this is also common:
@echo off echo Press Ctrl-C to cancel, or pause
Get Windows XP in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.