Sunday, July 11, 2021

Ping a range of IPs from a windows command prompt

This command will ping every ip from 192.168.2.1 to 192.168.2.255

for /L %i in (1,1,255) do ping -w 20 -n 1 192.168.2.%i | find /i "Reply"

The above command would return would be similar to this, showing a reply for IPs that return a ping.

any matching IP will show a response similar to this:

                            Reply from 192.168.2.8: bytes=32 time<1ms TTL=64

Here are some adjustments

Ping a range 1-100:

for /L %i in (1,1,100) do ping -w 20 -n 1 192.168.2.%i | find /i "Reply" 

Ping a range 100-200:

for /L %i in (100,1,200) do ping -w 20 -n 1 192.168.2.%i | find /i "Reply"

Range 1 to 200, but ping every second value

for /L %i in (1,2,200) do ping -w 20 -n 1 192.168.2.%i | find /i "Reply"

No comments:

Post a Comment

Feel free to leave a comment! If you have any information that you think should be included, please do so here and I'll get it added in.