New
#1
Do command when file 3rd-to-last line does NOT contains a string
I'm having connection issues which I'm documenting. I have a close variant of the following that has 60 seconds in between each call, but I'd like one to be continuous until the connection is reestablished. The way I see it, at the end of the following there would be some way of checking the log content and if what's at the end of the log reflect a disconnection and if so immediately make another call.
and since a good ping should end with something likeecho %time:~0,5%
@set yymmdd=%date:~12,2%%date:~7,2%%date:~4,2%
echo %date% >> logs\pinger-%yymmdd%.txt
::using "time /t | tee -a [...]" take 4 time the processing of doing the command twice
echo %time:~0,5% >> logs\pinger-%yymmdd%.txt
ping google.ca >> logs\pinger-%yymmdd%.txt
pinger-win10.bat
but when the ping goes bad it's likePing statistics for 172.217.13.99:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 12ms, Maximum = 12ms, Average = 12ms
, I think the batch last line would be something like ifRequest timed out.
Ping statistics for 172.217.13.99:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),; that's just an example and I'm not good at these kind of things.SEARCH logs\pinger-%yymmdd%.txt -line m -match false "(0% loss)" then pinger-win10.bat REM else it stops
TLDR How to do a command if a file 3rd-to-last line does NOT contains a specific string?
Thank you kindly for your assistance