@echo off SET /P Machine=Type in the IP or domain to run tracert & Ping IF "%Machine%"== "" GOTO Error :: Retrieves a useable date from the system date. for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "datestamp=%MM%-%DD%-%YYYY%" set "fullstamp=%MM%-%DD%-%YYYY% @ %mytime%" :: Change the below for desired displayed text while running tracert and ping echo Running a tracert and ping to %Machine% on %fullstamp% echo ----------------------------------------------- echo Please wait ~1 minute for this to complete DO NOT CLOSE ...running tracert :: -4 is to allow readable locations, -w (time) is how long to wait for response on hop the %Machine% reads location from above :: %Machine%_%datestamp% is the name of the file it's saved to so it would be Machine.txt tracert -4 -w 30 %Machine% > %Machine%_%datestamp%.txt echo ----------------------------------------------- echo TRACERT is now complete %fullstamp% echo Running Ping to %Machine% :: -4 is to allow readable locations, -n (time) telling homw many packets to send to ip ping %Machine% -4 -n 30 >> %Machine%_%datestamp%.txt :: Dispalyed after tracert and Ping completed echo The Tracert and Ping test was completed on %fullstamp% echo ----------------------------------------------- echo A file named %Machine%_%datestamp%.txt was created and is located echo in the same location that you ran this bat file from. echo If you ran this from website it will be saved to desktop. echo ----------------------------------------------- echo Thank you for your Time. echo ----------------------------------------------- echo ----------------------------------------------- echo just close this window to exit echo ----------------------------------------------- GOTO End :Error Echo You did not enter an IP or Domain.... Good Bye! :End echo ----------------------------------------------- cmd