Windows command line “at” command to run 10 seconds from now

Posted on

QUESTION :

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?

ANSWER :

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.

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.

Leave a Reply

Your email address will not be published.