[image]
[image]

Subscribe to 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.

image

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:

image

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

image

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:

image

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.

image

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

image

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:

image

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:

image

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.

Download USB Disk Ejector from mixnmojo.com

The Geek is the founder of How-To Geek and a geek enthusiast. This article was written on 03/15/08 and tagged with: Windows Vista, Vista Tips & Tweaks

Daily Email Updates

You can get our how-to articles in your email inbox each day for free. Just enter your email below:


Comments (18)

tim

Great followup to yesterday's article!

I'm gonna use this to eject my iPod.

pipo

nice, i was wondering if that could be done after reading the first article.

Wil

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.

The Geek

@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.

dix

Where can I find a copy of that USB drive icon?

Joe

@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

echoniner

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.

echoniner
Aarohan

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.

Kepp

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"

Scrapp

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

zak

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.

Ricardo

http://www.safelyremove.com

the best app that i saw to do that. it creates a global hotkey too. perfect.

Zak

Ricardo,

You must work for that company. $20 for an app that does something so simple…highway robbery…

WiseJoe

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).

titsmagee

Love the product!!! SLICK!

Joel

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?

BLUIE

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?


Leave a Comment




Leave your friendly comment here.

If you have a computer help question, leave it on the forums instead of here.

Note: Your comment may not show up immediately on the site.
[image]


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser