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.  You can change the IP range from 192.168.2 to reflect whatever ip range you want to use

This will ping every IP and echo both the IPS that do respond and the ones that don't

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

This will ping every IP and echo back ONLY the IPS that do respond
for /L %i in (1,1,255) do @ping -w 20 -n 1 192.168.2.%i | find /i "Reply"

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


OR


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"

Output to a file.  Add " >> output.txt " to the end and it will put the output to a file called ouptput.txt

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

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.