86

I have an older laptop running Windows Vista, from about 2005 and I was fooling around with it a little bit. In a moment of sheer stupidity, I created a Batch file and put the following code in it:

%0|%0

I ran this and I had to restart my laptop. However, I decided to continue upon this destructive path and put the Batch file in the Windows Startup folder. Now I can't login without it destroying my laptop.

How can I remove this forkbomb from the Startup folder?

5 Answers5

74

How to remove a forkbomb from the Startup folder?

Start your PC in "Safe Mode" (Startup programs do not run in safe mode, and only the basic drivers needed to start Windows are installed).

Then you can delete the offending batch file.


How To Start Windows Vista in Safe Mode

  1. To begin entering Windows Vista Safe Mode, turn on or restart your PC.

  2. You will see the Splash Screen

  3. Before the Windows Vista splash screen appears, press F8 to enter "Advanced Boot Options"

  4. Select "Safe Mode" and press Enter

Screenshots:

enter image description here

**strong text**

Source How To Start Windows Vista in Safe Mode

DavidPostill
  • 162,382
19

You can skip loading the contents of the Startup folder by holding down Shift as the computer starts and logs in. (Note that this doesn't work for startup applications loaded from the Registry or other locations, only the actual Startup folder.)

9

Try booting your laptop in Safe Mode by pressing F8 during the bootup sequence, from there, just locate the file in your Startup folder and delete it.

If you're worried about accidentally opening it, or something similar, you can boot up in Safe Mode with Command Prompt (Provided you can use Command Prompt), and delete it that way, instead.

Even safer than that would be to take the hard drive out and connect it to a machine that cannot open a batch file, thus unable to reactivate the sequence, and remove it that way.

If that's unavailable, you could always try and re-image the drive.

Quill
  • 308
7

Your best bet is to boot into Safe Mode or to a recovery disk or a linux live CD and remove it.

To boot to Safe Mode go ahead and I believe hit F8. Here's instructions, but the big thing is to strike F8 mid-boot.

The command to delete a file in Windows is del and in Linux is rm. Note in Linux you may be better off doing it though their file manager since if you don't know Linux you'll have to mount the disk and all that. The recovery console command prompt is what you'll want in the Windows disk.

Quill
  • 308
5

In addition to the other answers: if by some chance, your problem lies in the registry (for instance, as in @isanae's comment on the accepted answer), you can edit the registry offline either by booting to another install of your version of Windows, or by using a setup/WinPE environment CD.

In short, open up the registry editor in your alternate OS (from WinPE or a setup disc, you can press Ctrl+F10 to open up a command prompt, then enter "regedit"). From there, you can create a new node in the registry tree, then use File -> Load Hive to choose the corresponding files for offline registry editing as follows:

[HKEY_LOCAL_MACHINE\SYSTEM] (%windir%/system32/config/SYSTEM)

[HKEY_LOCAL_MACHINE\SOFTWARE] (%windir%/system32/config/SOFTWARE)

[HKEY_USERS.Default] (%windir%/system32/config/DEFAULT)

[HKEY_CURRENT_USER] (%userprofile%/ntuser.dat)

From here, you can make whatever edits you need (SOFTWARE\Microsoft\Windows\CurrentVersion\Run, for example, holds your startup programs), and then save/close the hive you opened back to the same file.

Shamtam
  • 295