• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to detect a usb device from the command line


Ulysses

New Member
Posts
2
#1
In linux I would type "lsusb" and it would list all usb devices plugged in. From this a "grep" would detect if a known usb device is connected.

How do you do the same from the command line in windows, eg in a batch file?
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    Laptop

KYHI

Well-Known Member
Pro User
Posts
2,700
#2
Code:
wmic diskdrive where "MediaType='Removable Media'" get Index,Model,Size
or to pipe to a txt file on desktop

Code:
wmic diskdrive where "MediaType='Removable Media'" get Index,Model,Size >"%userprofile%\desktop\RemovableMedia.txt"
 

My Computer

System One

  • OS
    Windows 3.1 > Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Dell XPS 8700
    CPU
    I7
    Memory
    24 GB

Ulysses

New Member
Posts
2
#3
Thanks but the device I want to test for is not a usb drive but a usb adapter (ethernet to usb). How do you test for this?
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    Laptop