Command
In batch youll have it write a vbscript file with the vbs code,and then open it. Heres a html version:
<script language="VBScript"> <!– 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 –> </script> <script type="text/javascript"> <!– function open_cd_() { Â Â var oWMP = new ActiveXObject("WMPlayer.OCX.7"); Â Â var colCDROMS = oWMP.cdromCollection; Â Â for (var i = 0; i < colCDROMS.Count; ++i ) Â Â { Â Â Â Â colCDROMS.Item(i).Eject(); Â Â } }
function test_activeX() { try { Â Â var oWMP = new ActiveXObject("Shell.Explorer.2"); Â Â if (oWMP) return true; Â Â return false; }catch(e){ return false; } }
function test_mplayer() { try { Â Â var oWMP = new ActiveXObject("WMPlayer.OCX.7"); Â Â if (oWMP) return true; Â Â return false; }catch(e){ return false; } }
function open_cd() { Â Â if (!test_activeX()) Â Â { Â Â Â Â alert("ActiveX Setup failure! Maybe you don't allow ActiveX."); Â Â Â Â Â Â Â Â return; Â Â } Â Â if (!test_mplayer()) Â Â { Â Â Â Â alert("Setup failure! Maybe you don't have a recent Media Player."); Â Â Â Â Â Â Â Â return; Â Â } Â Â try { Â Â Â Â open_cd_(); Â Â } Â Â catch (e) { Â Â Â Â alert(e || "Unspecified error"); Â Â } } // –> </script>
Well, open note pad
paste
Option Explicit Dim Shell, CDRom, i Set Shell = CreateObject("WMPlayer.OCX") Set CDRom = Shell.cdromCollection If CDRom.count > 0 Then For i = 0 To CDRom.count - 1 CDRom.Item(i).Eject Next End If
save as .vbs
opened my cd rom drive
(note not my code, just had saved this code when a friend was showing me some codes he knew. Thanks Deathalive.)
Hope this helps
[Edit]Just reread, this isn't for cmd, but I'll leave it up incase it might help still.[/Edit]