用google就可以搜索到本论坛的某个帖子上,算了,给出链接吧:
http://www.cn-dos.net/forum/viewthread.php?tid=21951
但这个帖子中讲的是如何禁用网卡并再次启用的方法,与楼主的要求并不十分贴合。
用netsh命令可以实现楼主的要求。
@echo off
for /f "usebackq tokens=3 delims=: " %%i in (`ipconfig ^| find /i "Ethernet adapter"`) do set conn="%%i"
if == set conn="本地连接"
::echo 本地连接的名称为:%conn%
netsh interface set interface %conn% disabled
netsh interface set interface %conn% enabled
Last edited by Climbing on 2007-12-28 at 04:09 PM ]