Created
February 13, 2016 13:13
-
-
Save jasper-lyons/b72014a99fccdbca04f6 to your computer and use it in GitHub Desktop.
Keep track of internet connectivity from http://stackoverflow.com/questions/24906268/ping-with-timestamp#answer-32185695
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set/p host=host Address: | |
set logfile=Log_%host%.log | |
echo Target Host = %host% >%logfile% | |
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping) | |
:Ping | |
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do ( | |
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile% | |
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A | |
timeout 1 >NUL | |
GOTO Ping) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment