Link to home
Start Free TrialLog in
Avatar of wile_e_coyote
wile_e_coyote

asked on

What's the equivalent of the DOS "sleep" command in the XP command prompt window?

I want to do the following from a .bat file under Windows XP

run a program
wait 5 seconds
run another program

What's the Windows XP command for "wait 5 seconds".  I tried "sleep" but that doesn't seem to be supported.
Avatar of sunray_2003
sunray_2003
Flag of United States of America image

Check if this do the trick

http://www.jsifaq.com/SUBO/tip7300/rh7307.htm

Sunray
Avatar of wile_e_coyote
wile_e_coyote

ASKER

I tried that, but it doesn't work


C:\xxx>timeout /t 2
'timeout' is not recognized as an internal or external command, operable program or batch file.
Can you not use a for loop to delay the process

Sunray
Avatar of Mikal613
If the purpose of the delay is to wait until the first program is done to start the next use the Start command with the /wait option.

Start
Starts a separate Command Prompt window to run a specified program or command. Used without parameters, start opens a second command prompt window.

Syntax
start ["Title"] [/dPath] [/i] [/min] [/max] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/wait] [/b] [FileName] [Parameters]

/wait
Starts an application and waits for it to end.
Why not do it in the task scheduler?
START | PROGRAMS | ACCESSORIES | SYSTEM TOOLS | Scheduled Tasks
ASKER CERTIFIED SOLUTION
Avatar of wile_e_coyote
wile_e_coyote

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What you could do is leverage off the ping command since it supports Timeouts. For example to wait 4 seconds:

echo wait...
ping -n 1 -w 4000 10.0.0.0
echo finished waiting.
I'm going to ask that this question be deleted since I found the sleep command (exactlly what I was looking for) in the Windows 2003 server resource kit
Some online (sorry author can't remember location) gave this tidbit which was to insert a "ping" to an invalid host and set the wait time for the period you wish to wait.

e.g. PING 1.1.1.1 -n 1 -w 60000 >NUL

Smart thinking (outside the box).