Reply
Old February 18th, 2004 Top | #1
 
the_tazinator's Avatar
Are we there yet?
Joined: May 2002
Location: In a house
Posts: 177
Reputation: 40
Power: 124

Default Delay a Batch command

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?
the_tazinator is offline   Reply With Quote
Old February 18th, 2004 Top | #2

OSNN Folding Team  
Khayman's Avatar
I'm sorry Hal...
Joined: January 2002
Location: England
Posts: 5,514
Reputation: 1210
Power: 194

Default

I don't think you can do it on the batc file but this program
http://www.r2.com.au/software.php?pa...how=startdelay
allows you to specify a startup order and delay items, so you should be able to put the batch file in startup and use this

"*I'm* on the server side. I don't know what side you're on"
Khayman is offline   Reply With Quote
Old February 18th, 2004 Top | #3
 
the_tazinator's Avatar
Are we there yet?
Joined: May 2002
Location: In a house
Posts: 177
Reputation: 40
Power: 124

Default

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.
the_tazinator is offline   Reply With Quote
Old February 18th, 2004 Top | #4

OSNN Folding Team  
Khayman's Avatar
I'm sorry Hal...
Joined: January 2002
Location: England
Posts: 5,514
Reputation: 1210
Power: 194

Default

Nice work around, i'll have to remember that

"*I'm* on the server side. I don't know what side you're on"
Khayman is offline   Reply With Quote
Old February 19th, 2004 Top | #5
 
yoyo's Avatar
_________________
Joined: July 2002
Posts: 1,557
Reputation: 160
Power: 136

Default

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.
Attached Files
File Type: zip sleep.zip (1.9 KB, 35 views)
yoyo is offline   Reply With Quote
Old February 21st, 2004 Top | #6
 
X-Istence's Avatar
*
Joined: December 2001
Location: USA
Posts: 6,496
Reputation: 2808
Power: 220

Default

Hmmm, sleep was first introduced for BSD/Linux :P
X-Istence is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
running a batch file from a command window launched from a c sharp program Complete Web Design & Coding 1 March 27th, 2008 11:13pm
delay in searching gillmacca Windows Desktop Systems 15 July 6th, 2005 11:24am
Odd delay torrent Windows Desktop Systems 6 February 16th, 2002 11:25am
startup delay jbob Windows Desktop Systems 8 February 9th, 2002 9:47am
One click delay kensiko Windows Desktop Systems 2 February 1st, 2002 11:15pm