Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi everybody!
i am using some code i found in this blog from M2 to monitor some hosts through a ping, and save in a file those IPs which are not reachable.this is the code:
@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I | find "Reply" > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log )
I have unsuccessfully tried to save all the pinging output in a different log, besides the non reachable hosts.
i mean, saving in another log file every ping performed by the loop:Pinging xx.xx.x.xxx with 32 bytes of data:
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128
Reply from xx.xx.x.xxx: bytes=32 time<1ms TTL=128Ping statistics for 10.96.1.233:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
any ideas???
thnx a lot

@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I >> allIP.log
ping %%I | find "Reply" > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log )
=====================================
If at first you don't succeed, you're about average.M2

well, yeah Mechanix... i tried that too, but the matter here is that pinging 2 times will take twice the time... i dont really have any problems with the time, but i heard that it is not very advisble to have a batch file running too much time, and this process would be running about 5 times a day...
isnt there a way to use the same ping i use to find the replay (ping %%I | find "Reply" > nul) as to track all the pinging response?

@echo off > badhost.log
for /f %%I in (IPList.txt) do (
ping %%I > %temp%\#
find "Reply" < %temp%\# > nul
if errorlevel 1 echo %%I Not reachable >> badhost.log
type %temp%\# >> allIP.log
)
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |