do
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
End If
loop
Save the code as: xxx.vbs(where xxx:any name)
Now once you double click the saved file,your Cd-Rom drive will open whenever it is closed