从命令行启用/禁用网络连接

问题描述 投票:22回答:4

我知道谷歌有很多结果:results,但我没有在我的Windows XP机器上制作它。我想从命令行禁用LAN连接。

>netsh interface set interface "Local Area Connection" DISABLED
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.

>netsh interface set interface name="Local Area Connection" admin="disabled"
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.

>netsh interface set interface name="Local Area Connection" admin=DISABLED
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.
networking cmd windows-xp
4个回答
20
投票

对于前两个命令,您需要提升/管理员权限:

禁用LAN网络连接

C:\> netsh interface set interface name="Local Area Connection" admin=disabled

启用LAN网络连接

C:\> netsh interface set interface name="Local Area Connection" admin=enabled

假设:您的界面被命名为“本地区域连接”,否则替换正确的名称。使用netsh interface show interface查找名称。

列出Wifi个人资料

C:\> netsh wlan show profiles

连接到Wifi个人资料

C:\> netsh wlan connect name="ProfileName"

5
投票

您必须使用提升/管理员权限运行它。

(在Windows 7上,我得到了令人困惑的错误消息

An interface with this name is not registered with the router.

)

(我编辑@yarish kumar的答案来反映这一点。)


2
投票

C:\ WINDOWS \ system32> netsh界面显示界面

管理状态状态类型接口名称

启用连接专用以太网2启用断开专用以太网连接专用Wi-Fi

C:\ WINDOWS \ system32> netsh interface set interface name =“Ethernet”admin =启用或禁用

w10输出此..


1
投票

好吧,看起来你需要从表中删除配置文件。 I.E.

netsh LAN>删除“LAN连接的配置文件”

在此之前你应该保存局域网的配置信息,以防你想要添加它,它将保存为XML文件,然后将其添加回来做

netsh LAN> ADD file-name =“profile1.XML”interface =“Local Area Connection”

有关netsh命令的更多详细信息,请查看http://www.computerhope.com/netsh.htm

希望这可以帮助

© www.soinside.com 2019 - 2024. All rights reserved.