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.
Bookmark this Page!
BlinkList | del.icio.us | Digg it | Furl | reddit | Spurl | StumbleUpon |
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
- Show the Window Menu (Restore, Minimize, Close) for Taskbar Icons in Windows 7
- How to Create a System Repair Disk in Windows 7 and Vista
- Favorite Links Area in Windows Vista Explorer Is Empty
- Add “Open File Location” To the Context Menu for Shortcuts in Windows XP
- Determine the Target Path of Windows Installer Shortcuts
- Windows Vista Partition Not Seen From Windows 7 in a Dual Boot Setup
- 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
If you enjoyed this post, make sure you subscribe to our RSS feed! We feature Tips, Troubleshooting information, Scripts and Utilities for Microsoft Windows Operating Systems!
Prefer an E-mail subscription?

› 