Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to insert a timed pause in a DOS batch file?

It should act like the pause command, but instead of having to hit any key, it will continue on its own in X seconds.

share|improve this question
To impress my girlfriend. – ToastMan Aug 9 '10 at 19:24
But seriously, I want to exceute shudown -r after a bunch of scripts have finished executing, don't ask why, and don't ask why I am not using shutdown -r -t X, it doesn't work for our purpose. – ToastMan Aug 9 '10 at 19:28
up vote 3 down vote accepted

The ugly, but traditional, solution that I've seen used when you don't want to install any non-stock software is to use PING. Such as:

@echo off
rem Sleep 5 seconds
ping -n 6>NUL

The 6 is necessary because the first request is returned almost immediately, counting for roughly "0" seconds, so you need to send x + 1 more requests to get the desired delay.

share|improve this answer
Genius! Thank you!! – ToastMan Aug 9 '10 at 19:52

Assuming you're not talking about DOS batch files but Windows batch files:

> timeout /?

TIMEOUT [/T] timeout [/NOBREAK]


This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press.

Parameter List:

/T        timeout       Specifies the number of seconds to wait.
                        Valid range is -1 to 99999 seconds.

/NOBREAK                Ignore key presses and wait specified time.

/?                      Displays this help message.

NOTE: A timeout value of −1 means to wait indefinitely for a key press.


share|improve this answer

If you mean "batch" files. There's no built-in command; but the Win2003 Resource Pack included a program that functions the same. More info here:

share|improve this answer
If it is a batch file you can use the the choice command. To wait for 3 seconds a command like choice /t 3 /D N > nul would work. – Zoredache Aug 9 '10 at 19:23
the choice command is not recognized :( – ToastMan Aug 9 '10 at 19:26
You think the sleep program would work on XP if I imported it? – ToastMan Aug 9 '10 at 19:31
@ToastMan, yes that program will work on Win2k to Win7. – Chris S Aug 9 '10 at 19:43
The choice.exe seems to on every version of windows except XP. I think it was added as part of DOS 6.0 if I remeber right. You may be able to copy a choice.exe from a w2k box if you have one available. – Zoredache Aug 9 '10 at 19:49

Or, you could do it this way:

@echo off
rem Sleep 5 seconds
ECHO Do other stuff here


ping -n %~1 -w 1>nul

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.