Introduction: Make an Annoying Program That Opens and Closes All Your Cd Drives

Picture of Make an Annoying Program That Opens and Closes All Your Cd Drives

this is my first Instructable so please tell me how I can improve.

this instructable tells you how to make an annoying program that opens and closes all your cd drives.

you will need:
a computer running windows

Step 1: Open Notepad

Picture of Open Notepad

first, open notepad
there are 2 ways I know of to do this
way 1:click the start button, go to programs or all programs, go to accessories click on notepad
way 2:hold down the windows key then press R then release the windows key, a box will pop up, in that box type notepad

Step 2: Type the Script

Picture of Type the Script

the notepad window should now be open
copy and paste the text below into notepad

Dim ts
Dim strDriveLetter
Dim intDriveLetter
Dim fs 'As Scripting.FileSystemObject
Const CDROM = 4
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
strDriveLetter = ""
For intDriveLetter = Asc("A") To Asc("Z")
If fs.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then
If Err.Number = 0 Then
strDriveLetter = Chr(intDriveLetter)
Exit For
End If
End If
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
For d = 0 to colCDROMs.Count - 1
Next 'null

For d = 0 to colCDROMs.Count - 1
Next 'null

set owmp = nothing
set colCDROMs = nothing

Step 3: Save and Test

save the file as cd.vbs on your desktop and double click it to run

Step 4: Make It Stop

press ctrl+alt+delete
open task manager
click processes
click wscript.exe
press end process


aidanjarosgrilli (author)2011-06-09

at a libray you run this program on ALL the computers and then leave.

I'v done something very similar at my library. I use other peoples codes to log into their system all of the time so one day i decided to do something stupid. The CD drives would pop open cause that's all that they could do, and then you couldn't close it cause it would just pop out again as soon as you are to close the CD drive :)

NathanF23 (author)StephenN22016-01-03

i did this using a different code which is Set oWMP = CreateObject("WMPlayer.OCX.7")

Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
For i = 0 to colCDROMs.Count - 1
End If
wscript.sleep 5000

how do i stop this one ?????

Joe Martin (author)2009-08-15

I've got a different version of this I made at college and it does it all silently and opens and closes it randomly, The only way you could stop it is to go into task manager, processes and then end the .vbs script. We also made one that flashes the caps, num and scroll lights and then another that presses caps lock randomly. It was worth the one week internet ban lol

nice, do you have the code for the caps lock flash?

mc_dude (author)2010-02-16

better yet put this on a cd along with a autorun.inf, and make a cd cover like (some awsome game for pc...) and when they put in the cd it spits it right back out =)

Lance Mt. (author)mc_dude2011-02-26

print trollface on the disk.

Jimmy Potter (author)2017-10-20

How to speed it up?

MegaM5 (author)2017-05-14

how can u open it and it stays open until u manually close it?

Pyrotelekinetic (author)2016-11-14

Not working on win 10...

worked for me. try it and check the code

did it, works, now gonna try do this at school or my sisters computer

Elliotd4 (author)2016-02-26


go to task manager and stop wscript.exe

ZebA2 (author)2017-01-10

How do i make this run quicker? do i change the 4 value to 1?

The king of utopia (author)2015-02-06

Can you make it so that it will start when the computer starts when the computer starts? And is it possible to set it so it opens every 5 minutes not every 10 seconds?

Yeah, write it into the startup files of the computer.

kelliemurray (author)2016-08-24

I tried this on my laptop.....didn't work. =/

Keerthivasan11 (author)2016-06-10

after i test it

Keerthivasan11 (author)2016-06-10

will it stop

ColeM26 (author)2016-04-13


KeeganR3 (author)2016-03-07

how do you edit this program to open every 5 hours or 6 hours?

CodyK5 (author)2016-01-19

I want to prank my wife and shes constantly got her laptop i don't know how to sneak it to her laptop without email or any means of flash drive ect.... i was wondering if there was a way i could spam her through a facebook message? or any thing like this.. ps thanks for the HERES YOUR COFFEE idea i tested it on mine and worked she loves coffee and this will be a wonderful wake up surprise!! XD

Flo0010 (author)2015-04-03

Hi, can someone please help me?
Always when I start the programm pop ups a window which says:
Syntaxerror Code: 800A03EA
The Error is on Line 8 the 9th Char

Thank You

Timothys2 (author)2015-01-26

Is there a way to change it from saying wscript in the task manager? I have a lot of simple programs like this one, and they all say wscript on them. I want to know if theres any way to change it at all.

ChrisN3 (author)2015-01-12

Can I add a message saying HERES YOUR FREE COFFEE everytime it opens???

jjbredesen (author)ChrisN32015-01-25

Yes you can, simply at this line at the beginning of the code before "do":


You can also make a file that only opens a message box like this:




SamL1 (author)2014-11-14

I did this but when I go to task manager "wscript.exe" isn't there. HELP ME!!! I can't play any of my games :(.

P.S: I'm on Windows 8.

HenrikH1 (author)SamL12014-11-20

in windows 8 its called: microsoft windows based script host

narutou1 (author)2014-10-16

Not sure if it still works after the computer is restarted but if your doing this to a friend put it in the startup folder.

C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

~Von Hohenheim

VallexKoten (author)2014-10-13

How do I get it to open, close, and open the disk, instead of just opening it once?

d1ndian (author)2011-06-08

like netbot

liam6058 (author)DavidRobertson2009-08-18

your one doesent work on xp

Lance Mt. (author)liam60582009-09-16

lol, nice comeback but its written in vbs, of course its going to work, besides i gotta give meeze credit, hes PRO and he did it first.

liam6058 (author)Lance Mt.2011-02-17

his only opens the cd drives if you close them
mine opens and closes them

Lance Mt. (author)liam60582011-02-26

Well then its fine! Innovates and adds.

indestructibleguy (author)2010-02-23

how do you make it stop? I was stupid enough to try it out on my computer during programming.

look on last step

abran5 (author)2010-12-23

But how do you make it stop???

liam6058 (author)abran52011-02-17

look on last step

christop (author)2011-02-10

This is a lot like a script I wrote in Linux:

while :; do eject -T /dev/cdrom; done

Needless to say, it doesn't close the tray on laptop drives (but neither will the Windows script either).

And of course, this script can easily run in the background as any other non-interactive programs can in Linux. :)

abran5 (author)2010-12-23

i made it to do it for 20 seconds

abran5 (author)2010-12-23

IT WORKS!!!!!!!!!! THX!!!!!!!!!!!!!!!

Berkin (author)2009-12-17

It's making both by drives open and close one after one!

Thanks a million!

jamiec53 (author)2009-10-24
zack247 (author)2009-09-30

this is fun

matstermind (author)2009-08-22

how do i get it to repeat?

The Ideanator (author)2009-08-14

pretty funny, now make it do it randomly and have it run in the background, no one will know unless they know their stuff with windows

As far as I know, you can't run visual basic in the background. You should investigate python. The *.pyw extension makes it run without a terminal.

About This Instructable




More by liam6058:make an annoying program that opens and closes all your cd drives
Add instructable to: