Sleep command in Windows 7

by admin on April 18, 2012

Windows 7  provides a new command sleep which can be used in batch files or command prompt to pause the execution and wait for some time. In previous Windows editions(XP and Server 2003), this command is not available. Users of these Windows editions can download Windows resource kit tools for obtaining sleep command.

Syntax of sleep command:

sleep no_of_seconds_to_wait

(or)

sleep -m no_of_milli_seconds_to_wait

Examples:
If you want to pause the execution of a batch file for 50 seconds, then you should insert below statement in your batch file.

sleep 50

If you want to wait for 100 milli seconds, then you can run the below command.

sleep -m 100

Sleep command is also available in Server 2008 and Server 2008 R2.

Also Read:Windows  commands

{ 3 comments… read them below or add one }

chris June 12, 2013 at 1:20 pm

Instead of downloading extra tools, you can stick with the ping command as well:
ping /t 50 localhost
will “sleep” 50 secs before going on

Reply

chris June 12, 2013 at 1:24 pm

Excuse my typo. For 50 sec sleep, use

ping localhost -n 50

Reply

Erik August 1, 2013 at 8:42 pm

in Windows Vista an later, you can use Timeout /t

Reply

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: