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