Continuous Ping Monitor Batch File With Colour Changes

From roonics
Revision as of 12:26, 23 January 2020 by Jlambert (talk | contribs) (Created page with "A script to continuously monitor an IP address and give clear indications when up or down with timestamp, handy for trouble shooting a network/server issues: <pre> @echo off...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A script to continuously monitor an IP address and give clear indications when up or down with timestamp, handy for trouble shooting a network/server issues:

@echo off
mode 44,20
echo mode 44,20
echo off & cls
set /p IP=Enter your IP Address :
:top
set mytime=%time:~0,2%_%time:~3,2%_%time:~6,2%
set mydate=%date%
PING  -n 1 %IP% | FIND "TTL=" >nul
IF ERRORLEVEL 1 (SET OUT=4F  & echo %mydate% : %time:~0,2%:%time:~3,2%:%time:~6,2%% : Down) ELSE (SET OUT=2F & echo %mydate% : %time:~0,2%:%time:~3,2%:%time:~6,2%% Up)
color %OUT%
ping -n 2 -l 10 127.0.0.1 >nul
GoTo top

Examples: