I know how to find a computer's IP address, but how do I make a variable set as the IP address of that computer, or save it to a text file, all in a batch?
Also, I found a line of code on the internet that would ping every possible IP address of a given server and list the IPs successfully pinged, but it didn't work; they all timed out. What would be wrong with it? Is there a better way to do it? So here's the code for that:
FOR /L %i IN (1,1,254) DO ping --a --n 1 10.0.1.%i | FIND /I "Reply">> c:\lanipaddresses.txt
Thanks!
For Linux machines, how about good old Nmap:
nmap -sP 192.168.2.*
You need to change the 10.0.1.%
to what your IP set would be.
ie. this script won't work a 192.168.1.%
network as is. For this set use:
updated
FOR /L %i IN (1,1,254) DO ping -n 1 10.0.1.%i | FIND /i "Reply">> c:\lanipaddresses.txt
For Windows machines, how about good old arp:arp -a
Obviously the question was FOR /L %Windows IN (3,1, 10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With