---
title: "禁用/启用USB设备批处理"
author: "weixing"
date: "2012-07-08T14:56:48Z"
tags: []
categories: ["操作系统"]
slug: "usb"
draft: false
lastmod: "2012-07-08T14:56:48Z"
id: 1581818
url: "https://weixing.iteye.com/blog/1581818"
---

@echo off  
color 0a  
title 禁用/启用USB设备批处理  
echo.  
echo 测试环境XPsp2,如果设置后无效请重启机器  
echo 有问题请在zch123.cn留言  
echo.  
echo   1.禁用本机USB设备  
echo   2.恢复USB设备  
echo   3.退出  
echo.  
echo.  
SET /P aa=  请输入数字选择:  
echo.

if %aa%==1 goto :jz  
if %aa%==2 goto :qy  
if %aa%==3 exit  
exit  
::改为4禁用  
:jz  
reg add "HKLM\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR" /f /v "Start" /t REG\_DWORD /d 4  
rundll32 user32.dll,UpdatePerUserSystemParameters  
pause&exit

::改为3启用  
:qy  
reg add "HKLM\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR" /f /v "Start" /t REG\_DWORD /d 3  
rundll32 user32.dll,UpdatePerUserSystemParameters  
pause&exit