|
Answer» is there any command using which i can open and close my cd-rom with a batch fileI'm not aware of any batch command to open or close the CD. VBScript can eject the CD but as far as closing the CD you may be SOL.
EjectCD:
Code: [Select]Set WMP = CreateObject("WMPlayer.ocx") Set colCDROMS = WMP.CDROMCollection
If colCDROMS.Count > -1 Then For i = 0 to colCDROMS.Count - 1 colCDROMS.Item(i).Eject Next End If
Note: If WMPlayer.ocx doesn't work for you, try WMPlayer.ocx.7
If you do find a way of closing the CD, PLEASE post it. It would be INTERESTING to see how it's done.
8-)Would now be a helpful time to POINT out that you can do this with Linux?
(Possibly therefore it could be done under Windows using Cygwin, but installing that would be overkill just to find a way to issue a "tray close" commend!)There is a utility that may be helpful. I have no experience with Wizmo but you may find it suits your purpose.
Good luck. 8-)
Let us KNOW how Wizmo works out.Theres ALWAYS AUTOIT which can convert scripts to .exe files and it has controls to open and close a cd-rom driveOpen up notepad then enter the following:
Code: [Select]Set objShell = CreateObject("Shell.Application") Set MyComp=objShell.NameSpace(17) Set CD=MyComp.ParseName("g:\") Set Context=CD.Verbs CD.InvokeVerb "E&ject"
'objshell.ShellExecute "g:" ,,,"E&ject" 'eg 'object.ShellExecute(sFile [,vArguments] [,vDirectory] [,vOperation] [,vShow]) Just replace the letter "g:" with the letter assigned to your CD-Rom drive. Save the text file with the extension .vbs. This works for ejecting but if you will have to close the drive manually.
|