How-To Geek
Create a Shortcut or Hotkey to Immediately Eject a Specific USB Drive
After writing yesterday’s article about creating a shortcut to the Safely Remove Hardware dialog, a number of readers mentioned to me that they’d like create a shortcut to immediately eject a specific drive, so we’ll cover that here.
Using the built-in Windows dialog is more powerful and probably would suffice for most people, but for those of us that want complete control there’s a small freeware utility called USB Disk Ejector.
Note: This utility only works for ejecting USB devices, so if you need to eject another type of device you’ll have to use the Windows method.
Using USB Disk Ejector from the GUI
This utility is really quite slick… launch it and then either double-click or press enter on the usb device you’d like to eject. There’s literally nothing else to it.
If you assign a hotkey to the executable through a shortcut, you can operate the entire thing from your keyboard. Quite useful for keyboard ninjas!
Using From the Command Line (Advanced)
You can also use the utility from the command line, and pass parameters to tell it which drive to eject. It will work silently by default, so there won’t be any popups to deal with.
You can start off by passing in the /? parameter to show the help dialog:


Now that you know the command line options, you can test them out… for instance, my flash drive is mounted as my G: drive, so I’d use this syntax:
usb_disk_eject /removeletter G

You will only get a message if there is an error. For instance, if you run the same command a second time without the USB drive mounted, you’ll get this message that doesn’t seem very accurate:

You can also use the partial name matching if your USB drive seems to change letters a lot, but the syntax is slightly strange. To check for a partial name, append * to the beginning of a keyword. Do Not put a second asterisk in the search string, as it won’t work.
For instance, the full name of my flash drive is “Memorex TRAVELDRIVE 005B” so I could use the full name:
usb_disk_eject /removename “Memorex TRAVELDRIVE 005B”
Or I could just use *Memorex as the name instead:
usb_disk_eject /removename “*Memorex”
Note: the /showeject parameter didn’t work for me at all under Vista, but it might work for you.
Create a Shortcut to Eject a Specific USB Drive
Now that we know how the syntax works, we can include that into a shortcut that can be launched from an icon or hotkey. Right-click on the desktop or elsewhere and choose New \ Shortcut.


In the location box, you’ll put the full path to the USB Disk Eject application file, and then append the /removeletter parameter to the end including the drive letter.
C:\path-to\USB_Disk_Eject.exe /REMOVELETTER G


You’ll want to give the shortcut a reasonable name, and then you’ll have an icon you can use to immediately eject the drive:

Note that you could use the /removename parameter instead if you choose.
Assign a Hotkey to the Shortcut
Now that we have a shortcut, we can assign a hotkey to the shortcut by right-clicking on the icon and choosing Properties. On the Shortcut tab you’ll see a place to assign the Shortcut key:


Add in the shortcut key and close the dialog. As long as the shortcut is on your desktop you shouldn’t have to restart anything for the hotkey to work. You can also move the shortcut to another folder, for instance your quick launch bar.
Tip: If you add the shortcut to the Windows Vista quick launch bar, you can use the built-in hotkeys instead of bothering to assign one manually.
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (28)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 03/15/08




Great followup to yesterday’s article!
I’m gonna use this to eject my iPod.
nice, i was wondering if that could be done after reading the first article.
I tried it but couldn’t get it to work on my vista machine. The system could not find “USB_Disk_Eject.exe”. I couldn’t find it either.
@Wil
You probably need to extract the file from the downloaded zipfile first. Right-click on the downloaded zip file and choose to extract. Then you’ll be able to use the .exe file.
Where can I find a copy of that USB drive icon?
@dix: You can grab that icon from the program itself. Use an icon extractor like NirSoft’s IconsExtract:
http://www.nirsoft.net/utils/iconsext.html
I went real over board on this idea and wrote a batch file that used nircmd send a batch killprocess to every executeable on my flashdrive, running or not, and then run the drive eject so it would never fail.
for nircmd: http://www.nirsoft.net/utils/nircmd.html
Why not just left-click on the Remove Safely icon and then click on the drive that you want to eject when the menu comes up? Saves a few clicks.
Can’t seem to get the shortcut to work
“C:\Documents and Settings\Kyle\My Documents\Applications\USB_Disk_Eject.exe” works fine
but adding “/REMOVELETTER M” just makes it say “… can’t be found”
Kepp
To get the shortcut to work, place the \removeletter m outside the quotation marks like this;
“C:\Documents and Settings\Kyle\My Documents\Applications\USB_Disk_Eject.exe” \REMOVELETTER M
Great tip! :)
Now, is there a way to mount the drive without unplugging the USB cable/stick and plugging it back in? I sometimes like to unmount my USB drive and leave it plugged in. When I do this, I have to unplug the cable, then plug it back in for Windows to mount it.
http://www.safelyremove.com
the best app that i saw to do that. it creates a global hotkey too. perfect.
Ricardo,
You must work for that company. $20 for an app that does something so simple…highway robbery…
Zak,
Maybe Ricardo works on this company, then I also work for this company :) But it’s However with USB Safely Remove I can stop USB devices with keyboard shortcuts by default without performing any long instructions. Also it get rid me of a lot of annoyances appearing on frequent using of USB (ie “the device cannot be stopped right now” message).
Love the product!!! SLICK!
Is it possible to do
USB_Disk_Eject.exe \REMOVELETTER CD
CD being the current dir, so you can run it on the USB drive?
Related Question. I assume that the power down of the computer when it is shut off closes any cross connections and that is it then safe to remove the USB from the plugin. Or is it dangerous to shut off the computer while the USB device is plugged in?
woot! cheers for sharing info m8 ^^
rsm eject comes with windows and does the exact same thing, for free. Highway robbery, indeed.
after you eject a disk and it’s still pluged in how do you uneject it without having to unplug it then plug it back in??????????
@Aarohan I sometimes use my drive at the library where the “safely remove hardware” is not shown. I’ll see if this still works there. The shortcut method mentioned at the beginning of the article doesn’t.
Why should I need to install a 3rd party program to do this? Windows obviously has the capability to quickly stop a usb flash drive. When I left click on the “safely remove blah blah blah” icon it allows me to pick the item I wish to stop. Why can’t we just streamline this process? Give me a desktop shortcut (that I can assign a shortcut key to) that does what the “Safely Remove Hardware” icon that appears in the taskbar does. I click it and quickly select the usb drive I want to eject.
Personally I think it is totally dumb you have to eject flash drives to begin with, but for crying out loud Mircosoft, make it easier.
To be able to remove your USB drive without using the “Safe Removal” process… Plug in your USB and go to My Computer. Right click on your USB drive and select Properties. The 2nd tab should be titled ‘Policies’. Make sure that ‘Optimize for quick removal’ is checked and you are good to go with removing the USB stick whenever you want.
Dear Sir
We would like to know that i want to eject usb pan drive using command prompt
Hi
is it possible to eject multiple drives with this tool? For example, if I plug in my portable drive it loads under the “G” drive, but if I plug my usb stick, it loads on the “H” drive. How do I configure the application, to remove whatever drive is plugged in? Thanks:)
Hi.
can you make a guide how to safety remove a usb wireless adptor with shortcut/hotkeys?
I have used disk ejector before but then, i am using Pro-Eject USB now, it will clean close, eject the drives. try it.The app is compatible with Window7, Windows Vista and Windows XP..