自动绑定MAC和IP的批处理命令
[05-13 14:30:18] 来源:http://www.qiuzhi518.com 路由技术 阅读:93974次
概要:ns=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac:GateMacecho IP:%GateIP%FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start:Startecho MAC:%GateMAC%arp -s %GateIP% %GateMAC%echo 操作完成!!!exit看完的人要顶之哦!批出理二 半自动@echo OFFif %~n0==arp exitif %~n0==Arp exitif %~n0==ARP exitecho 正在获取本机信息.....:IParp -dFOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC:MACecho IP:%IP%
自动绑定MAC和IP的批处理命令,http://www.qiuzhi518.com自动绑定MAC和IP的批处理命令
批出理一 完全自动获取!
@echo OFF
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit
echo 正在获取本机信息.....
arp -d
:IP
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
echo 正在获取网关信息.....
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%
echo 操作完成!!!
exit
看完的人要顶之哦!
批出理二 半自动
@echo OFF
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit
echo 正在获取本机信息.....
:IP
arp -d
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
Set GateIP=路由IP
: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%
echo 操作完成!!!
exit
批出理三
@echo OFF
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit
echo 正在获取本机信息.....
:IP
arp -d
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
Set GateIP= 路由IP
Set GateMAC=路由Mac
arp -s %GateIP% %GateMAC%
echo 操作完成!!!