@echo offmode con cols = 50 lines = 20 & color 1ftitle = 获取内网MAC地址 if exist GetMAC.txt del / q / s GetMAC.txt set start = 1 set top = 1 set end = 254 set War = 192.168 . 1 clsecho 获取局域网中的MAC地址 echo. & echo 作者:寒冰 echo ============================== echo 请按照下面的提示输入数据echo ============================== echo. & echo. set / p War = 输入网段如( 192.168 . 1 ):echo. set / p start = 输入IP地址的启始码:echo. set / p top = 输入IP地址的跳越码:echo. set / p end = 输入IP地址结束码:echo. & echo. & echo.echo 正在扫描网络上的主机!echo. & echo 请稍后..@ rem 主程序开始 for / l %%i in (%start%,%top%,% end %) do ping %War%.%%i - w 1 - n 1 > NUL & call :Arp %War%.%%iclsecho. & echo. & echo. & echo. & echo.echo IP与MAC查找完毕ping 127.0 . 0.1 - n 3 > nulstart GetMAC.txt exit :Arp for / f " usebackq skip=3 tokens=1,2 delims= " %%i in (`arp - a % 1 `) do if NOT %%j == 00 - 00 - 00 - 00 - 00 - 00 echo %%i %%j >> GetMAC.txt 转载于:https://www.cnblogs.com/madgoat/articles/983503.html