Here's a haxxorish way to pause for a second in a batch file:
PING 400.500.600.700 > NUL
I've googled but I'm not sure there are any better ones.. any ideas? :)
|
Here's a haxxorish way to pause for a second in a batch file:
I've googled but I'm not sure there are any better ones.. any ideas? :) | |||
|
feedback
|
|
You can use the "default choice" and "timeout" options of the built-in choice command to create a delay.
| |||||||||||||||
feedback
|
|
Here's what I've been using as substitute for sleep.exe,
Change | ||||
|
feedback
|
|
Apparently the windows resource kit has the sleep command in it. Other Sites also recommend using choice..... | |||
|
feedback
|
|
CHOICE command with a timer on it works well... CHOICE /C:x /T:x,10 > NUL There are also "programs" out there you could run like WAIT and SLEEP, etc. Hope this helps. | |||
|
feedback
|
|
The ping one (above) is a good one- but only works if connected to a network. A bit of script that will delay is below: @echo off set /a secondsend=%TIME:~6,2%+10 if %secondsend% GTR 59 set /a secondsend=secondsend-60 :waithere if %TIME:~6,2% NEQ %secondsend% goto waithere This will pause from between 9-10 seconds (the first second isn't accurate due to using the TIME command- and it could be halfway through a second before you begin). If works by setting 'secondsend' to the current second of the pc clock, then adding 10 to it (the delay). If it's greater than 59 taking 60 off as it's wrapped around to next minute. Then there is a loop which checks the current second with 'secondsend'- once they match the script continues. If you want to delay by a different period 2-59 then alter the 10 in the second line (I say 2-59 as the first second might not be a full second, so 2 could be say, 1.2 seconds for example). Sorry it's so longwinded but thought I'd explain how the routine works. | |||||||
feedback
|
|
I just wrote a simple exe in C#. Simply using the statis System.Threading.Sleep, and take the commandline argument and convert it to an integer. It took 5 minutes to do. | |||
|
feedback
|