Windows 2000 – sleeping in a batch file

Ever wanted to sleep for a couple of seconds in a batch file on Windows 2000?

Well, here is the answer, and it’s a beauty:

The Windows 2000 Resource Kits provide sleep.exe to allow a batch file to sleep for n seconds.

You can emulate this behavior by using the PING (Packet InterNet Groper) command:

ping -n seconds+1 127.0.0.1>nul:

To sleep for 15 seconds, type:

ping -n 16 127.0.0.1>nul:

You do not have this problem with XP, it has a sleep command.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s