@echo off
:::::::::::::::::::: Find Local Mac
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist LocalMac.txt del LocalMac.txt
find "Physical Address" ipconfig.txt >LocalMac.txt
for /f "skip=2 tokens=12" %%M in (LocalMac.txt) do set LocalMac=%%M
:::::::::::::::::::: Find Local IP
if exist LocalIP.txt del LocalIP.txt
find "IP Address" ipconfig.txt >LocalIP.txt
for /f "skip=2 tokens=15" %%I in (LocalIP.txt) do set LocalIP=%%I
:::::::::::::::::::: Find Gateway IP
if exist GatewayIP.txt del GatewayIP.txt
find "Default Gateway" ipconfig.txt >GatewayIP.txt
for /f "skip=2 tokens=13" %%G in (GatewayIP.txt) do set GatewayIP=%%G
:::::::::::::::::::: Find Gateway Mac
if exist GatewayMac.txt del GatewayMac.txt
arp -d
ping -n 1 %GatewayIP% 
arp -a %GatewayIP% >GatewayMac.txt
for /f "skip=3 tokens=2" %%H in (GatewayMac.txt) do set GatewayMac=%%H
:::::::::::::::::::: Bind Gateway IP & Mac
arp -s %LocalIP% %LocalMac%
arp -s %GatewayIP% %GatewayMac%
exit

arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()