How to sleep in a Windows .bat script

There is no sleep command for the Microsoft command line. Here is one way to add a fixed delay to a batch file script:

Use the ping command to ping an invalid address and set the timeout for the number of milliseconds you want to delay. So for example, the following command would delay for 5 seconds before proceeding:

     @ping -n 1 -w 5000 > nul

Leave a Reply