China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-29 11:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Share] Disabling & Enabling USB Devices Is So Simple (Classifiable by Standards) View 6,844 Replies 35
Floor 31 Posted 2009-06-16 04:12 ·  中国 广东 广州 电信
新手上路
Credits 2
Posts 1
Joined 2009-06-13 02:18
17-year member
UID 147285
Gender Male
Status Offline
@echo off
set Reg_Path=HKLM\SYSTEM\CurrentControlSet\Enum\USB
for /f "delims=*" %%a in ('reg query "%Reg_Path%"^|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 To query USB\Class_XX subcategories, change the "delims=&" of the 5th for to "delims="
pause
Floor 32 Posted 2010-04-01 13:13 ·  中国 广东 广州 天河区 电信
初级用户
Credits 33
Posts 12
Joined 2006-06-06 13:42
20-year member
UID 56635
Status Offline
Thanks, it's good.
Floor 33 Posted 2010-04-02 10:40 ·  中国 广东 惠州 惠城区 电信
初级用户
★★
Credits 126
Posts 53
Joined 2007-02-04 19:21
19-year member
UID 78631
Gender Male
From -
Status Offline
@echo off
start mode con cols=1 lines=1
%1 %2
start /min /i "" "%~nx0" goto min&&goto :eof

:min
for /f %%i in ('devcon findall usb* ^|find /i "usb mass storage"') do devcon remove "@%%i"
exit
Floor 34 Posted 2010-04-08 11:50 ·  中国 浙江 嘉兴 电信
新手上路
Credits 5
Posts 4
Joined 2005-12-09 08:51
20-year member
UID 46764
Status Offline
Great, learned something, thanks.
Floor 35 Posted 2010-04-12 12:00 ·  中国 上海 浦东新区 电信
新手上路
Credits 3
Posts 3
Joined 2010-03-25 17:29
16-year member
UID 163030
Gender Male
Status Offline
Floor 36 Posted 2010-06-03 18:09 ·  中国 北京 联通
新手上路
Credits 1
Posts 1
Joined 2009-06-05 03:33
17-year member
UID 146733
Gender Male
Status Offline
So simple to disable USB devices originally, learned it
Forum Jump: