Client Management Suite

Pause Batch Script for a Number of Seconds 

06-26-2008 12:17 PM

There are a few ways to have a batch script wait for a number of seconds. The simplest and most widely available without any additional programs is to use the ping command.

The following is is an example... PING!

ECHO Waiting 5 seconds
PING 1.1.1.1 -n 1 -w 5000 > NUL

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

08-21-2008 04:21 PM

I found that the syntax is different in Windows based DOS.
REM Wait 5 seconds
ping -n 5 127.0.0.1 > nul

06-30-2008 01:17 PM

You should use the loop back address versus a non existing ip
ECHO Waiting 5 seconds
PING 127.0.0.1 -n 1 -w 5000 > NUL
Your method for a timer is nice since it doesn't use any "Special" commands or require additional software to be loaded like powershell.

06-27-2008 11:01 PM

I typically use ping also, even though it's a common batch hack. These days, I prefer relying on PowerShell instead of plain batch files though.

06-27-2008 11:09 AM

You can also use the sleep command just like on *NIX boxes. You can get it from Microsoft Services for UNIX.

Related Entries and Links

No Related Resource entered.