Batch – Ping with timestamp

Last updated on July 1st, 2018 at 10:18 am

@echo off
ipconfig /all >>pinglog.txt

for /f "tokens=*" %%A in ('ping 8.8.8.8 -n 1 ') do (echo %%A>>pinglog.txt && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping 8.8.8.8 -n 1 ') do (echo %date% %time% %%A>>pinglog.txt && GOTO Ping)