The script below addresses the simplest case I can think of, namely a host which exists and which either is or is not servicing ping requests. If the ping command is "successful" then it looks like this...
C:\>ping -n 1 192.168.56.129
Pinging 192.168.56.129 with 32 bytes of data:
Reply from 192.168.56.129: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.56.129:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
If not, it looks like this
C:\>ping -n 1 192.168.56.129
Pinging 192.168.56.129 with 32 bytes of data:
Request timed out.
Ping statistics for 192.168.56.129:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
I only send 1 request for the sake of avoiding network congestion
The IP I am using is a local XP machine whose firewall I turn on and off
As you will see the meat is in the 2nd non-blank line, and we can examine this and decide whether to write it to a log file, preceded by the date and time. To make a delay I use the free sleep utility which is part of the Windows Server 2003 Resource Kit Tools which you can download here:
http://www.microsoft.com/downloads/en/confirmation.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffdThere are plenty of others around but not all have the -m (milliseconds) feature.
@echo off
setlocal enabledelayedexpansion
set hostIP=192.168.56.129
:loop
set pingline=1
for /f "delims=" %%A in ('ping -n 1 -w 250 -l 255 %hostIP%') do (
if !pingline! equ 2 (
set logline=!date! !time! "%%A"
echo !logline! | find "TTL=">nul || echo !logline! >> pinglog.txt
)
set /a pingline+=1
)
sleep -m 5000
goto loop
The IP you used as an example resolves to lr-rns.timik.uk.easynet.net on my machine; I wonder if you are wanting to log times and/or periods of bad Internet connection or whether it was just an example?