• ARTICLES
SEARCH

How-To Geek

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

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 03/20/08

Comments (52)

  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/03/create-shortcut-and-hotkey-to-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…

  15. Anzals

    If all you are doing is ejecting the disk, why not just open windows explorer, right click on the drive and select eject?

  16. registereduser1946

    why go through all that trouble when you can simply right click Computer,select send to,select quick launch?
    now,click Computer in quick launch,right click disk drive (e),select eject

    you can also create a personal Control Panel by creating a folder in Documents. open that folder and select from the left tree,all the options from Computer and Control Panel. close and save folder. right click folder and add to quick launch. my personal control panel has downloads folder,ease of access,update,performance & information,personalization,programs and features,prefetch and cd drive.
    no more going to start and wherever. it’s right in my quick launch

  17. Terry Donscheski

    Way Cool Stuff The eject cd worked great Thanks…

  18. Jeff

    Excellent!!! I was ready to rip my Vostro desktops doors off ( thanks Dell for an idiotic engineering design that hides the DVD’s button when a totally unneeded door is open ). This makes things tolerable. Thanks!!!!

  19. edgar

    nice…. here is my tip: put the ejectCD shortcut in your shortcuts directory and then you can launch it with launchy ;)

  20. Robin

    This really is the best site – well done, uber Geek!
    I wish PCs had a simple CD eject key like Macs have. Surely somebody can either make a toggle open/close shortcut, or even map it to the kayboard – I mean, how many of us use the F12 key?

  21. grace

    I have a Dell Vostro 200 which was recently formated by their techs. They erased my shortcut to open and close my D: Drive. The shortcut was on my desktop on top of all my work. It’s a Icon of a CD-Disk, one inch by one inch. When I mouse click on the icon a ruler slides out from this Icon to give me a few options to choose from such as click to open, click to close, view, copy, etc. I went as far as having tech come into my computer to see what’s going on. The Roxie Creator is not what I want. Although, it will open and close CD Drive, it takes too long to wait and it takes up a lot of screen. No Dell tech or even at the shop could help me get back my Icon that can do it all and very quick about it. I’ve search my software “Utility & Drivers” but just don’t know what to look for. I can’t believe that Dell doesn’t know what the heck I’m talking about. This feature came with my computer when I purchased it in Jan 2008.. which is still under Warrenty. I miss this 1″ x 1″ Icon that can go behind or infront of my work. I design Card and that D: Drive is constantly opening and shutting. Does anyone know of this feature?
    Thanks,
    grace

  22. jd2066

    @grace: The only thing I can think of is the Roxio Drag-to-Disc icon. There is a picture of it at http://www.itg.ias.edu/dragtodiscroxioeasycddvdcreator9
    Is that it? Or is it the “The Roxie Creator” you said you don’t want?

  23. Roberto Luiz

    Ok It worked!
    But I have to make a note:
    I have DaemonTools establishing virtual drivers. So in this case my DVD drive is E:
    Be smart with it.
    Another thing is that you can not forget to put a space after the quotes and then put
    cdrom open D:

    Tnx all

  24. jimi

    hm…you could simpy go to Start Button, Computer, DVD DRIVE, right click and EJECT……..and put a shortcut on your desktop…

  25. GoldBeachBiker

    Great tips; worked well for me. How do you get those shortcuts off of the desktop and into your system tray?

  26. George Carroll

    I am trying to use this procedure in conjunction with a Dell RD1000 ejectable backup media drive. I have been unable to get it to work, have you any ideas? GC

  27. T-REX

    I’s there a way to make the cd open command time out, and auto close the cd-rom?

  28. hafiz

    thanks this is best

  29. Castle_Rock

    Excellent tutorial, I used this shortcut on my notebook, and while it won’t close the drive due to it being a non-powered drive, it works excellent for opening the drive.

    Thanks,

    CR

  30. jerry

    how to make shortcut to eject DVD RW Drive

  31. Grandpa Bill

    I’ve made this shortcut at least 6 times trying every setting/wording and the only
    thing I get is that it wants to copy the nircmd.exe to the windows folder and that’s
    it… tried it on both drives — Even after doing that it was still a “NO GO”!

    OH! and what is the other file for? (nircmdc.exe) Tried that file as well — NOPE!

  32. Contains Virus

    Tried to download NIRCMD, my antivirus showed it including a virus/malware. I removed of course..as should you.

    Gee…thanks a lot Geek!

  33. Mike

    Thank you!

  34. drTucker

    Thanks to zLensman. His suggestion works great!! Thanks to mars9.com for providing that Hotkey CD eject tool FREE.

  35. Dean

    I couldn’t get the shortcut to work.. can someone help me Please?

  36. Richie

    I tried this, with several commands. I get the UAC window, click “OK”, nothing happens? I did download the file, put it in windows directory.

  37. Chris Elliott

    I just bought a new laptop that’s impossible to open the CD drive on. Even if you use your little finger nail, it’s still nearly impossible and you feel like you’re going to break it. This came in handy brother. Thanks!

    Chris

  38. Ben

    Amazing, really easy to use, no virus found on software, but that’s exactly what I’ve come to expect of Nirsoft. I’ve been looking for something to remote close my CD tray for a while. I’ve always been able to open it, but never close. Thanks a lot

  39. Joe

    GREAT SITE. VERY USEFUL
    KEEP THE GOOD WORK GOING

  40. sinisa

    koja je sifra ??????????????????????????????????????

  41. studio52

    Most versions of the cd eject programs do not include windows 7. So….after reading all the wonderful ideas…and of course learning that right clicking on the drive and clicking eject works fine…there is also when you right click on the drive an option to create shortcut on desktop…after the shortcut is created all you have to do is right click on the shortcut and select eject….works like a charm and there is no code or exe files to fiddle with and my wife loves it…its user friendly and it works. No more searching for a solution.

    Easy as Pie…for tech challenged people…like me….LOL

  42. usman

    gooooooooooooooooooooooooood shortcuts for cd rom thanx

  43. Morbius

    Thanks, Geek, that workaround is just what I needed. The hard eject button on my Dell Vostro 1510 has completely failed. I knew that software eject was still working… but it was a pain having to remember to eject before closing my player software. Then, worst of all was to find that when I went to do a clean reinstall (to resolve various other problems) I had to abandon that because I couldn’t get past installing Windows (‘coz I couldn’t eject that first disk)!! I had to abort the install and revert to a previously-saved image (thanks to Paragon and a bit of foresight for that at least). Now I know what to do when I want to resume that clean install…

  44. Affan Mustafa

    Its Really Very Nice NirCmd
    Thnx For giving my work Fastly

  45. MaidRite

    This works very nicely. There is no virus, I saved and checked first. There are a lot of other options worth checking into that are listed on the NirCmd.chm instruction file. At first nothing would show for instructions, but then found an option (I think under properties) that allowed me to “unblock because it appeared the file was from another computer.” Then I could see everything just fine. Must have been under properties, but I can’t find that option anymore since checking the box. Love the CD close drawer – Thank you! Pretty cool making the internet transparent. Maybe I can find some use for that.

  46. Ranbir

    wts nircmd?

  47. Ahmad

    Hi Hot Key Lovers………….
    How To Assign Hot Key To Any Drive
    We create hot keys for all the programs and other things. But, how to create a hot key for a drive? You can create a hot key for any drive as follows:
    Here is the most simplest way to go to any drive in your computer.
    1.Go to My Computer(orComputer).
    2.Right Click on any drive and select Create Shortcut.
    3.Now, right click on the shortcut icon, which appeared in the desktop.
    4.Navigate to Shortcut tab and assign a hot key in the given field.
    5.Switch to General tab.
    6.check the box named “Hidden”
    7.Press Apply and use your own hot keys.

    May we strive for getting and spreading knowledge.
    Ahmad

  48. dianemathtutor

    I, too, was totally frustrated with trying to open my dvd+rw drive with the button on the side of the door when I noticed the Eject option on the right click menu, with a shortcut key: j. Now, I don’t like to download third party software because less is definitely more in the performance dept, and I previously had a problem with corpal tunnel syndrome which disappeared when I started using as many hot keys as possible instead of the mouse; so, I tried making a shortcut to the Eject option which I have not been able to do. But, the WIN+E | D | App | j works well, if you know where the App button is, which I didn’t. On my keyboard, it’s the key between the righthand alt and ctrl buttons with an icon that looks like a piece of paper with lines on it, and a mouse arrow. I don’t know why that is supposed to represent an Application, but that’s the button.
    My solution is similar and uses fewer buttons, but requires some preparation.
    Like registereduser1946, I also like to create my own custom Quick Launch toolbar for the taskbar. I have one of those extra wide screens so I put the taskbar on the right side and make it double wide. The open/running files/applications icons are in a separate column on the left of the taskbar, and my toolbar is in the right column. I create the tool bar like registereduser1946 by making a folder which you can keep anywhere, as long as you remember where. I like to put mine on the desktop, but I have also kept it in Documents before. I call the folder Toolbar and put all the shortcuts in it that I want on my toolbar. Then right click the taskbar and click on Toolbars | New Toolbar… This will allow you to browse and find the Toolbar folder that you created. Select it and Wallah…your custom Quick Launch toolbar appears. You may have to do some dragging and manhandling to get it arranged this way, but once you achieve it, it stays that way, and it is so utilitarian!!!!!!
    Finally, you can put a shortcut to the dvd-rw drive on the taskbar toolbar by putting a shortcut in the folder. Then when you want to eject it, you can tab to the shortcut for the drive, hit Shift + F10 (for rightclick) | j. Works like a charm with fewer keys to hit. I don’t know how to make the dvd-rw drive soft close, but I don’t have nearly the trouble pushing the door closed as I did trying to open it with that tiny little button that I would push and push until I realized that nothing was happening. This is soooo much better.

  49. dianemathtutor

    By the way thanks for the wonderful article, and discussion. It is so great to exchange ideas.

  50. redgrl

    Thanks for this fix. The only thing i would add is that in WIN 7 the dialogue box comes up to run nircmd. uncheck the box at the bottom that says to always ask and you won’t see the dialogue box anymore.

    Works like a charm!!!

  51. ali-chan

    thank you thankyou! i have done much to this computer (it had a bought of linux :p) and, with its slot CD tray i was going into my computer every time i needed to eject a disk! this is wonderful thanks again!

  52. Missa

    It is very convenient :) ! Thank You, “HowToGeek” !

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!