Previously, everyone used devcon find to obtain the Hardware ID and filtered by for + find to disable or enable devices. However, their names are not fixed and have no pattern, so any code is not relatively universal. I have always been puzzled by the USB device standard. With the spirit of not giving up until the goal is achieved, I started to seek the rules of USB devices in Windows and the USB device standard. I opened the Registry Editor and started from the hardware-related key values to find their similarities and rules. Finally, I located HKLM\SYSTEM\CurrentControlSet\Enum\USB. By comparing one by one, I found that USB\Class_XX&SubClass_XX has a certain pattern. Then I invited Google experts for help. I saw some relevant standards on the Microsoft website with the keyword CompatibleIDs (Microsoft standards are not all standards). Hehe, it seems there is hope! ^_^ Continue with the keyword USB Class, haha OK!!www.usb.org It's standard enough! Well, enough small talk, start sharing my hard work; -)
Not translating the above due to poor English
Method to disable a device: devcon.exe disable USB\Class_XX
Method to enable a device: devcon.exe enable USB\Class_XX (where XX is the serial number in the green part above)
Example:
devcon.exe disable USB\Class_08
Disable USB flash drives, that is, delete USB flash drives, no matter how many USB flash drives you have, all delete together
devcon.exe disable USB\Class_06
Disable digital cameras, including the removable disks attached to digital cameras
devcon.exe disable USB\Class_03
Disable USB mice & keyboards
devcon.exe disable USB\Class_ff
Disable cameras, see you still show off; -)
Disabling & enabling USB devices is so simple
Related tools DevCon.exe Microsoft command-line utility can replace Device Manager
Related links:
http://www.microsoft.com/whdc/device/input/HID_HWID.mspx
http://www.usb.org/developers/defined_class/
http://www.cn-dos.net/forum/viewthread.php?tid=35139&fpage=1
Finally, I also hope everyone can collect other USB\Class_XX serial numbers (post replies)
Batch code to query the USB\Class_XX serial number of known or previously installed devices is as follows
Back up drivers using pure DevCon script, compatible with Driver Genius (2008-01-17)
[ Last edited by fastslz on 2009-9-13 at 05:19 ]
Classification standards of each device
00 Use class information in the Interface Descriptors
01 Audio
02 Communications and CDC Control
03 HID (Human Interface Device)
05 Physical
06 Image
07 Printer
08 Mass Storage
09 Hub
0A CDC-Data
0B Smart Card
0D Content Security
0E Video
0F Personal Healthcare
DC Diagnostic Device
E0 Wireless Controller
EF Miscellaneous
FE Application Specific
FF Vendor Specific
Not translating the above due to poor English
Method to disable a device: devcon.exe disable USB\Class_XX
Method to enable a device: devcon.exe enable USB\Class_XX (where XX is the serial number in the green part above)
Example:
devcon.exe disable USB\Class_08
Disable USB flash drives, that is, delete USB flash drives, no matter how many USB flash drives you have, all delete together
devcon.exe disable USB\Class_06
Disable digital cameras, including the removable disks attached to digital cameras
devcon.exe disable USB\Class_03
Disable USB mice & keyboards
devcon.exe disable USB\Class_ff
Disable cameras, see you still show off; -)
Disabling & enabling USB devices is so simple

Related tools DevCon.exe Microsoft command-line utility can replace Device Manager
Related links:
http://www.microsoft.com/whdc/device/input/HID_HWID.mspx
http://www.usb.org/developers/defined_class/
http://www.cn-dos.net/forum/viewthread.php?tid=35139&fpage=1
Finally, I also hope everyone can collect other USB\Class_XX serial numbers (post replies)
Batch code to query the USB\Class_XX serial number of known or previously installed devices is as follows
@echo off
for /f "delims=*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\USB"^|find /i "Vid_"'
do (
for /f "skip=4 delims=" %%b in ('reg query "%%a"'
do (
for /f "skip=4 tokens=3" %%i in ('reg query "%%b" /v CompatibleIDs'
do (
for /f "skip=4 tokens=1,2,*" %%a in ('reg query "%%b" /v DeviceDesc'
do (
for /f "delims=&" %%j in ("%%i"
do echo "%%j" Device name: %%c
))))
echo.&echo If you want to query USB\Class_XX classification below, change the "delims=&" of the 5th for to "delims=*"
pause
Back up drivers using pure DevCon script, compatible with Driver Genius (2008-01-17)
[ Last edited by fastslz on 2009-9-13 at 05:19 ]
Recent Ratings for This Post
( 4 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| zh159 | +10 | 2008-01-15 02:05 |
| huahua0919 | +4 | 2008-01-15 09:54 |
| zts59 | +4 | 2008-01-16 21:16 |
| everest79 | +15 | 2008-03-02 11:43 |



