Do you want to pause an action of a batch file? You can program your batch file to indicate to the user when he or she is ready to continue, or you can set your batch file to wait a certain amount of time before continuing automatically. The method you choose will depend on what your program needs and the capabilities of your system.
Method 1 of 4: Pause
Step 1. Use the PAUSE command to make the program wait for the user
Pausing will continue forever until the user chooses to continue. If you want to stop running the program for a specific time, check out one of the following methods.
Step 2. Place the PAUSE command where you want the program to pause
The user will be prompted to continue.
Step 3. Hide the dialog box from PAUSE
You can add >zero to the end of the PAUSE command to hide the text that would otherwise be shown to the user.
Method 2 of 4: Timeout
Step 1. Use the TIMEOUT command to make the program wait for a specified time
The user can skip this period or you can add a parameter to prevent the user from skipping this.
TIMEOUT may not work on older systems. If the TIMEOUT command doesn't work, see the next section
Step 2. Place the TIMEOUT command where you want the program to pause
Add the flag /t followed by the number of seconds.
Step 3. Prevent the user from skipping the break
Add the /nobreak flag to the possible entry to avoid skipping the break.
The user can still end the program by pressing Ctrl + C and then quit the program
Method 3 of 4: Sleep
Step 1. Use the SLEEP command to make the program wait a certain number of seconds
The use of SLEEP is deprecated and has largely been replaced by TIMEOUT.
Step 2. Place the SLEEP command where you want the program to pause
After the SLEEP command, add the number of seconds that the program should wait. The SLEEP command cannot be interrupted by the user.
Method 4 of 4: Ping
Step 1. Use the PING command to force the program to wait a certain number of seconds
You can hide the output from the user to mask the delay. You must ping an invalid IP address or the delay timing will not work correctly. You will need to ping a valid host name, otherwise the error message will be displayed to the user.
Step 2. Insert the PING command where you want the program to pause
The parameter >zero prevents the command from being displayed. The -n 1 parameter adds a second ping to the original command. The pause between the first and second ping, denoted by -w 30000, is the delay. The delay must be specified in milliseconds.