This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
If you need some extra time for a command in your batch file to execute, there are several easy ways to delay a batch file. While the well-known sleep command from older versions of Windows is not available in Windows 10 or 11, you can use the timeout, pause, ping, and choice commands to wait a specific number of seconds or simply pause until the user presses a key. This wikiHow article will teach you 5 simple ways to delay the next command in your batch file on any version of Windows.
Things You Should Know
The timeout command lets you pause for specific number of seconds, until a user presses a key, or indefinitely.
Use the pause command to delay the batch file until a user presses any key, or the choice command to give the user options to choose from.
You can hide on-screen messages that indicate delay to the user by adding >nul to the end of the timeout, ping, and choice commands.
Use the timeout command to specify the delay time in seconds. By inserting the timeout command into your batch file, you can prompt the batch file to wait a specified number of seconds (or for a key press) before proceeding.[1]XResearch source This command is available on all modern versions of windows, including Windows 10.
Use the pause command to suspend the batch file until a user presses a key. This simple command doesn't require any flags and you can place it anywhere in your script to prevent further action. When the pause command runs in the batch file, the user will see Press any key to continue . . . on a new line. When the user presses a key, the script continues.[4]XResearch source
You might use pause right before a section of the batch file that you might not want to process, or before providing instructions to the user to insert a disk before continuing.[5]XResearch source
At the pause, you can stop the batch program completely by pressing Ctrl + C and then Y.
Use ping to delay the next command in the script until a ping is complete. You can add a ping anywhere in your batch file, enter any hostname or IP address (including a nonexistent address), and specify the time in milliseconds to delay the next command. You'll also be able to hide the output of the ping so the user won't see what's happening in the background.[6]XResearch source
ping /n 1 /w <timeout in milliseconds> localhost >nul
Ping has many more available flags, but for the purpose of delaying a batch file, you'll only need to use a few. In this case, we'll ping ourselves by using localhost as our destination.
To pause quietly for 10 seconds, you'd use ping /n 1 /w 10000 localhost >nul
Use the choice command to delay until a user selects an option from a list. You can customize the list of choices, use the default options of Y or N, or choose not to display any choices at all and simply delay your script for a specific period of time.[7]XResearch source
/c <choice1><choice2><…>: Specifies the choices you'd like to create, which can include a-z, A-Z, 0-9, and ASCII characters 128-254.
/t <seconds>: Use this flag to specify how many seconds to wait before the default choice is selected. You can set this value to any number between 0 (which instantly selects the default choice) and 9999.
/d <choice>: Specifies the default choice from the list of choices created with /c.
/n(optional): hides the list of choices, but still allows the user to select one.
/m <text>(optional): displays a message before the choice list. If you don't include this flag but don't hide the choice list, the choices will still be displayed.
/cs (optional): This specifies that choices are case-sensitive, which is important if you want to assign different functions to capital and lowercase letters.
To create a delay with CHOICE without displaying a message or forcing the user to choose something, use rem | choice /c:AB /T:A,30 >nul. This command simply delays the batch file for 30 seconds (similar to using Timeout with no message), provides no choices to the user, and continues after the delay. You can replace 30 with any value up to 9999 (in seconds).
If you're using Windows XP or earlier, you can use sleep to specify a wait time in seconds. This command will not work in any newer versions of Windows starting with Windows Vista, but is the easiest way to add wait time to batch files running on older systems.
sleep <seconds>
The sleep command only requires the number of seconds you want to delay the batch file. For example, to wait 30 seconds before continuing, you'd use sleep 30.
Add the >nul qualifier, like this: timeout /t 120 >nul. This causes a 2 minute delay with no output to the screen.
Question
What if the sleep command doesn't work?
Community Answer
If the sleep command doesn't work, use timeout instead.
Question
What if I want to wait less than one second? I can't just use a dot or a comma.
Community Answer
You can use the ping command. This command, if used with a non-existent IP address, will try to talk to a non-existent computer and give up after a specified number of milliseconds. Just multiply the number of seconds by 1000, and you're good to go.
The "PAUSE" command is best used in situations where you're relying on a user to trigger the next section of the batch file, while the "TIMEOUT" command is suited to situations in which you want to allow the file to run automatically.
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 1,623,980 times.
Thanks to all authors for creating a page that has been read 1,623,980 times.
Reader Success Stories
Nangah Shikari
Jun 6, 2016
"This is great. The ping one, especially. I was working on crashing computers and I worked out that it takes 128 windows to crash an 8GB RAM, but with this command it takes 64 only."..." more
% of people told us that this article helped them.
Co-authors: 27
Updated: September 19, 2025
Views: 1,623,980
Nangah Shikari
Jun 6, 2016
"This is great. The ping one, especially. I was working on crashing computers and I worked out that it takes 128 windows to crash an 8GB RAM, but with this command it takes 64 only."..." more
Richard Weeber
Mar 14, 2017
"Someone asked me to use the SLEEP command, which didn't work on my version of Windows. I've now discovered the TIMEOUT command, which was a big help."..." more
Paul Andrews
Mar 1, 2017
"I just needed a way to program a delay, and this article told me that the SLEEP command had been replaced by the TIMEOUT command. Problem solved."..." more
Anonymous
Jul 20, 2017
"This helped me so much, thank you. I tried one, then realized it wouldn't work for me, so I tried the next one and it worked great!"..." more
Rated this article:
NorteX
Sep 7, 2017
"I searched for milliseconds .BAT delay. Couldn't get it from any site, this was really helpful."