• 用命令行禁用网卡


    1、首先打开电脑桌面按下键盘的win+R组合快捷键。
    2、然后在弹出的页面中输入 cmd 回车。
    3、然后即可进入命令行界面。
    4、然后在命令行中输入 netsh interface set interface "本地连接" disabled,回车,这样就可以禁用网卡了。
    5、若是想要启用的话,则输入 netsh interface set interface "无线网络连接" enabled,回车,这样就可以启用网络了。

    出处:https://zhidao.baidu.com/question/553977590.html

    查看可用的网卡命令:
    netsh lan show interfaces

    查看所有网卡命令,包括已禁用的:
    netsh interface show interface

    个人使用

    禁用或启用指定网卡,保存以下代码到bat文件中,文件格式使用ANSI编码格式

    @netsh lan show interfaces | find "以太网" > nul && (netsh interface set interface "以太网" disabled) || (netsh interface set interface "以太网" enabled)
    @(netsh lan show interfaces | find "以太网" > nul && (netsh interface set interface "以太网" disabled && echo 以太网已禁用) || (netsh interface set interface "以太网" enabled && echo 以太网已启用))&echo,&pause

     注意:

    1)以上命令主要是根据匹配网络名称,也不要有:以太网1,以太网2  这样的多个网卡名称。

    2)运行如下的命令,可能会提示dot3svc服务没有运行。

    netsh lan show interfaces

    有线自动配置服务(dot3svc)没有运行。

    解决方法:

    使用 sc qc dot3svc 查看实际服务名称,使用 net start dot3svc 启动 dot3svc 服务,如下图:

  • 相关阅读:
    十天冲刺之三
    设计模式-模板方法模式
    设计模式-观察者模式
    设计模式-迭代子模式
    设计模式-责任链模式
    设计模式-门面模式
    1395. Count Number of Teams
    747. Largest Number At Least Twice of Others
    1160. Find Words That Can Be Formed by Characters
    1539. Kth Missing Positive Number
  • 原文地址:https://www.cnblogs.com/mq0036/p/16582656.html
Copyright © 2020-2023  润新知