批处理禁止电脑使用U盘

原创 小姚  2020-03-15 12:16  阅读 3,806 次
我们如果不想让别人在自己电脑上使用电脑用U盘的话,可以通过一段批处理来禁止电脑使用U盘,下面分享批处理禁止电脑使用 U盘代码,将文件保存到记事本,另存为bat文件即可。
批处理禁止电脑使用U盘-小姚工作室
禁止使用U盘代码如下


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
pause

 

要想恢复的话运行如下代码
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
pause
本文地址:https://www.xiaoyaogzs.com/2875.html
关注我们:请关注一下我们的微信公众号:扫描二维码小姚工作室的公众号,公众号:小姚户外
版权声明:本文为原创文章,版权归 小姚 所有,欢迎分享本文,转载请保留出处!

发表评论 取消回复


表情

  1. 忘记了回忆
    忘记了回忆 @回复

    禁止使用U盘代码如下第一行代码是错的呀

  2. 王光卫博客
    王光卫博客 @回复

    这个掌握了出去装逼 [嘻嘻]

  3. 叶先生博客
    叶先生博客 @回复

    不用这么保护自己电脑吧 [阴险] [嘻嘻]