My own applictions / tools

Follow me

Friday, July 18, 2014

How To Safely Eject Your USB Devices From the Desktop Context Menu

sshot-3
If you are one of those people who don’t safely remove their USB Devices just because you’re lazy, here’s a neat trick to do it from the context menu on your desktop. Even if you are not lazy and just forget, the icon will serve as a mental reminder. So let’s take a look.

The Safely Remove Hardware Dialog Method

This method will bring up the Safely Remove Hardware dialog box, from there you can choose which USB device you wish to eject. If you are looking to eject a specific USB drive take a look at the next section.
Press Win+R to bring up a run box and type regedit to open the registry.
sshot-25
When the registry is open, navigate to
HKEY_CLASSES_ROOT\DesktopBackground\Shell\
sshot-26
Right click on the shell key and create a new key called Safely Remove Hardware.
sshot-27
Once the new key is created, create a new string value, and call it Icon.
sshot-28
Double click on the icon string, in the Value data field type the following:
hotplug.dll,-100
sshot-29
Now right click on the Safely Remove Hardware key that you just created and create another key,  this time name the key command.
sshot-30
Once the new key has been created select it to open see the keys values.
sshot-1
This key will have a value called Default, double click on it to edit it, in the Value data field type
C:\\Windows\\System32\\control.exe hotplug.dll
sshot-2
That’s all there is to it if you want the Safely Remove Hardware dialog to appear.
sshot-3

Ejecting a Specific USB Drive

If you are looking to eject a drive with a specific name or drive letter then this method is better suited for you.
Extract the file somewhere (for illustration we’ll extract to the root of the C:\ drive), then right click on the file, select properties, and click the unblock button in the bottom right hand corner of the dialog.
sshot-5
Press Win+R to bring up a run box and type regedit to open the registry.
sshot-25
When the registry is open navigate to:
HKEY_CLASSES_ROOT\DesktopBackground\Shell\
sshot-26
Right click on the shell key and create a new key called Safely Remove USB.
sshot-27
Once the new key is created create a new string value, and call it Icon.
sshot-6
Double click on the icon string and in the Value data field type the following:
hotplug.dll,-100
sshot-29
Now right click on the Safely Remove USB key that you just created and create another key,  this time name the key command.
sshot-7
Once the new key has been created select it to open see the keys values.
sshot-8
This key will have a value called Default, double click on it to edit it. Here we have a few options, which ever method below suites you best should be typed into the Value data field.
Note: Remember to replace the name or drive letter in the following example to the name or drive letter of YOUR USB device.
We can either eject a USB with a certain name by typing.
C:\usb_disk_eject /removename “Memorex USB”
We could also eject a USB with a certain driver letter, in my case drive G.
C:\usb_disk_eject /removeletter G
sshot-9
That’s all there is to it.
sshot-10