关闭和开启USB功能-创新互联-古蔺大橙子建站
RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
关闭和开启USB功能-创新互联

关闭和开启USB功能

成都创新互联公司成立与2013年,先为鸡东等服务建站,鸡东等地企业,进行企业商务咨询服务。为鸡东企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

一,开启USB功能。


::USB-Enable
@echo off
:step1
if exist C:\Windows\INF\usbstor.inf (cls&goto :step2) else (cls&goto :step3)

:step2
if exist C:\Windows\INF\usbstor.inf.bak (cls&goto :exit) else (cls&goto :copy2)

:step3
if exist C:\Windows\INF\usbstor.inf.bak (cls&goto :copy1) else (cls&goto :exit)
exit

:copy1
copy C:\Windows\INF\usbstor.inf.bak C:\Windows\INF\usbstor.inf 
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 3 /f

:copy2
copy C:\Windows\INF\usbstor.inf C:\Windows\INF\usbstor.inf.bak

:exit
exit


二、关闭USB功能。


::USB-Disable
@echo off
:step1
if exist C:\Windows\INF\usbstor.inf.bak (cls&goto :step2) else (cls&goto :step3)
:step2
if exist C:\Windows\INF\usbstor.inf (cls&goto :del) else (cls&goto :reg)
:step3
if exist C:\Windows\INF\usbstor.inf  (cls&goto :copy) else (cls&goto :exit)
exit 

:reg
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

:copy
copy C:\Windows\INF\usbstor.inf C:\Windows\INF\usbstor.inf.bak
del /s C:\Windows\INF\usbstor.inf
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

:del
del /s C:\Windows\INF\usbstor.inf
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

:exit
Exit

三,总结一下

1,脚本在window xp 7和win10上都有测试执行成功,如果需要readonly需要将注册表值改为1,有兴趣的可以测试一下。


2,脚本在GPO下发后生效能成功执行,有个别问题网络异常执行不成功。

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章标题:关闭和开启USB功能-创新互联
本文网址:http://scgulin.cn/article/hgpho.html