再发老生长谈的客户机ARP绑定批处理

@echo off<br />arp -d<br />ping -n 1 www.baidu.com<br />if exist ipconfig.txt del ipconfig.txt<br />ipconfig /all >ipconfig.txt

@echo off
arp -d
ping -n 1 www.baidu.com
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set Mac=%%M
if exist IPAddr.txt del IPaddr.txt
find "IP Address" ipconfig.txt >IPAddr.txt
for /f "skip=2 tokens=15" %%I in (IPAddr.txt) do set IP=%%I
arp -s %IP% %Mac%
del ipaddr.txt
del ipconfig.txt
del phyaddr.txt
FOR /f "skip=17 tokens=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac
:GateMac
echo IP:%GateIP%
FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start
:Start
echo MAC:%GateMAC%
arp -s %GateIP% %GateMAC%
exit