Friday, July 9, 2010

Ping with style

For long-term testing of a network connection that goes up and down I created a simple little batch file that prints pings with timestamps.

Script:

@ECHO OFF

IF(%1) == () ECHO. && ECHO Proper Use: pingtime.bat [remote host] [output file] [ping count] && GOTO end
IF(%2) == () ECHO. && ECHO Proper Use: pingtime.bat [remote host] [output file] [ping count] && GOTO end
IF(%3) == () ECHO. && ECHO Proper Use: pingtime.bat [remote host] [output file] [ping count] && GOTO end

:start
ECHO ********************************************************************************* >> %2
date /T >> %2
time /t >> %2
ECHO ********************************************************************************* >> %2
ping -n %3 %1>> %2
ECHO.
goto start
:end