SEARCH

How-To Geek

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.

Head over to the developers website and grab a copy of the latest version of  USB Disk Ejector.

sshot-4

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

If you rather prefer to be a keyboard ninja you could always assign a hotkey or create a shortcut to do the same thing.

Taylor Gibb is a Microsoft MVP and all round geek, he loves everything from Windows 8 to Windows Server 2012 and even C# and PowerShell. You can also follow him on Google+

  • Published 11/15/11

Comments (26)

  1. kasalacto

    very neat. thanks!

  2. trunter

    Nice, but what’s so difficult about just finding the icon in the bottom right corner and clicking eject? I wonder…

  3. markiz

    That is a lot of work just to evade one little click.

    Also, is not doing safety hardware removal really that dangerous? I’ve been doing it for 10 years now an never had any problems.

  4. nova1

    nice, i like it!

  5. Filipe

    Why to bother? Removing safely is a waste of time! It is only necessary if your using your usb to chache system files! And who is doing that?

  6. Kevin

    Lot of work as default method is so easy anyway !!!!

  7. Bill

    Looks like a gov. job, take something simple and complicate it

  8. Dirk

    Sweet . I curse that such a comon task is burried away in a such a tiny spot ( on a notebook at least ).
    Right clicking is so mucj natural :-)
    Altough I would prefer you way it done on KDE Mint

  9. Grant

    OK, you are no longer allowed to complain about text file editing for configuration on Linux. Regedit is much worse.

  10. kevalin

    I discovered, after one of my external drives resolutely refused to “safely” eject, that both Windows 7 and (to my endless surprise) XP are set up by default to let you remove your drives safely–whether you use the “Safely Remove Hardware” feature or not.

    I often still do use the feature out of long habit, but the reality, as Felipe pointed out, is that unless you have manually disabled your computer’s ability to let you remove external usb storage safely for reasons of your own, or your storage media is REALLY old, using the “Safely Remove Hardware” option before removing jumpdrives, etc., is pretty pointless.

  11. Midnight

    A much simpler method, although not free, is to install Zentimo XStorage Manager, that will list All your USB devices and allow you, with once click, to Safely remove any and/or all devices!

    The program has a nice interface and best of all, it works!!

    The above method is way too long and somewhat complicated for newbies!

  12. Bob-El

    This didn’t work for me. After I select the drive and click “Stop” I get the following message “…device is not removable and cannot be ejected or unplugged”. I tried it with two different flash drives. Same thing. However, the system tray icon works just fine.

  13. MJ

    To those who say that removing media safely is useless: I have seen documents that got corrupted on my USB drive because of unsafe ejecting, when supposedly they were not being used. This happened to me more than once. Fortunately, one day I detected the corruption when SyncToy tried to sync an important .docx file that I did not modify, so I could revert the sync action.

  14. multiple partition

    Great., but hw abt ejecting a whole external hard disk with three partitions?

  15. Doh

    It’s useless because most USB drives are set to non cache mode. If you go to your drives properties and and set the write cache mode, then you will be in trouble not safely removing it. I guess non-cache mode is default because all you people don’t listen and don’t do what your supposed to do, this way people like me don’t have to constantly hear your whining about losing your data that you just copied to your USB drive, and pulled out without flushing and unmounting it. :)

  16. Doh

    You’re*

  17. Doh

    Oh, and whoever is having problems safely removing a drive, it’s because a file is in use on the drive. Usually windows indexing service or antivirus scanner. There are ways to find out what program is using the drive. Google is your friend.

  18. Abhi

    Great!! I love it ..

    Now I have answers to some of the questions

    1. Do you have to safely remove USB stick ?
    A: I have removed USB drives with and without going through this procedure. The time I got my USB stick damaged/ corrupted/ lost data was the time I ejected my USB stick with out safely removing it. I have no idea about the technicality behind it, but I do it these days.

    2. Can we go through the bottom menu bar instead of a right click ?
    A: The only reason I don’t care about safely ejecting the drive is that I hate going through the bottom menu bar. Also It is a lot of clicks to do…

    This trick works perfect for me. Thanks to the author. :)

  19. Jerry Kirby

    Nice trick, so much easier than using the system tray icon. Plus, I’ve been looking for the [run] command for ages :-)

  20. Syed Arif

    Bro……..
    Great I like thise ………… But ……… Thise will work in windows xp ?

  21. Kigongo

    Thanks.

  22. Eldragon

    Didn’t work for me either. Just like the poster Bob I get the following message “…device is not removable and cannot be ejected or unplugged”

    Nice registry editing practice though…

  23. Jeff

    Works great for ejecting USB drives on a Mac using a Windows program in Parallels!!

  24. Chris

    When trying this procedure,my Vista Home Prem. does not list “HKEY_CLASSES_ROOT\DesktopBackground\Shell\”
    It only has “HKEY_CLASSES_ROOT\Desktop” and no “shell” below that. No drop down tree listing sub “HKEY_CLASSES_ROOT\Desktop”
    Any suggestions?
    TY

  25. Florinasu315

    That`s very nice but i use still XP, and the key HKEY_CLASSES_ROOT\DesktopBackground\Shell\
    seems to be missing here. How can i do somthing like that in XP? Thanks!

  26. rennmaxbeta

    Is it April 1st? What a silly article. Because you can just use the Safely Remove Hardware icon in the notification area o_O

    If the drive is locked, it’s usually Windows Explorer still tied to a file. Kill the and restart the process to release it.

Enter Your Email Here to Get Access for Free:

Go check your email!