Utilities
Simple Internet Monitor for CMD
A Windows batch script that pings Google DNS once a minute and writes ONLINE or OFFLINE to internet_log.txt. Useful when you need a paper trail of an ISP outage.
@echo off
setlocal EnableDelayedExpansion
:: Simple Internet Monitor for CMD — SOS TECH
set "LOGFILE=internet_log.txt"
set "TARGET=8.8.8.8"
set "INTERVAL=60"
if not exist "%LOGFILE%" (
echo Internet Monitoring Log > "%LOGFILE%"
echo Started: %date% %time% >> "%LOGFILE%"
echo ----------------------------------- >> "%LOGFILE%"
)
echo Internet Monitoring Started...
echo Logging to: %LOGFILE%
echo Press Ctrl+C to stop.
:monitor_loop
set "TIMESTAMP=%date% %time%"
ping -n 1 -w 2000 %TARGET% | find "TTL=" >nul
if !errorlevel! equ 0 (
set "STATUS=ONLINE"
) else (
set "STATUS=OFFLINE"
)
echo !TIMESTAMP! - Status: !STATUS! >> "%LOGFILE%"
echo !TIMESTAMP! - Status: !STATUS!
timeout /t %INTERVAL% /nobreak >nul
goto monitor_loop
