Tag Archive: Batch



For people that have ran into this problem, you need two files, this is incredibly easy to do, I am mostly posting it here for my own reference since I never see to be able to find this information when I need it lol. Here it is!

.inf files can only run an .exe, so you have to make a executable file that opens the .pdf which in turn the .inf can autorun.Open Notepad and type:

[autorun]

shellexecute = “start.bat”

icon = autorun.ico

—————————————————————-
Then open Notepad again and type:

start=<filename>.pdf
then save it as start.bat

(without the brackets)

(If your filename has spaces in it, replace the spaces with an under_score)

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