This is a very simple batch file that pings a host. Just double click to run it, enter the IP or computer name you would like to ping, and it will continuously ping that computer, switch, or device with a text file log. It pings 60 times, then gives a summary, then another 60 and summary, and it keeps going till you stop it. Great if you are going home for the day and want to watch to see if a network or device is dropping at night.

Very useful for determining if you have a bad cable, network traffic, etc.

The log file will automatically output to the same directory you run the script from.

Simply copy this code to a file and name it ping_with_timestamp.bat or whatever you want as long as it ends in .bat or click here to download zipped file containing the script ping_with_timestamp

@echo off
:: Bill Wilson
:: 03-19-2013

setlocal enabledelayedexpansion

set /p ip=”Enter IP or HOSTNAME: ” %=%
set outfilename=”ping_timestamp_%ip%.txt”

echo. ********************************************************
echo ____________________________________________________________ > %outfilename%
echo.>> %outfilename%
echo. Results are logging to %outfilename%
echo. ********************************************************
echo. *** RESTARTING this script will overwrite above file ***
echo. ********************************************************
echo. ** This Window only updates approximately every minute *
echo. ********************************************************

echo. Starting Ping to %ip% %date% at %time% >> %outfilename%
echo ____________________________________________________________ >> %outfilename%
echo.>> %outfilename%
echo.>> %outfilename%
:pingloop

echo working…
echo %date% at %time% >> %outfilename%

ping -n 60 %ip%>> %outfilename%

echo ____________________________________________________________ >> %outfilename%
echo. >> %outfilename%
echo. >> %outfilename%

GOTO pingloop
END