Eject CD/DVD tray

To create a button or hotkey which ejects the CD or DVD tray, use a command like this:

ContextMenu FILE="D:\" VERB="Eject"

Replace D:\ with the appropriate drive letter.

Below is the full button XML which you can paste directly on to a toolbar. (Copy the text below into your clipboard, then enter Customize mode, right-click an empty space on your toolbar and select the Paste option.)

<?xml version="1.0"?> <button display="both"> <label>Eject D:</label> <icon1>116</icon1> <function type="normal"> <instruction>ContextMenu FILE="D:\" VERB="Eject"</instruction> </function> </button>

Nice, thanks. I presume a corresponding command to close the tray isn't available? On that assumption, here's a three-button hack to open and close the tray, and go to the drive :-

(Copy the text below into your clipboard, then enter Customize mode, right-click an empty space on your toolbar and select the Paste option.)

<?xml version="1.0"?> <button display="both" type="three_button"> <label>Eject R:</label> <icon1>116</icon1> <button display="both"> <label>Eject R:</label> <icon1>116</icon1> <function type="normal"> <instruction>C:\WINDOWS\WIZMO.EXE open=r quiet</instruction> </function> </button> <button display="both"> <label>Close R:</label> <icon1>116</icon1> <function type="normal"> <instruction>C:\WINDOWS\WIZMO.EXE close=r quiet</instruction> </function> </button> <button display="both"> <label>Go to R:</label> <icon1>116</icon1> <function type="normal"> <instruction>Go "R:"</instruction> </function> </button> </button>

Notes:-

  1. Replace "R" with the appropriate drive letter.

  2. Put Wizmo.exe at C:\WINDOWS\WIZMO.EXE (or adjust the path accordingly). Get Wizmo here: grc.com/wizmo/wizmo.htm . It does lots more besides the CD tray: power settings; screensavers; monitor blanking; volume; play media; logoff/reboot; and more.

  3. Remove "quiet" to make Wizmo make a little sound after it opens/closes the tray.

  4. Remove "=r" to make Wizmo act on the default removable drive, whichever drive letter is assigned (on 95/98/ME "close" only acts on the default, I think).

Anyone particularly Gibson-averse could swap Wizmo for NirCmd :-

nirsoft.net/utils/nircmd2.html
nirsoft.net/utils/nircmd.zip 66kb

Though I think Steve Gibson and Nir Sofer are both pretty sane (and offer a range of cool, tiny freeware).

I found a better way without assigning the driver letter,Use the Cdoc.EXE and create a butten like this:

<?xml version="1.0"?> Eject/Close CD Tray Eject or Close CD/DVD Tray 116 /home\Plugins\Cdoc.EXE

replace "/home\Plugins\Cdoc.EXE" with the place where your Cdoc.exe is.

Where does cdoc.exe come from?

Running it causes Process Monitor to crash every time which is a bit suspicious, though could just be a bug in Process Monitor.

Anyway, if it's not something you've written yourself then we prefer that you post links to the original site with the program, that way people can get updated versions of it if they read the thread later. I couldn't work out where it came from, though.

VirusTotal found enough problems with that file for me to consider it malware. Until proven otherwise I've removed the download link.

virustotal.com/analisis/0918 ... 5265cb9cf3

zhgwangff you need to show us where it came from, or at least explain it's origin. Not doing so will result in your account here being deleted.

[quote="steve"]VirusTotal found enough problems with that file for me to consider it malware. Until proven otherwise I've removed the download link.

virustotal.com/analisis/0918 ... 5265cb9cf3

zhgwangff you need to show us where it came from, or at least explain it's origin. Not doing so will result in your account here being deleted.[/quote]

Sorry for that, I gave the file above, it works for me very well

I made a hotkey Ctrl+E for "/home\Plugins\Cdoc.EXE",

Do Ctrl+E in Dopus, the Cd Tray will open, Do it again, it will close.
thats amazing :wink:

But I do not know how to explain its origin, I downloaded it from a set, which i dont remember now, I think you can just test it with antivirus, and have a try, if this is forbiden, then delete it again, I just want to share, thats all.

Where did cdoc.exe come from?

I cant find the original set, which I downloaded it. I can find many files with this name in internet now, but not sure if they are safe. But I've used mine, which I uploaded, for one year.

Forget it guys if you dont trust it, I will not upload it again.

<?xml version="1.0"?> <button backcol="none" display="both" icon_size="large" textcol="none" type="three_button"> <label>Eject/Close CD</label> <icon1>%SystemRoot%\system32\SHELL32.dll,177</icon1> <button backcol="none" display="both" textcol="none"> <label>Eject</label> <icon1>#newcommand</icon1> <function type="normal"> <instruction>C:\WINDOWS\nircmd.exe cdrom open</instruction> </function> </button> <button backcol="none" display="both" textcol="none"> <label>Close</label> <icon1>#newcommand</icon1> <function type="normal"> <instruction>C:\WINDOWS\nircmd.exe cdrom close</instruction> </function> </button> </button>

change the [nircmd.exe] path..