Skip to content

Instantly share code, notes, and snippets.

@seanvikoren
Last active October 11, 2018 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanvikoren/51dafb1e07e026f14c06a5110af92809 to your computer and use it in GitHub Desktop.
Save seanvikoren/51dafb1e07e026f14c06a5110af92809 to your computer and use it in GitHub Desktop.
Creates a log file of ping activity with a settable delay between pings.
@echo off
SETLOCAL
set pingTarget=yahoo.com
set fileName=pinglog.txt
set waitSeconds=420
echo. | wtee -a %fileName%
echo ====================================================== | wtee -a %fileName%
echo Starting Ping Loop; Logging to %fileName% | wtee -a %fileName%
:timestamp
set day=%date:~7,2%
set month=%date:~4,2%
set year=%date:~10,4%
set timestamp=%year%-%month%-%day%_%time%
echo. | wtee -a %fileName%
echo ------------------------------------------------------ | wtee -a %fileName%
echo Ping Timestamp: %timestamp% | wtee -a %fileName%
:ping
ping %pingTarget% -n 1 | wtee -a %fileName%
:wait
ping 127.0.0.1 -n %waitSeconds% > nul
goto timestamp
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment