Blog Posts

Batch File for Ping

Attached to this post is a simple batch file I created which prompts to you to enter the host you want to ping, timestamps it, sends the output to a text file, opens the text file, and copies the output to your clipboard — all in one sweep.

I created this because I use the ping command a ton and sometimes log the output. Below are the commands. Attached is the .bat. You can keep the destination as “C:\” or make it whatever it needs to be, you can change the # of echo requests (-n)  or add the buffer size (-l) as well.

@echo off
echo Enter IP address below: 
set /p input=""
echo Pinging %input%. Please wait...
echo **Started %date% %time%** > C:\PingOutput.txt
ping %input% -n 6 >> C:\PingOutput.txt
echo: >> C:\PingOutput.txt
echo **Completed %date% %time%** >> C:\PingOutput.txt
start C:\PingOutput.txt
clip < C:\PingOutput.txt
exit

Download PingOutput.bat

If the download doesn’t work just copy the block of commands above > paste it into notepad > Save As > File Name: PingOutput.bat > Save as type: All files.

Advertisements