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.
This article has been viewed 1,583,427 times.
Learn more...
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.
Steps
Community Q&A
-
QuestionHow do I not get a message when I use timeout?Community AnswerAdd the >nul qualifier, like this: timeout /t 120 >nul. This causes a 2 minute delay with no output to the screen.
-
QuestionWhat if the sleep command doesn't work?Community AnswerIf the sleep command doesn't work, use timeout instead.
-
QuestionWhat if I want to wait less than one second? I can't just use a dot or a comma.Community AnswerYou 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.
Tips
-
You can run a batch file on any Windows computer by double-clicking it, or launch it from the command prompt.Thanks
-
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.Thanks
-
The formerly used "SLEEP" command does not work on Windows Vista or later, including Windows 10 and 11.Thanks
References
- ↑ https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/timeout
- ↑ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/timeout
- ↑ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/timeout
- ↑ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/pause
- ↑ https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/pause
- ↑ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping
- ↑ https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/choice
About This Article
Reader Success Stories
-
"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