Ping multipal IP with background Colour changes in windows

Hello Experts,
how does make a bat file for continuous Ping multipal IP with background Colour changes ?
for example:-
start ping -t 192.168.207.11 -l 0
start ping -t 192.168.207.12 -l 0
start ping -t 192.168.207.13 -l 0
start ping -t 192.168.207.14 -l 0
start ping -t 192.168.207.15 -l 0
LVL 1
Rajat SehgalFounder Enhance TechnologyAsked:
Who is Participating?
 
Bill PrewCommented:
See if this gets you started.  There is a driver bat file (pingstart.bat), and then a worker one (pingloop.bat).  Place a list of the IPs to be monitored into the "iplist.txt" file, and then run the "pingstart.bat" file to launch a worker window for each IP in the file.  Color will change depending on status from the PING command.

There is no easy way to see the full output of the PING command in the windows since we need to capture that internally in the BAT file and look at it to determine if the PING failed.  For successful PINGs we see one line from the PING command, for fails we see none.

You may want to add a delay in the PING loops and not monitor constantly, could slow down the system running all this.

***** PINGSTART.BAT *****
@echo off
setlocal

set "iplist=iplist.txt"

if not exist "%iplist%" (
    echo Missing IPLIST file "%iplist.txt"
    exit /b
)

for /f "usebackq tokens=*" %%i in ("%iplist%") do (
    start pingloop.bat %%~i
)

Open in new window

***** PINGLOOP.BAT *****
@echo off
setlocal

set colorUp=2F
set colorDown=4F

if "%~1" EQU "" (
    exit /b
)

title IP:%~1 - Status:

:Loop
    echo %DATE% %TIME%
    ping -n 1 -l 0 %~1 | find "TTL=" && (
        color %colorUp%
        title IP:%~1 - Status:UP
    ) || (
        color %colorDown%
        title IP:%~1 - Status:DOWN
    )
    goto :Loop

Open in new window

***** IPLIST.TXT *****
192.168.0.1
192.168.0.22
192.168.0.222

Open in new window


»bp
1
 
Bill PrewCommented:
Unless this is purely an educational activity trying to learn more about DOS scripting, I would use one of the many freeware Windows ping utilities for this task.  Here are a couple that are worth a look and allow you to see status of a set of nodes.



»bp
1
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
Sir i need implement with DOS scripting only.
0
 
Rajat SehgalFounder Enhance TechnologyAuthor Commented:
Thank You Sir.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.