Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Unfortunately this does not work with mobile devices since they don't mount to be a drive. kakyo Sep 3, 2019 at 5:21

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' }"

You could use wmic command:

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

Drivetype 2 indicates that its a removable disk.

you have to remove spaces around '=' to get result -> wmic logicaldisk where drivetype=2 get * – N.S Feb 20, 2019 at 8:21 You should have in mind, that external Hard Drives have drivetype=3 (local disk) like internal hard drives. Only USB sticks have drivetype=2. – Ruik Mar 10, 2021 at 13:22 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/… – styks Feb 11, 2018 at 22:51 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? – Mahmood Kiaheyrati Oct 16, 2021 at 21:58

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.