web analytics
Saturday, June 21, 2025
HomeHow-to GuidesHow to Hack Your CD Drive using VB Script Code

How to Hack Your CD Drive using VB Script Code

This trick forces the PC CD Drive tray to repeatedly open and close.

This trick is funny, and you may try it out on your friends or colleagues to surprise or panic them. Try this trick on their system without their attention and enjoy the reaction when the script starts running.

This trick forces the PC CD Drive tray to repeatedly open and close. You know how this is working, but when others see this, they will be surprised or panic and might wonder if their system got infected with some virus.

Suppose you try this on your friend’s PC in his absence; he will surely be surprised or anxious when he sees that his system is automatically opening and closing the CD Tray.

Basically, it is a VB Script code program that commands the system to open and close the CD Tray running in a loop. Consequently, this continues throughout the loop unless and until the script is closed or stopped from running.

Hack your CD drive using VB Script code

Follow the below simple steps using the VB Script Code:

1. Copy the below VB Script code and paste it into the Notepad.

Set TI = CreateObject("WMPlayer.OCX.7" )
Set CDROMCOL = TI.cdromCollection
if CDROMCOL.Count >= 1 then
do
For i = 0 to CDROMCOL.Count - 1
CDROMCOL.Item(i).Eject
Next ' CDTRAY
For i = 0 to CDROMCOL.Count - 1
CDROMCOL.Item(i).Eject
Next ' CDTRAY
loop
End If

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

Hack Cd Drive

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

image

3. Run the VB Script Code to Execute:

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

Now, if you want to take this trick further and want to annoy your friend more, load this script into the Startup folder of the system to run automatically whenever the system boots up.

Even if the system is restarted, it will again automatically run 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 the system will always keep running the script when the system boots up.

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

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

%userprofile%\Start Menu\Programs\Startup\

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

How to Stop the VB Script from Running:

For Windows XP:

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

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

hack cd drive

For Windows 10 and Windows 11 (All later versions of Windows XP) :

Open Task Manager by right-clicking on Taskbar and selecting “Task Manager.” Navigate to the Details Tab. Select “wscript.exe” and click on “End Task”. When popup confirmation is displayed, select “End Process”.

End WS Script process in windows 10

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

Note: This trick works great on a Desktop PC because the CD tray can close itself, but the CD tray does not close by itself on the laptop. Hence, it may not be exciting if running on a laptop device.


Enjoyed the article? Stay connected and never miss an update — follow us on social media for more tips, insights, and updates!

Roshan Karkera
Roshan Karkera
Roshan Karkera is a passionate blogger and a software engineer by profession, driven by a love for technology, science, and continuous learning. With a strong belief in sharing knowledge, he started this blog to inspire and inform readers through simple, insightful content. When he's not coding or exploring the latest in tech, you’ll find him writing about ideas that matter. Connect with him on Twitter or your favorite social platform to stay updated.
RELATED ARTICLES

8 COMMENTS

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

    • @dwoodward

      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
      do
      For i = 0 to CDROM.Count – 1
      CDROM.Item(i).Eject
      WScript.Sleep 180000
      Next ‘ CDTRAY
      loop
      End If

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular