the matt jones website.‎ > ‎Scripts‎ > ‎

Bulk Ping (batch)

Below is a batch script that pings a list of servers/IP's listed a file:
----------------------------------------------------------------------------------------------------------------------
ECHO OFF
FOR /F "eol=; tokens=* " %%i in (inputlist.txt) DO call:ping %%i

:ping %%i
FOR /F %%j in ('ping -n 1 %~1 ^| find /C "Reply"') DO @set pingable=%%j
IF %pingable%==1 (ECHO %~1 is Reachable) 
IF "%~1"=="" (ECHO END) ELSE (IF %pingable%==0 (ECHO %~1 is Unreachable))
----------------------------------------------------------------------------------------------------------------------
Comments