通过批处理来禁用或者启用USB接口的方法.我的USB管理软件就是基于这个开发的.
禁用:
@echo off COPY %WINDIR%infusbstor.inf %WINDIR%usbstor.inf COPY %WINDIR%infusbstor.PNF %WINDIR%usbstor.PNF DEL %WINDIR%infusbstor.inf DEL %WINDIR%infusbstor.PNF reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUSBSTOR" /v Start /t reg_dword /d 4 /f echo on
启用:
@echo off COPY %WINDIR%usbstor.inf %WINDIR%infusbstor.inf COPY %WINDIR%usbstor.PNF %WINDIR%infusbstor.PNF reg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUSBSTOR" /v Start /t reg_dword /d 3 /f echo on