Ping Multiple Servers At Once With Batch File.
A common tool that network and system admins make use of is the “Ping” command which is a very simple and effective way to verify a machine is available on the network (firewall rules depending of course). So if you find yourself having to ping multiple machines at once, a very useful tool is the batch files, which will not only ping all the ip addresses but also give you ping results in text file format with just single click.
A batch file is a text file containing a series of commands intended to be executed by the command interpreter. When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line. Batch files are useful for running a sequence of executables automatically and are often used by system administrators to automate tedious processes.
Steps to create batch file::
1. Open up Notepad, type in the following commands (Example)
@Echo off
ping 192.168.1.1 > "%userprofile%\desktop\mypings.txt"
ping www.google.com >> "%userprofile%\desktop\mypings.txt"
ping 192.168.1.222 >> "%userprofile%\desktop\mypings.txt"
Remember:: > will run the command and create a file with ping results and >> will append or add next ip address ping results to the created file . So whenever you create batch file first command should always have single > and subsequent commands should have >>.
2.Now save this file with Filename ping.bat or whatever you want and Change Save as type to All files.
3.Run the ping.bat and you will get mypings.txt on your desktop.
If you want to place results text file someplace else, Say on C: drive just type c:\mypings.txt after >.
Example::
ping 192.168.1.1 > c:\mypings.txt
ping www.google.com >>c:\mypings.txt
Play around with netstat , ipconfig and other commands by creating batch files in the similar manner.., just change the ping command to the command of your choice in the above example.
happy learning :)
Tags: tips-tricks
Share your views...
2 Respones to "Ping Multiple Servers At Once With Batch File."
wow amazing
April 17, 2012 at 4:41 PM
Thx A lot......
October 2, 2012 at 12:40 AM
Post a Comment