@echo off
set Address=google.com
:Loop
PING -n 5 127.0.0.1>nul
echo Pinging %Address%
%SystemRoot%\system32\ping.exe -n 1 %Address% | %SystemRoot%\system32\find.exe "TTL=" > NUL >> C:\pingtest\logfile.log
if %ERRORLEVEL% EQU 0 goto :Loop
echo Trace route %Address% at %date% %time% >> C:\pingtest\logfile.log
tracert %Address% >> C:\pingtest\logfile.log
goto Loop
This is what I came across if someone else needs it. Essentially, “Ping -n 127.0.0.1> Nul” should add a 5 second counter so that it only pings the destination every 5 seconds, 5 could be changed to any value.
Windows 7 has this problem when ping can lead to something like "response from 192.168.1.5: Destination host unreachable". Therefore, instead of failing, it receives a response from itself, and not error level 1. Instead of searching for error level 1, I do not want to search for the result for TTL with "% SystemRoot% \ system32 \ ping.exe -n 1% Address% |% SystemRoot% \ system32 \ find.exe "TTL ="> NUL "
, , , , , , .
!