1

I’ve seen a post of how %0|%0, but I’m still not very sure, is it a loop to loop it self or to open another file to run it again and delete it self?

Can it be looped in a batch file? I cannot use my pc right now to experiment.

Gerhard
  • 22,678
  • 7
  • 27
  • 43
David Wu
  • 49
  • 3

1 Answers1

1

You say: "I cannot use my pc right now to experiment".

Are you sure it is not: "I experiment with this, so I cannot use my pc right now". :)

Jokes aside, %0|%0 is pretty much a type of fork bomb.

| pipe takes the output of the first command and sends it to the next command after the pipe.

In this case of %0|%0 you are piping the batch-file to itself, creating a permanent recursive loop that will consume resources quickly and eventually crash your system.

to try illustrate what happens here.

let's say the batch file is dummy.cmd the %0|%0 will look like this:

D:\dummy.cmd | d:\dummy.cmd

launching this will start a loop where it launches itself repeatedly, similar to:

                                         dummy.cmd ..etc..             
                          dummy.cmd ->   dummy.cmd ..etc..       
             dummy.cmd ->
                                         dummy.cmd ..etc..
                          dummy.cmd ->   dummy.cmd ..etc..
dummy.cmd -> 
                          dummy.cmd ->   dummy.cmd ..etc..
             dummy.cmd ->                dummy.cmd ..etc..
          
                          dummy.cmd ->   dummy.cmd ..etc..
                                         dummy.cmd ..etc..

but what you need to understand is that it is not just the one process spawning another in a loop, each spawned process repeats itself again.. So the first process creates two more, these 2 each creates two more, these four creates two each, etc.

Each of the pipe actions forks to a cmd process internal to the initial process window.

So if you were lucky enough to run a tasklist while this is running, you will see the mess created in the background with the speed cmd processes are initiated.

See fork bomb as well.

Gerhard
  • 22,678
  • 7
  • 27
  • 43