Im working on a simple script to log some time and ping info when a failure occurs, however when the ping is in place the script just closes.
:: setting variables/conditions for the loop
:: not interval is number of seconds between loop run
set folder1="C:\Users\Joseph\Desktop\Testing_1"
set num=0
Set Interval=60
set IPAddress=8.8.8.8
:LoopStart
ping -n 4 %IPADDRESS% | find "TTL=" > nul
if errorlevel 1 set /a num=%num% + 1
if errorlevel 1 set file1="%folder1%\25090_log_%num%.txt"
if errorlevel 1 echo %date%-%time% >> %file1%
if errorlevel 1 ping -n 1 %ipaddress% >>%file1%
timeout %INTERVAL%
Goto LoopStart
any ideas on how to make this not close when the ping passes? I'm a little stumped it all works fine when the ping fails - loops and records as desired.