We are using ping command to monitor the networks, Sometimes we have to monitor multiple IP address with continuous ping in different windows. Normal command line is with a black colour background and white text. But it will be better to show a red window if the Request timed out. And the default success pings with a green background. Here is the script to do the ping with color output results.
What is happening in this Batch file?
Prompting an IP address and set to a variable named %IP%, and its pinging once with 32 bytes of data. If it is failed the background color will change to red. And display “Request timed out” then wait for some title . We used a self ping for sleep function. The code put it in loop so it will ping continuously.
:: Batch Script :: color Ping :: Code By Binbert.com echo off & cls set /p IP=Enter your IP Address : :top PING -n 1 %IP% | FIND "TTL=" IF ERRORLEVEL 1 (SET OUT=4F & echo Request timed out.) ELSE (SET OUT=2F) color %OUT% ping -n 2 -l 10 127.0.0.1 >nul GoTo top
Dear Albin,
Really it is useful for monitoring purpose and reduce the stress of monitoring person. I checked it is working fine
Regards,
Jain Scaria
@Albin
Really it is a good effort; ease of use and makes monitoring effortless
@albin
I forget to comment one more thing , while we giving the batch file name as ping.bat, it is not responding, otherwise no problem
Useful one
@mohan
Thanks for your command,
Dear readers …
Please don’t use ping.bat as the file name. because there is a “ping” command already working inside the batch file
nice one……….:)
How to use this color function in Ping -t ?
Color is a dos command to change the cmd colors. Here we changing colors Red and green according to ping error level
hi i want to ping multiple IP for ex ping -n 4 10.1.2.12
ping -n 4 10.1.2.13
ping -n 4 10.1.2.14
ping -n 4 10.1.2.21
ping -n 4 10.1.2.22
ping -n 4 10.1.2.23
ping -n 4 10.1.2.24
ping -n 4 10.1.2.25
ping -n 4 10.1.2.26
ping -n 4 10.1.2.27
ping -n 4 10.1.2.28
ping -n 4 10.1.2.31
ten what how it will work.. please help
@Avinash
Ping will happen only on a singl IP address. You can write a script to ping one by one..
Replace %IP% with the IP addressees which you want to ping.
you can remove “ping -n 2 -l 10 127.0.0.1 >nul” from the script, It is just for a sleep function
how are you, primary blog on fatlike loss. such a person helped.