Open CD in command prompt....

This topic is locked from further discussion.

Avatar image for Masterfulfish
Masterfulfish

230

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1 Masterfulfish
Member since 2005 • 230 Posts
Hey, i was just wondering what the command is to open the cd tray, iv been searching google to now avail :(
Avatar image for dnuggs40
dnuggs40

10484

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2 dnuggs40
Member since 2003 • 10484 Posts

You can write a vb script to do that, then just execute the script from the command prompt.

Create a txt file called "opencdtray.vbs"

Open the file, and copy this into the document and save:

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


For i = 0 To colCDROMs.count-1
colCDROMs.item(i).eject
Next

oWMP.close

Avatar image for Masterfulfish
Masterfulfish

230

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#3 Masterfulfish
Member since 2005 • 230 Posts
Thanks :)
Avatar image for Rattlesnake_8
Rattlesnake_8

18452

Forum Posts

0

Wiki Points

0

Followers

Reviews: 31

User Lists: 0

#5 Rattlesnake_8
Member since 2004 • 18452 Posts
This topic is 4 years old, not very likely of getting a reply.
Avatar image for Nitrous2O
Nitrous2O

1813

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6 Nitrous2O
Member since 2004 • 1813 Posts

Looks like looping through the drive collection again calling the eject method will close the drive. So you could modify with something like this using a MsgBox as a "pause" in between the open and close.

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

For i = 0 To colCDROMs.count-1
colCDROMs.item(i).eject
Next

MsgBox "Close",0,"Disc drive"

For i = 0 To colCDROMs.count-1
colCDROMs.item(i).eject
Next

oWMP.close

You can play around with it more if you like...