I am retiring this website. Please visit my new blog here for all things tech-related: goo.gl/d7D1J

Friday, April 10, 2009

VBS - Open CD/DVD Drive Repeatedly

This code makes the CD/DVD tray open and close repeatedly until shutdown.

(Or you could just press ctrl + alt + delete>processes>end wscript.exe. Save this as .vbs.

Set oWMP = CreateObject(”WMPlayer.OCX.7″ )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
do
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ‘ cdrom
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ‘ cdrom
loop
end if

No comments:

Post a Comment

Web Analytics