我正在尝试编写一个批处理文件,它可以返回 IP,但我只知道 MAC 地址
arp -a
对我来说不起作用,因为我以前从未 ping过该 IP。我想在网络中搜索它,只需知道 MAC 地址即可。
Information: The IP is static.
最佳答案
假设您的子网是 192.168.1.xxx
@echo off
REM clear arp cache (optional):
arp -d
REM ask everybody on the subnet for a response:
for /l %%a in (1,1,255) do start /b ping -n 2 -w 500 192.168.1.%%a >nul
REM wait for the processes to finish:
timeout 2 >nul
REM show the responses (with IP and MAC):
arp -a
找到 IP 后,您可以尝试使用以下方法解析计算机名称:
ping -a -n 1 192.168.1.xxx
编辑找到了一种加快速度的方法。
关于windows - 只需知道MAC地址即可获取IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38076523/