Share this page 

Eject CD/DVD using VBS or Powershell Tag(s): WSH VBScript


[VBS]
Set oSH = CreateObject("Shell.Application")
Set oNS=oSH.NameSpace(17)
Set oCD=oNS.ParseName("F:")
oCD.InvokeVerb "Eject"
Wscript.sleep 3000
[Powershell one-liner (useful in a batch file)]
powershell "(new-object -COM Shell.Application).NameSpace(17).ParseName('F:').InvokeVerb('Eject')"

For a Powerbuilder solution, see this HowTo.