@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
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
