CMD command to check connected USB devices
Asked Answered
B

6

30

I would like to obtain by a command prompt a list of all USB devices connected to my computer (O.S. Windows 10). I've googled to find such a command, but all results seems useless to me or worse workless. Does anybody know how can I do that?

Thank you

Barger answered 8/6, 2017 at 10:33 Comment(0)
J
-2

you can download USBview and get all the information you need. Along with the list of devices, it will also show you the configuration of each device.

Jaynejaynell answered 9/6, 2017 at 5:26 Comment(4)
USBview is part of the debug tools for windows. You can see how to get this program here. learn.microsoft.com/en-us/windows-hardware/drivers/debugger/…Terrence
Why is this accepted and -6 without any good comments?Gerena
The accepted answer is not a command. Thats why I down voted.Pericline
if the accepted answer is not something that was wanted in the first place, then it means that the question was somewhat asked incorrectly. So i think it's better to down vote the question either. because it wanted a command but accepted a software recommendation as the answer! so the question was not asked correctly at the first place, right?Florin
C
34

You can use the wmic command:

wmic path CIM_LogicalDevice where "Description like 'USB%'" get /value
Chaldron answered 6/10, 2017 at 9:42 Comment(4)
Unfortunately this does not work with mobile devices since they don't mount to be a drive.Platy
WMIC is deprecatedChest
what is the replacement for WMIC, Sir @KVM?Dredi
@Dredi #57122375Chest
L
14

With powershell, you can use the command :

Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' }

a simple short to use powershell from cmd and get result :

powershell "Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' }"
Louis answered 15/12, 2021 at 18:48 Comment(1)
This worked great on my Windows 10! Thanks!Habiliment
U
4

You could use wmic command:

wmic logicaldisk where drivetype=2 get <DeviceID, VolumeName, Description, ...>

Drivetype 2 indicates that its a removable disk.

Under answered 14/2, 2019 at 6:52 Comment(2)
you have to remove spaces around '=' to get result -> wmic logicaldisk where drivetype=2 get *Claman
You should have in mind, that external Hard Drives have drivetype=3 (local disk) like internal hard drives. Only USB sticks have drivetype=2.Wheelsman
C
2
pnputil /enum-devices /connected /class USB

This requires Windows 10 1903 or higher. List of possible flags

Cormophyte answered 17/2, 2023 at 16:19 Comment(0)
G
0
@echo off
powershell -noLogo -NoProfile "Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' -and $_.FriendlyName -match 'G27'}" | find /i "G27" >nul

if %errorlevel%==1 (
  echo.Plug G27 steering wheel into USB port
) else (
  echo.ok
)
pause
Garlandgarlanda answered 1/11, 2023 at 14:59 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Hocker
J
-2

you can download USBview and get all the information you need. Along with the list of devices, it will also show you the configuration of each device.

Jaynejaynell answered 9/6, 2017 at 5:26 Comment(4)
USBview is part of the debug tools for windows. You can see how to get this program here. learn.microsoft.com/en-us/windows-hardware/drivers/debugger/…Terrence
Why is this accepted and -6 without any good comments?Gerena
The accepted answer is not a command. Thats why I down voted.Pericline
if the accepted answer is not something that was wanted in the first place, then it means that the question was somewhat asked incorrectly. So i think it's better to down vote the question either. because it wanted a command but accepted a software recommendation as the answer! so the question was not asked correctly at the first place, right?Florin

© 2022 - 2025 — McMap. All rights reserved.