Video Screencast Help
Endpoint Management Community Blog

Waits for a specified amount of time in a batch file

Created: 30 Apr 2009 • 2 comments
riva11's picture
+11 11 Votes
Login to vote

Sometime in a batch file you need to wait to ensure that enough time is given for some operations to complete (installation, configuration, etc.)

There are some ways and tricks to put a pause, if you have a specific time a good solution is use the Sleep.exe utility.

This utility is available with the Windows Server 2003 Resource Kit Tools .  Useful in batch files, Sleep.exe waits for a specified amount of time.

Usage:

sleep time-to-sleep-in-seconds
sleep [-m] time-to-sleep-in-milliseconds
sleep [-c] commited-memory ratio (1%-100%)

Example :
sleep 5 ( waits for 5 seconds )

Link : Windows Server 2003 Resource Kit Tools

Comments 2 CommentsJump to latest comment

Screenbert's picture

If you want something that can work with any windows OS you can also use this command

ping 127.0.0.1 -n 1 -w 1000 >nul

just replace the 1 in the  "-n 1"  with the number of seconds you want to wait.

Screenbert

+4
Login to vote
Eshwar's picture

It is very useful for me. Thanks Screenbert.

Cheers,

Eshwar

+2
Login to vote