利润率最高的上市公司:命令行模式下禁用或启用网卡

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/25 06:12:48
[转帖]Win32环境下命令行模式下禁用或启用网卡

运行如下命令禁用名称为"Local Area Connection"的网卡:
netsh interface set interface name="本地连接" admin=DISABLED
把结尾的"DISABLED"改为"ENABLED"为开启指定的网卡.
但是出现提示参数不对。为什么?下面的命令都可以
netsh interface set interface name="本地连接" newname=123
你这些东西是从网上抄来的,我早看过了.问题是XP上根本无法执行.应该是微软关闭了这个功能.2003上可以.

先看show interface 的结果, 然后选择你要disable的interface. 注意带空格的名称需要用引号.

netsh interface show interface

Admin State State Type Interface Name
Enabled Unreachable Dedicated Local Area Connection 2
Enabled Unreachable Dedicated Local Area Connection
Enabled Unreachable Internal Internal
Enabled Unreachable Loopback Loopback

netsh interface set interface name="Local Area Connection" admin=DISABLED

中文win2000下出现错误:
一个或多个基本参数没有指定
此命令提供的语法不正确。请查看帮助以获取正确的语法信息。

用法 set interface [name = ] IfName
[ [admin = ] ENABLED|DISABLED
[connect = ] CONNECTED|DISCONNECTED
[newname = ] NewName ]

设置接口参数。

IfName - 接口名称
admin - 接口是否被启用 (仅用于非 LAN)。
connect - 是否连接接口 (仅用于非 LAN)。
newname - 接口的新名称 (仅用于非 LAN)。

注意:
- 除名称外,还必须至少指定一个选项。
- 如果 connect = CONNECTED 被指定,那么接口被自动
启用,甚至在 admin = DISABLED 选项被指定时也是如
此。

ipconfig /release "某连接" 禁用
ipconfig /renew "某某连接" 启用
XP上试过,可以用