found this batch file with timer. I'm not very familiar with *.bat files but have foundout the following
THAT 01 is the time in seconds
PING -n 01 127.0.0.1>nul
however im not sure what the rest means rather then just go and use it could someone please explain what all other items in this snippet do/ represent
thanks
It's a sneaky sleep
statement. I've used it before to get a delay in a cmd.exe
script without having to resort to external utilities.
However,
ping -n 21 127.0.0.1 >nul:
will generally give you about a 20 second delay because the first ping goes out immediately (only the subsequent pings are sent after a 1-second delay).
If you try your variant (with 01
) without the >nul
bit, you'll see it returns immediately. If you try it with 21
, it should take about 20 seconds, and you'll see why, hopefully :-).
As to what all the bits mean:
ping
is the ping executable, meant to check whether you can communicate with a specific IP address (it's less useful than you think since many sites will block ICMP (ping) packets while still allowing real traffic.
-n 21
means to try 21 times (with one second between each, although you can change that with another parameter).
127.0.0.1
is the loopback address, basically "this computer". You ping your own computer so that no network delays are introduced (and to not annoy your target if everyone on the planet decided to use slashdot.org
for example).
>nul
just means to send all the output to the bit-bucket so you don't see it on the console.