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.
Extract the file called nircmd.exe and paste it in the C:\Windows\System32 directory.
Right click on the file and select properties from the context menu, once the properties have opened click the unblock button.
Now open an administrative notepad, by right clicking on it and choosing run as administrator from the context menu.
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
echo 1 > %TEMP%\DVDOPEN
start "" nircmd.exe cdrom open d:
start "" nircmd.exe cdrom close d:
Select file and choose save as from the menu. When the save dialog box appears, change the type to all files.
Now navigate to C:\Windows\System32 and save the file as open.bat
Once the file is saved open the registry editor and navigate to HKEY_CLASSES_ROOT\DesktopBackground\Shell.
Right click on the shell key and create a new key called Eject/Close CD/DVD Tray.
In the key we just created create a new string value and name it icon.
Double click on the icon value and in the vale data box type
Now right click on the Eject/Close CD/DVD Tray key and create a new key and call it command.
Open the key and edit the keys “Default” value. In the value data field type open.bat.
That’s all there is to it.