Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 1

Batch Files - Delay A batch file can be delayed if wanted. There is no specific command for this.

But a substitute command can be used with its displayed output quashed by the "nul" keyword. We use "ping" here. But first we set a variable and just store the localhost address in it. set ping=127.0.0.1 Note: The localhost IP range goes from 127.0.0.2-127.255.255.254 --------------------------------------------set ping=127.0.0.1 echo This ping %ping% -n 2 > nul echo batch ping %ping% -n 2 > nul echo is ping %ping% -n 2 > nul echo slow pause>nul exit -------------------------------------------For example: This batch file displays the words This batch is slow in turn but with a two seconds delay. The delay is not exactly two seconds since ping is never really accurate, but its somewhere near the two seconds. If you dont put > nul at the end of the ping command, the command will be shown when the batch file runs.

You might also like