查找计算机的IP,查找局域网内所有计算机的IP
我知道如何查找计算机的 IP 地址,但如何批量将变量设置为该计算机的 IP 地址,或将其保存到文本文件中?
另外,我在互联网上找到了一行代码,可以 ping 给定服务器的每个可能的 IP 地址,并列出成功 ping 到的 IP,但它不起作用;他们都超时了。这样做会有什么问题吗?有更好的方法吗?这是代码:
FOR /L %i IN (1,1,254) DO ping --a --n 1 10.0.1.%i | FIND /I "Reply">> c:\lanipaddresses.txt
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将
10.0.1.%
更改为您的 IP 集。IE。此脚本无法按原样在
192.168.1.%
网络上运行。对于此集使用:更新
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
对于 Windows 机器,好的旧 arp 怎么样:
arp -a
显然问题是
FOR /L %Windows IN (3,1, 10)
For Windows machines, how about good old arp:
arp -a
Obviously the question was
FOR /L %Windows IN (3,1, 10)
对于 Linux 机器,好的旧 Nmap 怎么样:
For Linux machines, how about good old Nmap: