vote up 1 vote down star

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 startups 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?

flag

75% accept rate

4 Answers

vote up 2 vote down check

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:

:sleep
ping 127.0.0.1 -n 2 -w 1000 > NUL
ping 127.0.0.1 -n %1 -w 1000 > NUL

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

CALL :sleep 1
link|flag
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 at 0:29
You want sleep.exe – John T Sep 29 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 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 at 0:58
vote up 2 vote down

TIMEOUT /?
TIMEOUT /T 10

link|flag
vote up 0 vote down

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

You may use:

sleep /?
sleep seconds
sleep -m microseconds

link|flag
vote up 0 vote down

Hi I decided to write sleep for my own. Check out my blog http://www.marcindabrowski.net/?p=122

link|flag

Your Answer

Get an OpenID
or
never shown

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