Is it possible to use a batch file to ping multiple IP addresses, each in its own window?

Can I create a batch file to ping multiple IP addresses, every IP address in new window. I don't want to open multiple windows and manually writing every single ping ping command.

ex: ping 192.168.1.1 -t in one window and ping 192.168.2.1 -t to another window.

5 Answers

It's pretty easy, save the following to a [.bat] file:

@echo off
rem start two new ping command windows from a batch file:
START cmd /k ping 8.8.8.8 /t
START cmd /k ping 127.0.0.1 /t

This will open two new command windows, each continuously pinging two different IP Addresses [8.8.8.8 && 127.0.0.1]

0

You can ping multiple IP addresses this way:

for /L %z in (1,1,254) do @ping 192.168.%z -w 10 -n 1 | find "Reply"

Change the IP address after the ping command to reflect your networks IP range. The above command will ping each address between 192.168.1.1 and 192.168.1.254 and return the IP address for reply to the ping.

The -w 10 makes it only wait 10 ms for a reply before moving on. If your network is slow you will have to up this value or take it out altogether.

1

You can use the start command.

For example, to ping the 2 addresses you gave:

start ping 192.168.1.1 -t
start ping 192.168.2.1 -t
0

Quickest way to ping multiple IP addresses Angry IP Scanner

This program will ping your specified IP addresses, domain in a window, also display hostname and ports open.

Quick and easy to use rather than separate cmd windows all over the place.

0

You can install a utility fping which works in a round-robin way to ping each ip address. You can install it by:

sudo apt install fping

Then you can ping multiple addresses using one-liner:

fping <ip1> <ip2> <ip3>

It can also be used to run multiple ip addresses written down in a file. This can also fulfill your requirement of not writing the ips every time you need to ping.
Just to comply with the question to use a bash script, you can write it in a bash script too.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like