Home > Tips > How to eject and close CD Drive using VBscript

How to eject and close CD Drive using VBscript

After reading labnol post, I felt why only Unix and why not windows. I did some search over internet and finally could able to tailer this script.

It works fine if you have only one CD-Drive. If you have multiple CD drives, then explore the options of the Object I am using in this script.

Set oWMP = CreateObject("WMPlayer.OCX.7" )Set ArrCDROM = oWMP.cdromCollectionwhile (1)wscript.sleep 3000ArrCDROM.Item(0).Ejectwscript.sleep 3000ArrCDROM.Item(0).Ejectwend

Write in comments section if you need any more clarity.

Happy learning..,
Sitaram Pamarthi

Tags: Vbscript for ejecting CD-Drive, CD-Drive eject command, eject CD drive from command prompt.

Categories: Tips
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>