PDA

View Full Version : Is it possible to eject a cd in a batch file on Windows XP?



iCABALO
05-07-2010, 07:59 PM
How to eject dvd drive burner using Batch file ?

Hi every one
I'm using windows Xp and I need Batch file to do this
I googled it and I didn't find the source code

It true there are other exe programs that do this

But am in need of Batch file

Thanks in advance

anon
05-07-2010, 08:03 PM
As far as I know, you can't open the tray with a batch file directly, but you can use this small app:
http://www.nirsoft.net/utils/nircmd.html

Nice nickname, by the way. :unsure:

Edit: two other apps:
http://memberwebs.com/stef/software/eject/
http://www.rjlsoftware.com/software/utility/open_cd/

iCABALO
05-07-2010, 08:09 PM
Thanks for your quick replay
and thank for prizing my nickname

In deed I don't need exe programes
as I mentioned above

but I need batch file
I mean the source code

thanks again

anon
05-07-2010, 08:11 PM
Batch files and source codes are two different things.

iCABALO
05-07-2010, 08:22 PM
Again I really appreciate your interesting
Thanks mate.

The source code is what is written inside the batch file

for example this source code:

echo OPEN "MSCD0000" FOR OUTPUT AS #1> %TEMP%\CD.BAS
echo IOCTL #1, CHR$(0)>> %TEMP%\CD.BAS
echo SYSTEM>> %TEMP%\CD.BAS
QBASIC /RUN %TEMP%\CD.BAS
DEL %TEMP%\CD.BAS

to get the batch file
you have to open notepad
and past this code and then
save it as eject.bat (for example)
and you will get the batch file.

I hope you got my point.

anon
05-07-2010, 09:06 PM
With the NirCmd thingy all you need is this:

@nircmd.exe cdrom open X:

Where X: is the letter of the drive you want to eject.

iCABALO
05-08-2010, 10:21 AM
With the NirCmd thingy all you need is this:

@nircmd.exe cdrom open X:

Where X: is the letter of the drive you want to eject.

I agree with you mate. I Know there are appp that can do this.
But again, I need the Batch file
or the source code of Batch file
and nothing else, This is what I'm looking for.

Thank you mate.

anon
05-08-2010, 04:30 PM
But again, I need the Batch file
or the source code of Batch file

Right there, in the "code" block. Just paste that in Notepad, replace X: with your optical drive's letter, save it as a .bat file in the same folder NirCmd is, and run it. :idunno: