Delay a Batch command

the_tazinator

Are we there yet?
Joined
19 May 2002
Messages
177
I am trying to write a batch file that will start a service 1 minute after a computer boots up. I have it set as a scheduled task to run at startup but I need to put a delay in it so that everything else has started before this process starts. Any ideas on how to create a simple 60 second delay?
 
I found a round-about way of creating the delay, but for anyone who wants to know how I did it; I pinged and invalid IP address once with a timeout of 60 seconds, works perfect!

ping 1.1.1.1 -n 1 -w 60000

This way the time delay can be easily be changed.
 
Nice work around, i'll have to remember that :)
 
Agreed, nice workaround.

Alternatively you could use sleep.exe from the Windows Server 2003 (and XP) Resource Kit Tools.
In case you don't want to download 12 MB to get a 5 KB file, find it attached. Unzip into your system32 folder. Now a line like
Sleep 10
will pause a batch file for ten seconds.
 

Attachments

  • sleep.zip
    1.9 KB · Views: 61

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back