I have written a Batch Script to constantly ping a router IP Address and then when it returns ErrorLevel 1 it will run a traceroute to that IP and then once completed it starts over again.
I would like to change this so that it outputs the results of the ping into a temporary text file (temp.txt) then scans the "temp.txt" for the reply "Request TImed Out" if one of the four replies have this string I would like the batch file to display the contents of "temp.txt" on screen and also write them to a log file (report.txt). It would then perform the trace route which would output the results of the trace to "trace.txt" once the trace route has completed the batch file would loop until another "Request Timed Out" is detected. Obviously the "temp.txt" file would need to be wiped each time the loop is repeated.
I have come up with the following for the ping command:
ping -w 1000 -n 1 192.168.1.9 >>temp.txt
Now I just need help with creating a command to scan "temp.txt" for "Request Timed Out" and if true then to output "temp.txt" to screen and to "Report.txt" then call the trace route routine; if FALSE then output "temp.txt" to screen and continue loop.
Hope this describes my problem well enough for you to be able to help me. Many thanks in advance.