|
|
|
How to eject / disconnect a USB device (Safely Remove Hardware) from command line on Windows
|
USBDeview is a freeware tool for Windows which allows you to easily eject/disconnect (Also known as "Safely Remove Hardware") any USB device from command-line and GUI.
In order to disconnect your USB device, you have to run USBDeview, and find the USB device that you want to eject/disconnect:
Let's say that you want to eject the 'SanDisk Cruzer' USB device in the above screenshot, so the command to eject this USB device is:
USBDeview.exe /stop "USB\VID_0781&PID_5567\4C530001140304113343"
In the above example, I used the string of 'Instance ID' column. It's also possible to use the string of the 'Description' column.
You can use the full string, or only part of the string.
In the above screenshot, the decsription string of the device is 'SanDisk Cruzer Blade USB Device', but it's possible to use only part of this string to
eject the device, for example:
USBDeview.exe /stop "SanDisk Cruzer"
USBDeview also provides additional commands to disconnect USB devices. For example, you can disconnect a device according to its VendorID and ProductID:
USBDeview.exe /stop_by_pid "0781;5567"
There is also a command to disconnect according to the drive letter of mass storage device, for example:
USBDeview.exe /stop_by_drive d:
It's also possible to disconnect a USB device according to its class/subclass/protocol (These values are displayed in the following columns: 'USB Class', 'USB Subclass', 'USB Protocol'), for example - in order to disconnect all USB Mass Storage Devices:
USBDeview.exe /stop_by_class 08;06;50
You can see all available commands to eject a USB device in USBDeview Web page.
|
|
|