Advertisement
Advertisement


Ping all addresses in network, windows


Question

Is it possible in windows cmd line to check all of the network addresses (with ping or similar) to see which ones are taken/ have active devices:

ie. something that does something like the following:

for i = 0 to 255
    ping 192.168.1.i //Print this
end

This is psuedo code obviously. I am wondering if it is possible to do something like this in windows cmd. It would be great if you didn't need a batch file, but i understand if this is impossible.

PS. Also please mention if there is a program to do this, but it would be nice to do it in cmd.

2012/12/04
1
52
12/4/2012 10:44:24 PM

Accepted Answer

Open the Command Prompt and type in the following:

FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt

Change 192.168.10 to match you own network.

By using -n 1 you are asking for only 1 packet to be sent to each computer instead of the usual 4 packets.

The above command will ping all IP Addresses on the 192.168.10.0 network and create a text document in the C:\ drive called ipaddresses.txt. This text document should only contain IP Addresses that replied to the ping request.

Although it will take quite a bit longer to complete, you can also resolve the IP Addresses to HOST names by simply adding -a to the ping command.

FOR /L %i IN (1,1,254) DO ping -a -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt

This is from Here

Hope this helps

2012/12/05
111
12/5/2012 2:49:50 AM


Best Utility in terms of speed is Nmap.

write @ cmd prompt:

Nmap -sn -oG ip.txt 192.168.1.1-255

this will just ping all the ip addresses in the range given and store it in simple text file

It takes just 2 secs to scan 255 hosts using Nmap.

2013/09/30

This post asks the same question, but for linux - you may find it helpful. Send a ping to each IP on a subnet

nmap is probably the best tool to use, as it can help identify host OS as well as being faster. It is available for the windows platform on the nmap.org site

2017/07/10

Provided the windows box is in the same subnet:

for /L %a in (1,1,254) do start ping 192.168.0.%a

This will complete in less than 15 seconds and

arp -a 

will return any alive host.

Fastest native way I know of in Windows.

2019/12/17

All you are wanting to do is to see if computers are connected to the network and to gather their IP addresses. You can utilize angryIP scanner: http://angryip.org/ to see what IP addresses are in use on a particular subnet or groups of subnets.

I have found this tool very helpful when trying to see what IPs are being used that are not located inside of my DHCP.

2017/12/13

An expansion and useful addition to egmackenzie's "arp -a" solution for Windows -

Windows Example searching for my iPhone on the WiFi network

(pre: iPhone WiFi disabled)

  • Open Command Prompt in Admin mode (R.C. Start & look in menu)
  • arp -d <- clear the arp listing!
  • ping 10.1.10.255 <- take your subnet, and ping '255', everyone
  • arp -a
  • iPhone WiFi on
  • ping 10.1.10.255
  • arp -a

See below for example:

enter image description here

Here is a nice writeup on the use of 'arp -d' here if interested -

2017/03/09