web analytics
Home / How-to Guides / How to Hack Your Cd Drive using VB Script Code

How to Hack Your Cd Drive using VB Script Code

This is a cool and very funny trick that can get your friends or colleagues surprised or make them panic, when you try this on their system without their attention. This trick force PC CD Drive tray to get open and closed repeatedly, you know how this is working but if your friends see this, he/she will get surprised or panic and might start wondering that system has been infected with some virus, or has been hacked.

Suppose, if you try this on your friend’s PC in his absence, he will surely be surprised or anxious when he watches that his system is automatically opening and closing CD Tray. Basically, it is a VB Script code  program which is written to command the system to open and close the CD Tray, that is running in a loop. Consequently, this keeps on going throughout the loop unless and until the script is closed or stopped from running.

Copy the below code to notepad and save it as cdvirus or any name, but it should end with .vbs extension, for e.g. save as Cd Virus.vbs.

Hack your CD drive using VB Script code

Follow the below simple Steps:

1. Copy the below VB Script code and paste in notepad.

Set TI = CreateObject("WMPlayer.OCX.7" )
Set CDROM = TI.cdromCollection
if CDROM.Count >= 1 then
For i = 0 to CDROM.Count - 1
For i = 0 to CDROM.Count - 1
End If

2. Now, Save the file by any name but should end with an extension as .vbs

Hack Cd Drive

Once File is created and saved, the file will look similar as shown in the screenshot.


3. Run the VB Script Code to Execute:

Now double-click on .vbs file, and you should see that the system is automatically opening and closing CD tray repeatedly. To stop the script from running, simply restart the PC or stop the script from Task Manager.

Now, if you want to take this trick more further and want to annoy your friend more. Load this script into Startup folder of the system, so whenever system boots up, this script will run automatically. Even if the system is restarted, it will again automatically run as when the system is booting up. However, once you are over with the prank, make sure you remove the script from the startup folder or else system will always keep running the script when the system boots.

Follow the below steps to copy the script in startup folder:

1. Open Run Dialog Box, and paste the below directory path to Run dialog box to open Startup folder.

%userprofile%\Start Menu\Programs\Startup\

2. Now, Copy the Script vbs file and paste into the startup folder.

How the below steps to Stop the Script from Running:

To stop the script, open task manager (Ctrl + Alt + Del), now go to process and find the name with “wscript.exe, select wscript.exe and Click on End Process.

hack drive

Message box will pop up asking, “Are you sure you want to terminate the process” Click on Yes.

hack cd drive

This will terminate the script program and eventually will stop CD Tray from opening and closing the CD tray door. Furthermore, remove it from the startup folder if copied in the startup folder else it will load automatically on every windows boot.

Credit Goes to Original writer of the VB Script code

For latest Updates on Techie Inspire, Subscribe to Techie Inspire

About Kroshan

Roshan Karkera a.k.a. k.roshan. Blogger by passion and software engineer by profession. He believes in sharing knowledge, which made him to start his own blog. He is very much keen & passionate about new technology & Science. If you'd like to connect with him, follow at Google plus or Twitter.
  • John

    Thanks this is great
    its working

  • seema

    cool i love this
    i will sure try on my friend pc
    Thanks Dj roshan

  • anatheras

    i named it cdvirus.vbs Notice NAMED IT i cant save it as .vbs cause i can only choose .txt or all files
    plz help me

  • Dj roshan

    Its very simple
    just type any name with extension .vbs Remove that .txt written there and type xyz.vbs
    And SAVE…
    Its done

  • Anonymous

    I love it!! and it realy works 😀


  • mohit

    Cool Trick Mast Hai

  • dwoodward

    how do you put a time on it so it opens exactly every 3 minutes

    • Kroshan


      You can use WScript.Sleep 180000 in the code to run exactly every 3 min. Below is the complete code.

      Set TI = CreateObject(“WMPlayer.OCX.7” )
      Set CDROM = TI.cdromCollection
      if CDROM.Count >= 1 then
      For i = 0 to CDROM.Count – 1
      WScript.Sleep 180000
      Next ‘ CDTRAY
      End If