标题: 那个批处理能真正绑定本机IP MAC 网关地址及路由地址?
[打印本页]
作者: INeverAsk
时间: 2007-11-5 09:55
标题: 那个批处理能真正绑定本机IP MAC 网关地址及路由地址?
搜遍本论坛发现没有一个批处理能真正意义上能作出同时能绑定本机IP MAC 网关地址及路由地址
几乎都只能作为绑定本地IP与MAC地址的,因为这些批处理都是进行对ARP表进行查询然后作出绑定,但刚开机未进行其他动作时,这些批处理行同虚设。这个批处理中至少也得先作PING的动作吧
希望那位朋友写一个
作者: lxmxn
时间: 2007-11-5 15:12
可以把批处理加入自动启动文件夹里面或者注册表,另外论坛有很多的类似讨论,多搜索一下,自己改进一下不就可以了?
作者: mayu2004
时间: 2008-1-7 08:45
@echo off
title Mac地址绑定程序
::QQ 236189165
mode con cols=25 lines=6
echo.正在解析函数请稍等...
call :select "ip address" "ip"
call :select "Physical Address" "mac"
call :select "Default Gateway" "gateway"
goto begin
:select
for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!" == "" set "%~2=%%i"
goto :eof
:begin
cls
echo.正在自动绑定请稍等......
arp -d >nul 2>nul
arp -s %ip% %mac% >nul
ping %gateway% >nul
arp.exe -a >arp.txt
find "%gateway%" arp.txt>mac.txt
for /f "skip=2 tokens=2" %%Z in (mac.txt) do set Mac=%%Z
arp -s %gateway% %Mac% >nul
del arp.txt&del mac.txt
cls
echo.****绑定完毕 2秒退出****
ping 127.255.255.255 -n 1 -w 2000>nul
我写的 没有 优化