Is it possible to insert a timed pause into batch files

batch-file

Is it possible to insert a timed pause in a DOS batch file?

It should act like the pause command, but instead of having to hit any key, it will continue on its own in X seconds.

Best Answer

The ugly, but traditional, solution that I've seen used when you don't want to install any non-stock software is to use PING. Such as:

@echo off
rem Sleep 5 seconds
ping -n 6 127.0.0.1>NUL

The 6 is necessary because the first request is returned almost immediately, counting for roughly "0" seconds, so you need to send x + 1 more requests to get the desired delay.