Download AutoIT and compile this script:
#Include <File.au3>
Dim $handle = FileOpen("Settings.txt")
Dim $delay = FileReadLine("Settings.txt",1)
Dim $timeout = FileReadLine("Settings.txt",2)
Dim $repeat = FileReadLine("Settings.txt",3)
FileClose($handle)
Dim $DoForever = 1
While $DoForever = 1
$handle = FileOpen("IPList.txt")
Dim $ip[1000], $line
$line = FileReadLine("IPList.txt",1)
If $line = "" Then
Exit
EndIf
Dim $i = 0
While($line <> "")
$ip[$i] = $line
$i = $i + 1
$line = FileReadLine("IPList.txt",$i+1)
WEnd
FileClose($handle)
If FileExists("Ping.txt") = 0 Then
_FileCreate("Ping.txt")
Else
FileWriteLine("Ping.txt","")
FileWriteLine("Ping.txt",@YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
EndIf
Dim $ping
For $j=0 To $i-1 Step 1
FileWriteLine("Ping.txt","Pinging " & $ip[$j] & ":")
For $k=0 To $repeat-1 Step 1
$ping = Ping($ip[$j],$timeout)
If $ping = 0 Then
If @error = 1 Then
$ping = "Host is offline"
ElseIf @error = 2 Then
$ping = "Host is unreachable"
ElseIf @error = 3 Then
$ping = "Bad Destination"
ElseIf @error = 4 Then
$ping = "Other errors"
EndIf
EndIf
FileWriteLine("Ping.txt",$ping)
Next
FileWriteLine("Ping.txt","")
Next
FileFlush($handle)
FileClose($handle)
Sleep($delay)
WEnd
You will need to provide the following for this script to work:
1) A "Settings.txt" file:
a) First line: Script repeat time in milliseconds
b) Second line: Ping timeout in milliseconds
3) Third line: Ping count
2) An "IPList.txt" file: You enter a single IP address in each line.
The script will read the IP addresses, create a Ping.txt file and write the ping results there for each IP, along with the starting date at the top. No need to delete the Ping.txt file periodically as following results will simply be appended at the end of the file.
If you would like this to be modified in any way, tell me, I'll try.