1.

Solve : Eject/Load CD-ROM?

Answer»

what command in mdos to eject/load cd-romyou can use WSH, if you have
Code: [Select]CONST CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & ":\"
End If
Next

Sub Eject(CDROM)
Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
save it as .vbs, and use cscript to run it.Sidewinder had a simple VBS file, that was not this involved. I will see if I can find him to post it again.Or you could use a utility program.

Some examples can be found here:
http://www.simtel.net/category.php%5Bid%5D42%5BSiteID%5Dsimtel.net

I'm sure there are many others out there, I just found these quickly with Google. On that page is shareware and freeware, so look closely.

One there is a TSR. I've no idea if that would work with something like XP - might be an INTERESTING experiment.
Code: [Select]Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
do
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
loop
end if If you save that as a .vbs and run it, it will constanly open and close your cd drive. To stop it, go to task manager, PROCESSES tab, and end 'wscript'ghost dog,

i alredy try it. but the script eject all my rom.

my G: drive is DVD rom /

i want create 2 script.
-1 for eject G:
-1 for load G:

how to write ?I'm not AWARE of any method that will load CD/DVD drives but for unloading (opening) a specific drive, this may work:

Code: [Select]Set WMP = CreateObject("WMPlayer.ocx")
Set colCDROMS = WMP.CDROMCollection

If colCDROMS.Count > -1 Then
For i = 0 to colCDROMS.Count - 1
If colCDROMS.item(i).driveSpecifier = "G:" Then
colCDROMS.Item(i).eject
End if
Next
End If

Save script with a vbs extension and run from the command prompt with cscript scriptname.vbs

Good luck. Impeccable timing.



Discussion

No Comment Found