Eject CD via cmd

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know it's possible to download utilities which can allow you to eject the
CD tray, but I am interested in a way to eject from cmd without needing extra
utilities.

The plan is the night before april fools, I am going to edit the login
script for everyone so that it will schedule a small batch file to run every
few minutes. This batch file will open the tray, and most users won't even
notice the little black box.

The scheduling is simple, I found the cmd reference for that, but I can't
find anything to eject the CD.

As far as I know it is built into the shell... is there any way to access
that via cmd?
 
Replied to [Erik]s message :
I know it's possible to download utilities which can allow you to eject the
CD tray, but I am interested in a way to eject from cmd without needing extra
utilities.

The plan is the night before april fools, I am going to edit the login
script for everyone so that it will schedule a small batch file to run every
few minutes. This batch file will open the tray, and most users won't even
notice the little black box.

The scheduling is simple, I found the cmd reference for that, but I can't
find anything to eject the CD.

As far as I know it is built into the shell... is there any way to access
that via cmd?


Use JavaScript :

Drive = "F:\\"
sa = new ActiveXObject("Shell.Application")
fl = sa.NameSpace(Drive).Self
fl.InvokeVerb("E&ject")



Good Luck, Ayush.
 
I'm afraid I am not very familiar with script files... batch files I use all
the time, but never this.

I assumed I would create a file called "blah.js" and Copy/Paste the code you
put below... however that did not work, so I can only assume I am missing a
step or the code you wrote was shorthand.

Ayush" <"ayushmaan.j[aatt]gmail.com said:
Replied to [Erik]s message :
I know it's possible to download utilities which can allow you to eject the
CD tray, but I am interested in a way to eject from cmd without needing extra
utilities.

The plan is the night before april fools, I am going to edit the login
script for everyone so that it will schedule a small batch file to run every
few minutes. This batch file will open the tray, and most users won't even
notice the little black box.

The scheduling is simple, I found the cmd reference for that, but I can't
find anything to eject the CD.

As far as I know it is built into the shell... is there any way to access
that via cmd?


Use JavaScript :

Drive = "F:\\"
sa = new ActiveXObject("Shell.Application")
fl = sa.NameSpace(Drive).Self
fl.InvokeVerb("E&ject")



Good Luck, Ayush.
 
Replied to [Erik]s message :
I'm afraid I am not very familiar with script files... batch files I use all
the time, but never this.

I assumed I would create a file called "blah.js" and Copy/Paste the code you
put below...
Yes.

however that did not work, so I can only assume I am missing a
step or the code you wrote was shorthand.

Change the "F:\\" in first line to the cd-rom drive letter then it will work. (use
two backslashes, e.g. G:\\ not G:\ )



Good Luck, Ayush.
 
F is a valid drive letter for one of my cd drives... I am running vista at
the moment (computers at work where this would happen are XP) so is that
possibly why it is not working?

Ayush" <"ayushmaan.j[aatt]gmail.com said:
Replied to [Erik]s message :
I'm afraid I am not very familiar with script files... batch files I use all
the time, but never this.

I assumed I would create a file called "blah.js" and Copy/Paste the code you
put below...
Yes.

however that did not work, so I can only assume I am missing a
step or the code you wrote was shorthand.

Change the "F:\\" in first line to the cd-rom drive letter then it will work. (use
two backslashes, e.g. G:\\ not G:\ )



Good Luck, Ayush.
 
Replied to [Erik]s message :
F is a valid drive letter for one of my cd drives... I am running vista at
the moment (computers at work where this would happen are XP) so is that
possibly why it is not working?

Yes, vista can be the reason. It works on my PC with both- CD-Drive(G:\\) and
Dvd-Drive(F:\\).

Good Luck, Ayush.
 
Works like a charm! Thanks.

Ayush" <"ayushmaan.j[aatt]gmail.com said:
Replied to [Erik]s message :
F is a valid drive letter for one of my cd drives... I am running vista at
the moment (computers at work where this would happen are XP) so is that
possibly why it is not working?

Yes, vista can be the reason. It works on my PC with both- CD-Drive(G:\\) and
Dvd-Drive(F:\\).

Good Luck, Ayush.
 
Back
Top