rem
@echo off
for /F "eol=; tokens=1,2* delims==" %%i in () do call :checkip %%i %%j 0
echo --------------------------------------------------------------
echo --The first round of inspection has been completed. If no alarm sound is heard, it means that all IPs can PING----
echo --If there is an abnormal IP, please use the PING command manually to confirm the correctness of the check----
echo --- Check a loop now, check an IP every 10,000ms ---
echo --------------------------------------------------------------
:begin
for /F "eol=; tokens=1,2* delims==" %%i in () do call :checkip %%i %%j 10000
goto begin
:checkip
@echo off
PING %1 -n 1 | FIND "TTL=" >NUL
IF NOT ERRORLEVEL 1 ECHO %1(%2) Status OK at %TIME%
IF NOT ERRORLEVEL 1 GOTO NEXT
PING %1 -n 1 -w 3000 | FIND "TTL=" >NUL
if %ERRORLEVEL%==1 call :send %1 %2 ELSE ECHO %1(%2) Status OK at %TIME%
:Next
sleep %3
goto end
:send
@echo off
ECHO %1(%2):::::Status ERROR at %TIME%:::::
for /F "eol=;" %%i in () do net send %%i "Error Pinging %1(%2)." >NUL
Beep 1500 500
Beep 500 500
Beep 1500 500
Beep 500 500
goto end
:end