I want to run some command once, 10 seconds to 1 minute from now.
Windows at
command only receives absolute times, like 11:50.
How can it be done? Can it be done with other command line means?
Yes, the timeout
command can handle that:
timeout /t 10 >NUL
echo "this message will be echoed after 10 seconds timeout"
OR
timeout /t 10 >NUL && echo "this message will be echoed after 10 seconds timeout"
For more information, see timeout /?
. The use of >NUL
is to avoid it showing timeout on the screen, feel free to remove it.
If timeout
not available on your system, you could also use ping -n 10 127.0.0.1 >NUL
instead of timeout /t 10 >NUL
as described here.
timeout
. Also, typically Windows uses /?
, or sometimes -?
. Linux is more likely to use --help
.
sleep
command and it requires an --help
argument.
Mar 11, 2012 at 10:28
On Xp I used a seperate sleep executable came in some microsoft package , worked in seconds. Sleep 1
In windows 7 , I switched and started using timeout /T 1 > NUL
With the 1 representing the ammount of seconds. Timeout /?
for the help on it.
Without the redirection of the output timeout 10
it shows an abortable countdown, which has other uses.
It was always important to me to find the one that required minimal resources, both of these methods seem to require very little effort for the computer.