I am repeatedly (not continuously) pinging an IP address and want to record the date and time of ONLY the failing occurrences. Then wait 5 minutes and repeat the program until I press Crtl-C to end. I am not concerned with the passing results.
Pinging 192.168.10.11 with 32 bytes of data:
Request timed out.
At the moment I have the PING results sent to a file named C:\RESULTS.TXT.
I can query C:\RESULTS.TXT for the word "Request" fine, but here is where I get stuck.
Based on the results of the query, if the word "Request" is found I want to append the current TIME and DATE to a file named FAIL.TXT, wait 5 minutes and repeat from the beginning.
If the C:\RESULTS.TXT file does not contain "Results" then just wait 5 minutes and repeat from the beginning.
My guess is something like this:
ping 192.168.11.11 > C:\RESULTS.TXT
find /c "Request" C:\RESULTS.TXT
rem **** My Problem (not sure of the syntax, but this is the idea):
If “Request” is not found
If “Request” is found
rem **** I'm OK from here until :Wait
Date > c:\Date.text
Time > c:\Time.txt
Copy c:\date.txt + C:\Time.txt > Fail.txt
rem **** another problem
somehow count to 5 minutes (300 seconds)
Any assistance is greatly appreciated.