Download Article
Download Article
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
Search
-
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.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
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
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement
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
Thanks to all authors for creating a page that has been read 1,570,702 times.
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
Advertisement