Home » Questions » Computers [ Ask a new question ]

Is it possible to eject a cd in a batch file on Windows XP?

Is it possible to eject a cd in a batch file on Windows XP?

I've seen a few executables/utilities that do it, and many forums that say it is not possible to do. But is there any DOS command that I can rely on in a typical XP installation?

Asked by: Guest | Views: 262
Total answers/comments: 3
Guest [Entry]

"There seems to be no way using rundll or a preexisting executable.

If you have windows scripting host installed, maybe the following helps (untested, copied from another forum)

Set oWMP = CreateObject(""WMPlayer.OCX.7"")
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(0).Eject

Change the (0) if you have more than one drive."
Guest [Entry]

"There is a windows API call to do it, but unfortunately not a built in command.

There is a command line tool you can download though that will do the job."
Guest [Entry]

"You can try this Batch file:
@echo off
echo CreateObject(""WMPlayer.OCX.7"").CDRomCollection.Item(0).Eject() >temp.vbs
cscript //nologo temp.vbs
del temp.vbs"