Create Shortcuts to Eject and Close CD/DVD Drive
Windows already includes the Eject command in the context menu for optical drives. If you want to add the Close Tray option in the context menu for optical drives, then this article is for you.
NirCmd is a small command-line utility written by Nir Sofer that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line option, you can write and delete values and keys in the Registry, write values into INI file, dial to your internet account or connect to a VPN network, restart windows or shut down the computer, create shortcut to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more…
Shortcuts to Eject / Close CD/DVD Drive
Download Nircmd.zip from Nirsoft.net, unzip and extract the files to a folder. Move the file nircmd.exe to your Windows directory. To create a desktop shortcut to eject the CD/DVD drive tray, use the following command:
nircmd.exe cdrom open drive:
Assuming that F:\ is the drive-letter for your CD/DVD drive, you use the following command:
As you guessed it right, the command for closing the drive tray is:

Fig 1: Desktop shortcuts to open and close CD drive.
Tip: You may customize the icon the shortcuts accordingly. Browse through shell32.dll using the Change Icon dialog, and pick the CD/DVD icon. (Icon index #11)
Add "Close Tray" option to the context menu
To add a Close Tray entry to the right-click menu of CD/DVD drives, use these steps:
1. Download closetray.zip and save to Desktop
2. Unzip the files and extract the contents to a folder
3. Double-click closetray.reg to run it.

Fig 2: Close Tray option in the context menu
The Close Tray option will now appear for all optical drives connected to the system. Note that there is also a undo REG file available in the Zip, just in case you want to remove Close Tray option from the right click menu.
Editor’s note: The above is just one of the many tasks that NirCMD can automate. Read the NirCMD help file to know the other uses of this excellent tool! And NirCMD is just one of the many helpful tools produced by Nir Sofer.
Copyright © 2008 Ramesh Srinivasan. All rights reserved.
RELATED POSTS
- Disable Empty Recycle Bin Confirmation in Windows XP and Vista
- Error “This File Does Not Have a Program Associated With It” When Launching a Game From Games Explorer
- Determine the Target Path of Windows Installer Shortcuts
- Favorite Links Area in Windows Vista Explorer Is Empty
- Add “Open File Location” To the Context Menu for Shortcuts in Windows XP
- Add Quick Launch (Create Shortcut) Option to the Send to Menu in Windows XP/Vista
- Enable and Disable Built-in CD Burning Features in Windows Vista
- Launching Programs as Administrator From the Vista Start Menu
- Underline Keyboard Shortcuts and Access Keys in Windows Vista
- Unable to Open Display Properties in Windows XP



Like this site? Make sure you
June 2nd, 2008 at 9:34 pm
Nice Application and nice post, but I dont think this application would be used by most of the people.