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

批处理文件实现修改电脑注册表进而实现电脑USB接口屏蔽或开启

方法/步骤

  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

    END
版权声明:admin 发表于 2022-12-13 16:03:46。
转载请注明:用批处理bat文件实现电脑USB接口禁用开启 | 阿宇工具库

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...