方案一
禁用USB
@echo off reg add "HKEY_LOCAL_ MACHINESYSTEMCurrentControlSet 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
将文件扩展名改为.bat
启用USB
@echo off reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v
Start /t reg_dword /d 3 /f
copy %Windir%\usbstor.inf %Windir%\inf\usbstor.inf /y >nul
copy %Windir%\usbstor.pnf %Windir%\inf\usbstor.pnf /y >nul
del %Windir%\usbstor.pnf /q/f >nul
del %Windir%\usbstor.inf /q/f >nul
@echo on
将文件扩展名改为.bat
方案二
进入注册表找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR,在右侧找到名为Start的键,双击它修改数值,3为启用、4为禁用,点击“确定”,重新启动计算机以使其更改生效。