I use a batch file to start up a few of the programs I need running in the background. Up until now, I had used the pause command to execute it after some of the other start-ups finished. I would prefer to use the wait or sleep commands but they do not appear to be included in Windows 7.

Anybody know how to put those commands back in, or a different method that achieves the same results?


7 Answers 7


There are many sleep utilities you can download and drop into your System32 folder, one is provided with the Windows Server 2003 Resource Kit called sleep.exe.

You can also use the ping trick:

ping -n 2 -w 1000 > NUL
ping -n %1 -w 1000 > NUL

then from somewhere in your batch file, you can call it like so:

CALL :sleep 1
  • 1
    the ping trick could be used as a temperary solution, but I would prefer one that just suspended the process, rather than have it do busy work for the time. Also, which one of the items in that list you linked was what I was looking for?
    – Cegorach
    Sep 29, 2009 at 0:29
  • You want sleep.exe
    – John T
    Sep 29, 2009 at 0:32
  • i tried CALL :sleep 1 from a test batch file and it responded with "system cannot find the batch label specified - SLEEP"
    – Cegorach
    Sep 29, 2009 at 0:38
  • because you need to add the subroutine I posted above. Call just calls the subroutine, which is the 3 lines I posted above the call command.
    – John T
    Sep 29, 2009 at 0:58

You can use the timeout command:

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.

For example, to wait for 10 seconds:


For more details:

  • 1
    why isn't this chosen as the correct answer? the current one is far fetched if you ask me Aug 4, 2012 at 18:50
  • 8
    @Dany: because the topic is from 2009, when most installs were XP. Before Vista, Timeout was only in the server editions and in the Resource Kit, not on a normal XP install. Nowadays, indeed, the correct answer is Timeout.
    – mivk
    Oct 31, 2012 at 18:47
  • 6
    @DanyKhalife Unless you want to run the process in the background. "ERROR: Input redirection is not supported, exiting the process immediately."
    – AnnanFay
    Nov 18, 2013 at 17:34
timeout /t <seconds> /nobreak > NUL
  • Works great! calc && timeout 3 && notepad Sep 1, 2010 at 13:10

There is also

waitfor SomethingThatIsNeverHappening /t 10

Which will wait for between 1 and 99999 seconds.


sleep.exe is included in the Windows Server 2003 Resource Kit Tools.

You may use:

sleep /?
sleep seconds
sleep -m microseconds


Here is a batch file macro that you can use:

@echo off & cls & setlocal disabledelayedexpansion
set LF=^

set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
set _delay=for /l %%a in (1 1 2) do if %%a==2 (%\n%
  for /f "tokens=1 delims=, " %%e in ("!argv!") do (%\n%
    set "_sec=%%~e" %\n%
    %__APPDIR__%ping.exe localhost -n !_sec! -w 1000 ^>nul 2^>^&1 %\n%
  ) %\n%
) else setlocal enabledelayedexpansion ^& set argv=,

You can call this in your batch file like:

%_delay% seconds

Like %_delay% 10 will wait for 10 seconds. To change the macro name replace "_delay" with anything else in fourth line.


If you have Python installed (and added the install path to your environment variable), you can let Python do the sleeping with something like:

echo from time import sleep; sleep(3) | python

(If you have Windows Vista or higher, timeout naturally is the way to go, though.)

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