SEARCH

How-To Geek

How to Eject Your CD/DVD Drive From the Desktop Context Menu

sshot-24
Most of the time you’ll eject the CD/DVD drive on your PC through a button on the drive, but some laptops don’t include a button. Here’s a way to do it right from the desktop.

If you’d like to safely eject USB drives from your desktop, we’ve got you covered with that one too.

Adding Eject to the Desktop Context Menu

Head over to the NirSoft website and grab a copy of nircmd, remember to get the version that matches your operating system’s architecture.

sshot-10

Extract the file called nircmd.exe and paste it in the C:\Windows\System32 directory.

sshot-11

Right click on the file and select properties from the context menu, once the properties have opened click the unblock button.

sshot-12

Now open an administrative notepad, by right clicking on it and choosing run as administrator from the context menu.

sshot-15

Paste the following into the new document.

Note: You should substitute the drive letter on lines 5 and 9 for the letter of the CD/DVD drive that you wish to open and close.


@ echo off
IF EXIST %TEMP%\DVDOPEN GOTO :CD/DVDCLOSE
:CD/DVDOPEN
echo 1 > %TEMP%\DVDOPEN
start "" nircmd.exe cdrom open d:
exit
:CD/DVDCLOSE
DEL %TEMP%\DVDOPEN
start "" nircmd.exe cdrom close d:

 

sshot-14

Select file and choose save as from the menu. When the save dialog box appears, change the type to all files.

sshot-16

Now navigate to C:\Windows\System32 and save the file as open.bat

sshot-17

Once the file is saved open the registry editor and navigate to HKEY_CLASSES_ROOT\DesktopBackground\Shell.

sshot-18

Right click on the shell key and create a new key called Eject/Close CD/DVD Tray.

sshot-19

In the key we just created create a new string value and name it icon.

sshot-20

Double click on the icon value and in the vale data box type

imageres.dll,-30

sshot-21

Now right click on the Eject/Close CD/DVD Tray key and create a new key and call it command.

sshot-22

Open the key and edit the keys “Default” value. In the value data field type open.bat.

sshot-23

That’s all there is to it.

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/17/11

Comments (12)

  1. Maggy Stricker

    Somehow my child pulled out the entire cd/dvd unit from my Gateway laptop. I was able to slide it back in and the cd works fine, but not so for the dvd player. I’ve tried tweaking the driver to no avail. Do I have to bring it to the shop or can I fix it myself?

  2. iam_urz

    ok. so i’ll just wait till someone figures out a way to do this with one double click install.

  3. annon

    whats wrong with right clicking the drive in explorer and EJECT?

  4. root666

    What’s wrong with clicking the eject button on the drive? ^^

  5. Spen

    I can click the eject button on the drive but I can’t close it that way. Does any one know how to close it via the computer, that doesn’t mean downloading software?

  6. sasquatch1955

    Way to hard of a method. Quicker and effective method.
    1. Open “My Computer”
    2. Right click and hold the icon for your DVD/CD drive.
    3. Drag to desk top, release mouse button and select, “Create Shortcuts Here”
    4. Now you an icon for your drive on desk top and you can right click and select “Eject” from the menu.

  7. ronburns

    Nothing is wrong with any of those options, this one is faster for me because I purchased a BD that really doesn’t like to open when you push the eject button on the Dell Studio XPS 9100′s case. So, instead of having to open explorer, I can just use the context menu to do it. Thanks a lot for this reg hack!

  8. ronburns

    sasquatch1955: Your method doesn’t toggle open and close, it just opens it! So, I still agree with the context menu.

  9. Kathy

    Hey, thanks sasquatch1955
    I bought a new laptop& & the door to dvd player kept sticking. Sometimes you could get it open & most the time not. I didn’t want to return the laptop just for that, besides by the time I discovered the door didn’t work right (even poking into the little pinhole didn’t do the trick either) I had all my stuff transfered over & etc. I followed your advice it now pops open with a click. Thank you for your info. Really appreciate it.

  10. lance john

    thanks sas for helping open dvdin hp notebook ps anymore tips

  11. scouser73

    I downloaded the file and found that it contained Malware as detected by Comodo AV.

  12. Hariks

    eject -t in Ubuntu will toggle the CD tray open/close. Just create a launcher/easystroke for this and forget it. That is the beauty of Linux…

Enter Your Email Here to Get Access for Free:

Go check your email!