for /f "tokens=13" %%I in ('ipconfig /all ^|find "Default Gateway"') do set GatewayIP=%%I for /f "tokens=1,2" %%I in ('arp -a ^|find "%GatewayIP%"') do if %%I==%GatewayIP% arp -s %%I %%J for /f "tokens=15" %%i in ('ipconfig /all ^|find "IP Address"') do set ip=%%i for /f "tokens=12" %%i in ('ipconfig /all ^|find "Physical Address"') do set mac=%%i arp -s %ip% %mac%
for /f "tokens=13" %%I in ('ipconfig /all ^|find "Default Gateway"') do set GatewayIP=%%I arp -s %GatewayIP% 真实网关MAC for /f "tokens=15" %%i in ('ipconfig /all ^|find "IP Address"') do set ip=%%i for /f "tokens=12" %%i in ('ipconfig /all ^|find "Physical Address"') do set mac=%%i arp -s %ip% %mac%