{"id":295,"date":"2008-05-23T21:23:08","date_gmt":"2008-05-23T15:53:08","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=295"},"modified":"2019-06-24T15:30:11","modified_gmt":"2019-06-24T15:30:11","slug":"create-shortcuts-to-eject-and-close-cddvd-drive","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/create-shortcuts-to-eject-and-close-cddvd-drive\/","title":{"rendered":"Shortcuts to Eject and Close CD\/DVD Drive in Windows"},"content":{"rendered":"<p>Windows already includes the <b>Eject<\/b> command in the context menu for optical drives. If you want to add the <b>Close Tray<\/b> option in the context menu for optical drives, then this article is for you.<!--more--><\/p>\n<p><b>NirCmd<\/b> is a small command-line tool 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&#8230;<\/p>\n<p><b>Shortcuts to Eject \/ Close CD\/DVD Drive<\/b><\/p>\n<p>Download Nircmd.zip from <a href=\"http:\/\/www.nirsoft.net\/utils\/nircmd.html\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Nirsoft.net<\/a>, unzip and extract the files to a folder. Move the file <b>nircmd.exe<\/b> to your Windows directory. To create a desktop shortcut to eject the CD\/DVD drive tray, use the following command:<\/p>\n<pre>nircmd.exe cdrom open drive:<\/pre>\n<p>Assuming that F: is the drive letter for your CD\/DVD drive, you use the following command:<\/p>\n<pre>nircmd.exe cdrom open F:<\/pre>\n<p>As you guessed it right, the command for closing the drive tray is:<\/p>\n<pre>nircmd.exe cdrom close F:<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/openclosetray.jpg\" width=\"137\" height=\"86\" \/><\/p>\n<p><i>Fig 1: Desktop shortcuts to open and close CD drive.<\/i><\/p>\n<p><b>Tip:<\/b> 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)<\/p>\n<p><b>Add &#8220;Close Tray&#8221; option to the context menu<\/b><\/p>\n<p>To add a Close Tray entry to the right-click menu of CD\/DVD drives, use these steps:<\/p>\n<ol>\n<li>Download <b><a href=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/closetray.zip\">closetray.zip<\/a><\/b> and save to Desktop<\/li>\n<li>Unzip the files and extract the contents to a folder<\/li>\n<li>Double-click <b>closetray.reg<\/b> to run it.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/closetray.jpg\" width=\"246\" height=\"107\" border=\"0\" \/><\/li>\n<\/ol>\n<p>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 <b>Close Tray<\/b> option from the right-click menu.<\/p>\n<p>The above is just one of the <b>many<\/b> tasks that NirCMD can automate. Read the <a href=\"https:\/\/www.winhelponline.com\/blog\/tag\/nircmd\">nircmd<\/a> help file to know the other uses of this excellent tool!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[335,441],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-windows","tag-nircmd","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1006,"url":"https:\/\/www.winhelponline.com\/blog\/nircmd-elevate-switch-useful-uses\/","url_meta":{"origin":295,"position":0},"title":"NirCmd Elevate Switch Added &#8211; Some Useful Uses","author":"Ramesh","date":"February 24, 2010","format":false,"excerpt":"We've covered the excellent multi-purpose command-line tool NirCmd from Nirsoft earlier. This post talks about the new command-line switches added in the current version of NirCmd. Earlier this month, I sent a NirCmd feature request to Nir Sofer, asking to include an \"elevate\" switch, which should launch an application elevated\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":890,"url":"https:\/\/www.winhelponline.com\/blog\/add-nircmd-speak-to-context-menu-text-files\/","url_meta":{"origin":295,"position":1},"title":"Fun Tip: Add &#8220;Speak&#8221; Option to the Context Menu for Text Files","author":"Ramesh","date":"April 8, 2009","format":false,"excerpt":"The amazing NirCmd utility now has a new \"speak\" command that allows you to easily cause your computer to speak the text that you wish. In this command, NirCmd uses the Speech library (SAPI) that is installed in Windows. Here is a fun tip on how to add the Speak\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/archived\/nircmd-speak.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4931,"url":"https:\/\/www.winhelponline.com\/blog\/restart-explorer-gracefully-shortcut-command\/","url_meta":{"origin":295,"position":2},"title":"How to Restart Explorer Cleanly Using Shortcut or Command-line","author":"Ramesh","date":"December 31, 2016","format":false,"excerpt":"When you make changes to the Windows registry using the Registry Editor, script or any other automation tool, you may have to logoff and login back for the changes to take effect. That's especially true if you're altering the UI element metrics or changing the shell namespace folder icons etc.\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"restart explorer gracefully","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/restart-explorer-gracefully.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/restart-explorer-gracefully.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/restart-explorer-gracefully.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":907,"url":"https:\/\/www.winhelponline.com\/blog\/disable-empty-recycle-bin-confirmation-windows\/","url_meta":{"origin":295,"position":3},"title":"Empty the Recycle Bin Without the Confirmation Window Showing Up","author":"Ramesh","date":"June 29, 2009","format":false,"excerpt":"When emptying the contents of your Recycle Bin, you'll be asked for confirmation as below. Here is a registry edit to turn off the prompt in Windows 7, 8 and Windows 10, using NirCmd. This registry edit replaces the Empty Recycle Bin command in the right-click menu and the ribbon\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"recycle bin delete confirmation prompt","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2009\/06\/rbin-silent-empty.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":8806,"url":"https:\/\/www.winhelponline.com\/blog\/turn-off-monitor-shortcut-command-windows\/","url_meta":{"origin":295,"position":4},"title":"Turn Off Monitor Using Shortcut or Command-line in Windows","author":"Ramesh","date":"April 23, 2019","format":false,"excerpt":"My new Samsung Curved monitor has the power button on the rear end, perhaps for aesthetic purposes. I have been using monitors that have controls on the front or underneath the bezel all these years. Now, with the new monitor, I find it a little bit inconvenient to reach out\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"controlmymonitor turn off primary monitor using desktop shortcut","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1071,"url":"https:\/\/www.winhelponline.com\/blog\/run-program-elevated-right-click-menu-windows\/","url_meta":{"origin":295,"position":5},"title":"How to Add a Right-Click Menu Option to Run a Program Elevated","author":"Ramesh","date":"August 18, 2010","format":false,"excerpt":"From the Windows Taskbar, you can start a program elevated by holding the Ctrl & Shift keys and then clicking on a pinned shortcut. To launch a program elevated from the right-click menu, you can add custom entries and launch it using a script or using the NirCmd utility. Earlier\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"take ownership right-click menu","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/09\/take_ownership_context_menu.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}