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

By Taylor Gibb on November 17th, 2011

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
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!