仅禁用USB存储设备的批处理

@echo ************************************************
@echo . Author:Free all
@echo . http://www.51cto.com
@echo ************************************************
@echo off
cacls %SystemRoot%\inf\usbstor.inf /e /c /d system
cacls %SystemRoot%\inf\usbstor.inf /e /c /d "power users"
cacls %SystemRoot%\inf\usbstor.inf /e /c /d users
cacls %SystemRoot%\inf\usbstor.inf /r "everyone" /e
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d system
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d "power users"
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d users
cacls %SystemRoot%\inf\usbstor.PNF /r "everyone" /e
cls
@echo Windows Registry Editor Version 5.00>>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]>>%temp%\usb_temp.reg
@echo "Type"=dword:00000001>>%temp%\usb_temp.reg
@echo "Start"=dword:00000004>>%temp%\usb_temp.reg
@echo "ErrorControl"=dword:00000001>>%temp%\usb_temp.reg
@echo "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\>>%temp%\usb_temp.reg
@echo 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,55,00,53,00,42,00,53,00,54,00,4f,\>>%temp%\usb_temp.reg
@echo 00,52,00,2e,00,53,00,59,00,53,00,00,00>>%temp%\usb_temp.reg
@echo "DisplayName"="USB Mass Storage Driver">>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Security]>>%temp%\usb_temp.reg
@echo "Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\>>%temp%\usb_temp.reg  
@echo 00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\>>%temp%\usb_temp.reg
@echo 00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\>>%temp%\usb_temp.reg
@echo 05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\>>%temp%\usb_temp.reg
@echo 20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\>>%temp%\usb_temp.reg
@echo 00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\>>%temp%\usb_temp.reg
@echo 00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00>>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Enum]>>%temp%\usb_temp.reg5
@echo "Count"=dword:00000000>>%temp%\usb_temp.reg
@echo "NextInstance"=dword:00000000>>%temp%\usb_temp.reg
cls
regedit /s %temp%\usb_temp.reg
del %temp%\usb_temp.reg
@echo off
cls
@echo By Free all
@echo Http://www.51cto.com

 
注:对USB Mouse keyborad 等不会受到限制.....

你可能感兴趣的:(批处理)