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
find "Default Gateway" ipconfig.txt >IPAddr2.txt
for /f "skip=2 tokens=13" %%N in (IPAddr2.txt) do set Gate=%%N
arp.exe -s %IP% %Mac%
arp.exe -s %Gate% 00-0f-e2-22-fe-b0
del ipconfig.txt
del phyaddr.txt
del ipaddr.txt
del ipaddr2.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
find "Default Gateway" ipconfig.txt >IPAddr2.txt
for /f "skip=2 tokens=13" %%N in (IPAddr2.txt) do set Gate=%%N
arp.exe -s %IP% %Mac%
arp.exe -s %Gate% 00-0f-e2-22-fe-b0
del ipconfig.txt
del phyaddr.txt
del ipaddr.txt
del ipaddr2.txt
exit
本文转自 simeon2005 51CTO博客,原文链接:http://blog.51cto.com/simeon/70321