可能是arp -d命令的问题
试试我这个
@echo off
FOR /f "tokens=14 delims=: " %%i in ('ipconfig /all ^|find /i "IP Address"') do Set ip=%%i
FOR /f "tokens=11 delims=: " %%i in ('ipconfig /all ^|find /i "Physical Address"') do Set mac=%%i
echo arp -s %IP% %MAC%>c:\ipmac.bat
FOR /f "tokens=12 delims=: " %%i in ('ipconfig /all ^|find /i "Default Gateway"') do Set GateIP=%%i
FOR /f "skip=3 tokens=2" %%b in ('arp -a %GateIP%') do (
Set GateMAC=%%b
goto gate
)
:gate
echo arp -s %Gateip% %GateMAC%>>c:\ipmac.bat