loading
This is my first instructable, so take it easy, and feel free to recommend any changes in future instructables.

In this instructable I will show you how to write various visual basic scripts (vbs) and batchfiles (bat), as well as how to interconnect the two, so to speak.  All of the example viruses are safe to run on your computer, however some of them (will be clearly stated) may crash your computer just by opening up too many windows at once.

I will provide both the source code and instructions on how to create/run/disable all of these viruses.  It is highly recommended that you read an entire step before trying to execute one of these, as some of them can be hard to stop.  At the same time, I assure you none of them will ruin your computer.  Of course, I take no responsibility for any of your actions, and if you write the code wrong and it does ruin your machine, that is not my fault, and I cannot be held accountable.  For any of the code throughout the entire instructable, just copy and paste.  It will save you a lot of time.

Please note that I am doing all of these on Windows XP, and some the commands may not be the same on other operating systems.  Anyway, enough of this gibberish, let's get to scripting!

Step 1: Basic VBS Messages

First off, I will show you many examples of different styles of error messages that can be useful for conveying different ideas or pranking different people.

Open notepad (if you don't know where that is, just go start->run and type "notepad.exe" without the quotes and hit enter).  Here are the different error codes and what they do.  By the way, just edit the original and change the number, as retyping all of these would take a LONG time.

text=msgbox ("Message",0,"Title")     -This is a basic message with a beep and an ok button.
text=msgbox ("Message",1,"Title")     -This adds a cancel button to the first one.
text=msgbox ("Message",2,"Title")     -This has buttons "abort", "retry", and "ignore", and the beep.
text=msgbox ("Message",3,"Title")     -Has buttons "yes", "no", and "cancel".
text=msgbox ("Message",4,"Title")     -Just the yes/no
text=msgbox ("Message",5,"Title")     -Retry/cancel
6 through 15 are exactly the same as 0
text=msgbox ("Message",16,"Title")     -This is the angry beep error message version of 0.
text=msgbox ("Message",17,"Title")     -16 with cancel button
text=msgbox ("Message",18,"Title")     -16 with abort/retry/ignore
Starting to detect a trend here?  It continues on like that.
text=msgbox ("Message",48,"Title")     -Different beep, and a yellow caution sign, with ok button.
Continues normal pattern from there.
At 64 we get a different beep and a question mark icon.

I know this is very boring, so I'll cut short here.
To run this, first save it as whatever.vbs  - make sure to select all file types, and not text files.
Then, just double click the vbs icon where you saved it.

Of course, you can change the message and the title to whatever you want.

Lastly, you can create loops in vbs like so:

do
msgbox "Hi"
loop

This is an infinite loop, but you can stop it with task manager.  Just go to processes and end the wscript.exe process.

Step 2: Basic Batchfiles

Batchfiles open a cmd window, also known as command prompt.  You can do many things with batchfiles that cannot be done with vbs files, so I always like to use a mix of both (which we'll cover later).

Open notepad again, or just remove the code from the previous step, and type the following:

@echo off          -This just tells the computer to not display the directory when you open the batchfile.
title Batchfile     -Any title you want
color 0a             -First digit is background color, second is text (this is green on black) (zero through F)
pause                -If you don't include this, the window will close instantly.

All this does is open a cmd window and says "press any key to continue......", and when you press a key, it closes.  You can mess around with the colors if you want.

Here are some basic cmd commands to add functionality to your batchfile.  Add any of them between the color line and pause:

echo Message     -Displays "Message"
dir     - displays the various folders in your main directory
dir/s     -goes through all folders and subfolders in the directory where the batchfile is located
dir/b     -removes header and other stuff (basic)
set     -displays lots of info about your computer
netstat -an     -displays all current tcp/ip connections and listening ports in numerical form
note: you can remove "n" if you don't want numerical form.
ipconfig /all     -displays info about your computer's ip address and host/server/default gateway, etc.
tracert     -traces route to specified ip address (put ip after "tracert " -with the space.
ping     -tests connection time to send a data packet to specified ip and get it back.  Put ip after.
start batchfile.bat     -starts a file called batchfile.bat (if it exists)

IMPORTANT NOTE: the above command, if typed in a file called batchfile.bat, will create an infinite loop, because each time it opens the window, the start command is re-executed and it opens another window - without closing the previous!  This WILL crash your computer if you don't hold down ctrl + c, which stops the code and closes them one by one.  Task manager won't help you.  However, don't fret.  Even if you crash your computer with this, it won't cause damage.  Just kill it with the power button before it gets too out of hand, let is sit for a minute, and boot it back up.

echo H
ping localhost -n .5 >nul        -these two lines send "H" to the computer you are on.

:1                                       -this creates an infinite loop of "Hi", which can also be stopped with ctrl + c
echo Hi
goto 1                                -you can use the goto loop for any command, but be cautious.

There are thousands of commands for batchfiles and command prompt, and I cannot go over them all here.

Step 3: Combining VBS and Batchfiles, and Opening Files

First of all, you are going to want both the vbs file and the batchfile in the same folder, or both on your desktop, or whatever, but they have to be in the same directory.

Now, you can initialize just about anything from a vbs file, including batchfiles, so we'll do it that way.  There are much more complex ways of doing it, but I won't go into that here.

To start, you will need to create a shell script.  It's easier than it may sound.  Just type the following as the first line of you .vbs file:

set wshshell = wscript.CreateObject("wscript.shell")

Now you can do all sorts of things with your script.  For examlpe, ghost typing (I'll get to batchfile initialization in a minute):

set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "Notepad"
wscript.sleep 2000
wshshell.AppActivate "Notepad"
wshshell.sendkeys"H"
wscript.sleep 145
wshshell.sendkeys"i"

This program will open notepad, wait a second or so, type H, wait a fraction of a second, and then type i.  Very fun for creeping people out, making them think someone has hacked their computer and started typing.

To open a batchfile called batchfile.bat, for example, type:

wshshell.run "batchfile.bat"

It's as simple as that.  You can open anything.  Now, to open a webpage, you're going to need to use the batchfile.  Just type the following to open google:

start www.google.com

You can use this for any url.  And it doesn't matter if you have the http:// part or not.  Either way works.

Step 4: Two Fake Viruses

Here are two examples of fake, harmless viruses that I created.  Feel free to test them out, they won't hurt you, just follow the instructions at the bottom of this step for closing/canceling the virus.

Example 1:

prank.vbs:

set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "Notepad"
wscript.sleep 2000
wshshell.AppActivate "Notepad"
wshshell.sendkeys"A"
wscript.sleep 145
wshshell.sendkeys"l"
wscript.sleep 101
wshshell.sendkeys"l"
wscript.sleep 125
wshshell.sendkeys" "
wscript.sleep 250
wshshell.sendkeys"y"
wscript.sleep 150
wshshell.sendkeys"o"
wscript.sleep 130
wshshell.sendkeys"u"
wscript.sleep 161
wshshell.sendkeys"r"
wscript.sleep 140
wshshell.sendkeys" "
wscript.sleep 185
wshshell.sendkeys"b"
wscript.sleep 150
wshshell.sendkeys"a"
wscript.sleep 112
wshshell.sendkeys"s"
wscript.sleep 136
wshshell.sendkeys"e"
wscript.sleep 145
wshshell.sendkeys" "
wscript.sleep 130
wshshell.sendkeys"a"
wscript.sleep 190
wshshell.sendkeys"e"
wscript.sleep 108
wshshell.sendkeys"r"
wscript.sleep 250
wshshell.sendkeys"{bs}"
wscript.sleep 90
wshshell.sendkeys"{bs}"
wscript.sleep 108
wshshell.sendkeys"r"
wscript.sleep 250
wshshell.sendkeys"e"
wscript.sleep 190
wshshell.sendkeys" "
wscript.sleep 130
wshshell.sendkeys"b"
wscript.sleep 161
wshshell.sendkeys"e"
wscript.sleep 140
wshshell.sendkeys"l"
wscript.sleep 152
wshshell.sendkeys"o"
wscript.sleep 150
wshshell.sendkeys"n"
wscript.sleep 129
wshshell.sendkeys"g"
wscript.sleep 200
wshshell.sendkeys" "
wscript.sleep 130
wshshell.sendkeys"t"
wscript.sleep 161
wshshell.sendkeys"o"
wscript.sleep 140
wshshell.sendkeys" "
wscript.sleep 118
wshshell.sendkeys"u"
wscript.sleep 150
wshshell.sendkeys"s"
wscript.sleep 250
wshshell.sendkeys"!"
wscript.sleep 500
wshshell.sendkeys" "
wscript.sleep 200
wshshell.sendkeys":"
wscript.sleep 300
wshshell.sendkeys"P"
wscript.sleep 500
wshshell.run "virus.bat"
wscript.sleep 700
text=msgbox("All Your Base Are Belong To Us",16,"You Have A Virus")
text=msgbox("Do you want to delete the virus?",20,"You Have A Virus")
text=msgbox("All Your Base Are Belong To Us",16,"Access Denied")
text=msgbox("All Your Base Are Belong To Us",16,"Access Denied")
text=msgbox("All Your Base Are Belong To Us",16,"Access Denied")
text=msgbox("Please wait while the virus is cloned repeatedly",16,"Cloning Virus")
wshshell.run "message.bat"
wshshell.run "batchfile.bat"
do
text=msgbox("And I win!",16,"You Lose")
loop

--------------------------------------------------------
virus.bat:

@echo off
title All Your Base Are Belong To Us
color 0a
cd..
cd..
cd..
:1
dir/s
goto 1

--------------------------------------------------------
message.bat:

echo off
title Greetings, Victim
color 04
do
echo You Have A Virus
ping localhost -n .5 >nul
loop
pause

-------------------------------------------------------
batchfile.bat:

start batchfile.bat

-------------------------------------------------------

NOTE:  This has the one I warned you about, start batchfile.bat in batchfile.bat.  Only run this if you know what you're doing!  Btw, cd.. in the virus.bat file goes up a directory path in cmd, which means you broaden your scope.  This will loop through all the files and folders on your computer continuously.  Very annoying, but it won't hurt anything.  And just remember these are all separate files in the same folder.  Also, the first thing this prank virus does is ghost type "All your base are belong to us", even with a typo and some backspaces to correct it, making it all the more believable that your victim was hacked.  It also has variable rates of typing, as indicated by the varying values for sleep.

Example 2:

prank2.vbs:

set wshshell = wscript.CreateObject("wscript.shell")
msgbox "Don't"
msgbox "You"
msgbox "Hate"
msgbox "It"
msgbox "When"
msgbox "This"
msgbox "Happens?"
wshshell.run "test.vbs"

----------------------------------------------------
test.vbs:

strSoundFile = "C:\fakevirusprank2\magicwrd.wav"
Set objShell = CreateObject("Wscript.Shell")
text=msgbox ("Do you want a puppy?",52,"Free Puppy")
do
strCommand = "sndrec32 /play " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, False
Wscript.Sleep 500
text=msgbox ("You didn't say the magic word",16,"You Do Not Get A Puppy")
loop

--------------------------------------------------
NOTE: The directory of the first line of test.vbs is wherever your sound file is.  My sound file is the Jurassic Park "Uhn uhn uhn, you forgot to say the magic word", and it loops, so it's really funny and annoying.  The first part displays a different message box each time they click ok OR close the window, then runs the second file.  The second file asks the victim if they want a puppy, no matter what they click, yes, no, or close, they get the Jurassic Park wave audio file and a corresponding error message.

All right, to disable the first one, undoubtedly the more dangerous of the two, first hold down ctrl + c right after the cmd windows start filling the screen.  Delay and you may be too late on some older computers.  Once it's stopped. close all the cmd windows individually and then open task manager.  You will need to end the process called "wscript.exe" that I mentioned earlier.  Then close anything else still open, and you don't need to save the text file ;)

To disable the second one, just open task manager and end wscript.exe.  Close everything that's open.  Piece of cake.

Step 5: Final Notes and Ideas

It is important to note that not all machines are created equal.  Some Operating Systems will use different commands, the ones I used were all Windows XP, and also work on many other Windows versions and some of them on Mac Linux.  If you are having trouble getting something to work, comment about it below, and I will help you as best I can.  You can also find a lot of this information on google and youtube.

Again, I take no responsibility for any harm that may come to your computer, as following my instructions correctly and carefully will not harm your machine.

If you have any ideas, questions, recommendations, suggestions, problems, curiosities, etc., feel free to comment below.  Just be descriptive and try not to misspell too much ;)  Please share with your friends!  (And prank them with these!)
<p>I tried the test.vbs, but I get an error message saying this:</p><p>Script: C:\Users\(my name)\Desktop\test.vbs</p><p>Line: 6</p><p>Char: 2</p><p>Error: The system could not find the file specified.</p><p>Code:80070002</p><p>Source: (null)</p><p>I checked the code and it's referring to this line:</p><p>objShell.Run strCommand, 0, False</p><p>What file is it talking about?</p>
im not sure where i've gone wrong with my script,... but it's not opening my file. If you could just look over my script and tell me my fault that'd be great.<br>set wshshell = wscript.CreateObject(&quot;wscript.shell&quot;)<br>wshshell.run &quot;Notepad&quot;<br>wscript.sleep 2000<br>wshshell.AppActivate &quot;Notepad&quot;<br>wshshell.sendkeys&quot;Y&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;o&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;u&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot; &quot;<br>wscript.sleep 300<br>wshshell.sendkeys&quot;A&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;r&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;e&quot;<br>wscript.sleep 300<br>wshshell.sendkeys&quot; &quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;B&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;e&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;i&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;n&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;g&quot;<br>wscript.sleep 300<br>wshshell.sendkeys&quot; &quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;H&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;a&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;c&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;k&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;e&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;d,&quot;<br>wscript.sleep 300<br>wshshell.sendkeys&quot; &quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;B&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;e&quot;<br>wscript.sleep 300<br>wshshell.sendkeys&quot; &quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;A&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;f&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;r&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;a&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;i&quot;<br>wscript.sleep 145<br>wshshell.sendkeys&quot;d&quot;<br>wscript.sleep 1000<br>wshshell.run&quot;Fake trojan.bat&quot;
i tried to type in the wshshell.run &quot;batchfile.bat&quot; command in a vbscript but it wouldn't run my file? (i made a shutdown batch file named shutdown.bat so i replaced batchfile.bat with shutdown.bat) plz help! im using a windows xp computer so it should work but instead i get a popup message saying i typed in an incorrect script command. is there anything i missed out on?
Just name it something other than Shutdown.bat<br>In the order of how windows looks for file extensions, com and exe files come before .bat, so it is running the internal shutdown command and not your shutdown.bat file
Are the two files in the same directory (folder)? If you reference a file from another directory vbs has no idea what you're saying. If it is in the same folder or both on the desktop or whatever it should work.
yeah both the files are in the desktop folder. i did some more internet surfing and found another script that works but i want it to be short and simple like yours so i could remember it more easily. here's the script i found <br><br>dim shell<br>set shell=createobject(&quot;wscript.shell&quot;)<br>shell.run &quot;batchfile.bat&quot;<br>set shell=nothing<br><br>i use windows xp sp3 if that may have a problem with the coding.
is the wshshell.run &quot;batchfile.bat&quot; command just a small part of a bigger command and i didn't read the directions carefully or is the command just that small?
Ahhhh it is part of a larger command sorry, I misunderstood your question at first. You need to have the set wshshell = wscript.CreateObject(&quot;wscript.shell&quot;) in there for it to work so like this:<br><br>set wshshell = wscript.CreateObject(&quot;wscript.shell&quot;)<br>wshshell.run &quot;batchfile.bat&quot;<br><br>and you could do it like theirs and replace wshshell with shell to make it shorter but as you can see it is already shorter than theirs.
Thank you soo much it worked now. i thought that the <br>set wshshell = wscript.createobject(&quot;wscript.shell&quot;) command was just for the send keys code. thanks greatly for your help i greatly appreciate it :D
Oh and now that I think of it, silly me, there is a one line version of this. It invloves two batchfiles instead of one .bat and one .vbs. Just make sure both are in the same folder (or both on the desktop) and then for the other batchfile (not the one named batchfile.bat) just type:<br><br>start batchfile.bat<br><br>No quotes, just as simple as that. Save it as whatever.bat<br><br>But for the .vbs it needs to have a shell in order to run files from it.
LOL ur awesome man u trueley are :D
thank you :) but remember I learned everything I know about scripting from other people or from experimenting myself, so you too can learn whatever you want about any language, visual basic script, batchfiles, C++, Python, or whatever.
And to answer your other question I have sp3 now too and have for a while so no that's not having an effect on it.
Lame I know but how do I give this to someone ?
Well if they were dumb enough to follow instructions you could send them an email with all the files zipped together and tell them to unzip it and open prank.vbs but I doubt they would comply lol...
For some reason when I ran this, all went well until it said &quot;do&quot; is not a reconized command and it did the same for &quot;loop&quot;. I am using Windows 7, any ideas? Oh and thanks for this instuctable by the way! Very informative.
You could try this: replace do with a: replace loop with goto a See if that works, otherwise I'm not sure why the do loop doesn't work in Windows 7. Seems very odd. Also different computers come with different versions of VBS, so it is possible that your version does not support the do... loop command. I've looked on google a little and haven't found any reason for it not to work on Windows 7, but it does appear that only the newest versions of VBS are supported for that Operating System. Please let me know if that solution works, if not, I will try and figure out what the problem is.

About This Instructable

29,724views

15favorites

License:

Bio: All your base are belong to us.
More by geekvig:Comprehensive VBS And Batchfile Tutorial - Beginner To Advanced 
Add instructable to: