Wednesday, August 1, 2012

DOS batch ping multiple hosts script

DOS batch ping multiple hosts script

Name: batchping.bat

You also need myhosts.txt which should contain the hosts IP that you want to ping, and batchping.log which will log the result.

---script begin---
@echo off
del /Q batchping.log
for /f %%i in (myhosts.txt) do call ::pingit %%i

:pingit
if "%1"=="" goto END
ping -n 1 %1 >nul
if errorlevel 1 goto FAIL
echo %1 - is good >> batchping.log
goto END

:FAIL
echo %1 - is not pingable >> batchping.log

:END

---script end---

http://forums.hexus.net/networking-broadband/116568-dos-windows-ping-utility-multiple-hosts.html
http://www.krishnababug.com/2009/09/ping-mutiple-ips-bat-file.html

No comments:

Post a Comment