Find the IP address of the computer, find the IP addresses of all computers on the local network

I know how to find the IP address of a computer, but how to make the variable set as the IP address of this computer or save it in a text file, is everything in the package?

In addition, I found a line of code on the Internet that would ping every possible IP address of this server and list the IP addresses successfully ping, but this did not work; they all timed. What would be wrong? Is there a better way to do this? So here is the code for this:

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

Thank!

+5
source share
3 answers

You need to change 10.0.1.%to what your IP set will be.

. script 192.168.1.%, . :

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

Linux-, Nmap:

nmap -sP 192.168.2.* 
+9

For windows machines, how about a good old arp:
arp -a

Obviously the question was FOR /L %Windows IN (3,1, 10)

+1
source

All Articles