Skip to main content

How to Make a Harmless Funny 'Virus' Prank in Notepad (CD Eject)

Writing a script in a text editor

Short answer: you can make a harmless joke script in Notepad that keeps popping open the CD/DVD drive, great for a laugh on a friend's PC that has an optical drive. It is a few lines of VBScript, changes nothing, and stops the moment you close it. Here is the code, how it works, how to stop it, and the safety line you must not cross.

A note before you prank anyone

This is only funny on a computer you have permission to use, and only harmless because it changes nothing. Do not run scripts on someone's work machine or anywhere it could cause real trouble. A prank that annoys a friend for ten seconds is fine; one that disrupts someone's work is not.

The CD-eject prank code

  1. Open Notepad.
  2. Paste this:
Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
do
  if colCDROMs.Count >= 1 then
    For i = 0 to colCDROMs.Count - 1
      colCDROMs.Item(i).Eject
    Next
  End If
  wscript.sleep 5000
loop
  1. Save it as prank.vbs (choose "All files" so it does not save as .txt).
  2. Double-click it. Every five seconds, any optical drive pops open. Push it back in and it opens again.

How it works

  • It creates a Windows Media Player object to access the CD-ROM collection.
  • The do ... loop runs forever, ejecting each drive it finds.
  • wscript.sleep 5000 waits five seconds between each eject.

It only sends the "eject" command, the same one the drive's own button does, so nothing is harmed.

How to stop it (important)

Because it loops forever, it will not stop on its own:

  1. Open Task Manager (Ctrl+Shift+Esc).
  2. Find Microsoft Windows Based Script Host (wscript.exe).
  3. Select it and click End task.

The ejecting stops immediately, and nothing is left running or changed.

The non-obvious safety point

This prank is harmless, but it lives in the same .vbs format that real malware uses. That is exactly why you should never double-click a .vbs file someone sends you, even as a "joke". Type these yourself from a source you trust and read what each line does. Most modern laptops also lack an optical drive, so on those this simply does nothing, no harm at all.

Frequently asked questions

How do I make a harmless funny virus in Notepad?

Paste the provided VBScript into Notepad, save it as prank.vbs (All files type), and run it. It keeps ejecting the CD/DVD drive and changes nothing.

How do I stop the CD-eject prank?

Open Task Manager, find Microsoft Windows Based Script Host (wscript.exe), select it and click End task. It stops immediately.

Is the Notepad eject prank actually a virus?

No. It only sends the normal eject command in a loop and harms nothing. It is a joke script, not real malware.

Is it safe to run .vbs files people send me?

No. Never double-click a .vbs from someone else, even as a joke, since the format can run real malicious commands. Only run scripts you wrote or understand.

Comments

Popular posts from this blog

How to Completely Uninstall Programs on Windows (Free Tools and Tips)

Short answer: you do not need a cracked Revo Uninstaller Pro, because Revo has a capable free version and there are free open-source alternatives that remove programs completely, leftover files and registry entries included. Here is how to uninstall cleanly and why leftovers matter. Why leftovers are a problem Windows' built-in uninstaller often leaves behind folders, registry keys and startup entries. Over time these accumulate, clutter your system, and occasionally cause conflicts when you reinstall software. A dedicated uninstaller sweeps them up. Free tools that remove programs completely Revo Uninstaller Free , uninstalls the program, then scans for and removes leftover files and registry entries. The free version covers what most people need. Bulk Crap Uninstaller , free, open source, and excellent for removing many programs at once and cleaning leftovers. How to uninstall cleanly with Revo Free Open Revo and select the program. Click Uninstall; let the progra...

How to Recover Deleted Files for Free (Better Than a Cracked Tool)

Short answer: you do not need a cracked 7-Data Recovery serial, because excellent free tools like Recuva and PhotoRec recover deleted files, and the most important factor is not the software at all, it is stopping use of the drive immediately. Here is how to recover files the safe, effective way. The one rule that decides success: stop using the drive When you delete a file, the data is not erased, the space is just marked reusable. The moment you keep saving new files, you risk overwriting the deleted data permanently. So the instant you realize something is gone: stop using that drive . Do not install recovery software onto it either, download it to a different drive or USB stick. The best free recovery tools Recuva , free, friendly, great for recovering deleted documents, photos and files from Windows drives and USB sticks. PhotoRec , free and open source, extremely powerful, especially for photos and media, though its interface is basic. Windows File History / backups , ...

How to Transfer Contacts Between Phones the Easy Way (2026)

Short answer: The easiest way to move contacts is to sync them to a cloud account first. Save contacts to your Google account on Android or iCloud on iPhone, then sign in to that same account on the new phone and they appear automatically. For everything else, export a vCard (.vcf) file and import it. Every time I set up a new phone the very first thing I want back is my contacts. Years ago this meant fiddly SIM copies and desktop software. These days I almost never touch a cable. Here are the modern methods I actually use, ranked from easiest to most manual. Method 1: Google account sync (best for Android) If your contacts are saved to your Google account rather than the phone itself, switching Android phones is basically automatic. On the old phone, open Settings > Accounts > Google and confirm Contacts sync is on. Wait a minute for the sync to finish, or tap the three-dot menu and choose Sync now . On the new phone, sign in with the same Google account during setup....