My Stuff

My Collection of Useful Stuff

« PreviousNext »

How to create a Wait statement in batch files

1 September 2007

To make a batch file wait for a number of seconds, do this:For any MS-DOS or Windows version with a TCP/IP client, PING can be used to delay execution for a number of seconds.
If specified with a -w switch, PING will wait for a number of milliseconds before timing out. The -n switch causes ping to execute once instead of the default four tries.

The IP address 1.1.1.1 must be an invalid address for this to work.

PING 1.1.1.1 -n 1 -w 60000 >NUL

Posted in batch files, Scripting | Trackback | del.icio.us | Top Of Page

Comments are closed.