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.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 1,309,717 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.
References
About This Article
1. To pause until a key is pressed, use "PAUSE."
2. To wait a specific amount of time, use "TIMEOUT."
3. To wait for a ping response, use "PING" followed by the IP.