Subscribe to How-To Geek

Recommended: Click Here to Run a Free Scan for Common PC Errors   [Sponsored Link]

Create a Shortcut or Hotkey to Eject the CD/DVD Drive

After writing articles about how to open the Safely Remove dialog as well as eject a specific USB drive, some readers contacted me asking me to write about how to eject a CD or DVD drive instead, so I'm covering that here.

There's a number of ways to accomplish this, but the best way is to use the NirCmd utility from the excellent Nirsoft. It does a lot more than just eject the cd-rom drive, so be sure to read the information on their site about all the capabilities.

Create a Shortcut to Eject the CD/DVD Drive

Right-click on the desktop or elsewhere and choose New \ Shortcut.

image

In the location box, put the full path to the nircmd.exe file that you downloaded, and append the "cdrom open" command to the end of it, adjusting the drive letter to match your disc drive:

"C:\path\to\nircmd.exe" cdrom open D:

Note the location of the quotes.. if you are using a path with spaces in it, you need to make sure the quotes are only around the path to the executable, and the arguments should be placed after the quote.

image

Give the shortcut a meaningful name, like Eject CD or something like that, and you'll have a new icon (read below on how to use the cd-rom icon as shown)

image

You can move the icon to anywhere you'd like… double-clicking on it will immediately eject the drive.

Create a Shortcut to Close the CD/DVD Drive

You can follow the same exact instructions as above, but instead of "cdrom open" just substitute "cdrom close".

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.

Assign an Icon to the Shortcut

If you click on the Change Icon button in the properties window, you can give the shortcut a more meaningful icon, perhaps the DVD one you see below.

image

You could choose any icon on the system that you'd like, of course.

Download NirCmd from nirsoft.net

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 03/20/08 and tagged with: Windows Vista, Vista Tips & Tweaks

Comments (14)

  1. alexfel

    Don't work for me, when i execute the shortcut there comes a popup window with the nircmd info, and the cdrom doen't open

  2. alexfel

    fixed ;)

  3. The Geek

    @alexfel:

    What did you use as the location for the shortcut?

  4. Chris

    Thank you!

    This came at a fantastic time!

    Great shortcut idea!

  5. Osk

    Nircmd is great, but, Is there another way to do the same but using only builtin Windows commands?
    Thanks

  6. Premankan

    Yea I've been using this same trick for a while now….make a shortcut, put it in the quick launch and hit the Win + 5 to open and Win + 6 to close.

  7. Anoop Engineer

    I am a bit sick of how How-To Geek is going too Windows centric. Honestly!

    How-To do the same in Linux:
    http://www.dailygyan.com/2008/.....eject.html

  8. The Geek

    @Anoop

    I have been writing more Windows content lately than normal… of course 90% of the readers of this site use Windows, so I get complaints when I write Linux content as well. I can't win!

  9. Torrente

    You can do that and much much more with PowerPro 4.8 (FREEWARE)
    For example: you can make your own taskbar(far better then windows), build menus, use hotspots(screen corners,edges,titlebars etc.) for actions, you can have just one hotkey for many actions depending on the foreground window , then you can ….
    Warning: Help file is like a book so if you don't have patience you will hate this app.
    I discovered this app recently ( why, why, why??? ), although it's in development for ten years, and now I am spreading the word …. people must know !!!

  10. zLensman

    Great tip. I was looking for this a while back. The solution I found that works for me is a different little freeware utility called "Hotkey CD Eject" from the Mars9 website, http://mars9.com/downloads/freeware/
    This utility just does one thing — eject or close CD/DVD trays. It sits in your system tray, allows you to assign hotkeys, and can autostart with Windows. I have had no compatibility problems with it under Vista.

  11. Oliver

    I mad a AHK script for this, long ago…

    ;Created by Oliver
    ; oliver.lipkau@gmail.com

    #NoTrayIcon

    FileSelectFolder,Driveletter,::{20d04fe0-3aea-1069-a2d8-08002b30309d},0,Pick a drive:
    if Driveletter =
    return
    StringTrimRight, Driveletter, Driveletter, 1
    Drive, Eject, %Driveletter% , 1
    ExitApp

  12. Computer Wizard

    You don't need any software, just Windows. Press and hold the Windows key. While holding the Windows key press the E key and release both. After Windows Explorer opens quickly press and release each of the following keys in succession: C key, Application key, and J key. If you have a DVD drive then change the C key to a D key. Or if you have a disk in the drive change the C key to whatever the title of the disk is. Most keyboards have the Windows key and Application key but if yours does not then just open Windows Media Player, press and hold the Ctrl key then the E key.

  13. Rov

    OMFG.. this was uber easy hehe.. ur the best man..

  14. bouloit

    :-)

    So is there a command line parameter we can give the shortcut in explorer that ejects the CD/DVD or not ?

    How do the little apps that do it work ? Do they do more than land a command wit a special command line parameter ?

    Would be nice to have a listing of ALL command line parameters for explorer…


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

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

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.