标签:usb
查询注册表是否禁用USB
@echo off
set "str=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR"
for /f "tokens=2*" %%a in (‘reg query "%str%" /v Start 2^>nul‘) do set "a=%%b"
if "%a%"=="0x4" ( echo USB已经禁用 >>USB已禁用) else ( echo USB未禁用>>USB未禁用)
禁用USB
@echo off
COPY %WINDIR%\inf\usbstor.inf %WINDIR%\usbstor.inf
COPY %WINDIR%\inf\usbstor.PNF %WINDIR%\usbstor.PNF
DEL %WINDIR%\inf\usbstor.inf
DEL %WINDIR%\inf\usbstor.PNF
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f
echo on
解除禁用
@echo off
COPY %WINDIR%\usbstor.inf %WINDIR%\inf\usbstor.inf
COPY %WINDIR%\usbstor.PNF %WINDIR%\inf\usbstor.PNF
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 3 /f
echo on
本文出自 “M4tr1x” 博客,请务必保留此出处http://matr1x.blog.51cto.com/6698309/1406927
标签:usb
原文地址:http://matr1x.blog.51cto.com/6698309/1406927