用批处理文件实现电脑USB接口禁用开启

 时间:2026-02-15 17:52:20

1、禁用电脑USB接口方法:

新建一个文本文档,将下方内容复制到文本文档当中,然后保存文本文档,修改文本文档后缀为bat,r然后以管理员身份运行即可。

@echo off

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlStorageDevicePolicies" /v WriteProtect /t reg_dword /d 1 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

copy %windir%\inf\usbstor.inf %windir%\usbstor.inf /y >nul

copy %windir%\inf\usbstor.pnf %windir%\usbstor.pnf /y >nul

del %windir%\inf\usbstor.pnf /q/f >nul

del %windir%\inf\usbstor.inf /q/f >nul

@echo on

2、开启电脑USB接口方法:

新建一个文本文档,将下方内容复制到文本文档当中,然后保存文本文档,修改文本文档后缀为bat,r然后以管理员身份运行即可。

@echo off

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlStorageDevicePolicies" /v WriteProtect /t reg_dword /d 1 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 3 /f

copy %windir%\inf\usbstor.inf %windir%\usbstor.inf /y >nul

copy %windir%\inf\usbstor.pnf %windir%\usbstor.pnf /y >nul

del %windir%\inf\usbstor.pnf /q/f >nul

del %windir%\inf\usbstor.inf /q/f >nul

@echo on

  • UOS如何查询关机事件记录
  • IE11经常卡死无响应怎么办
  • 使用蒲公英智能组网,三步访问企业内网ERP系统
  • 如何通过注册表在任务栏上显示所有通知区域图标
  • windows Server 2016如何安装域控制器
  • 热门搜索
    5.19中国旅游日 78月份适合去哪旅游 山东长岛旅游 重庆旅游景点推荐 滨州旅游景点大全 山西旅游政务网 哈仙岛旅游攻略 重庆周边旅游景点介绍 纽约旅游攻略 韩国济州岛旅游攻略