Skip to main content
added 722 characters in body; deleted 193 characters in body
Source Link
user2428118
  • 2.1k
  • 1
  • 20
  • 36

Batch, 31 bytes

@IF 0%1==01 echo 1&%0 1 @echo 0 
 

On my machine, running <script name> 1 twice from the command prompt caused CMD to crash. The first time it stopped after printing a lot of lines with 1s on it. (Presumably because of CMD running out of memory.)

Explanation

@ – This tells CMD not to print the commands on this line. (Output will still be printed.)
%1 – This will be substituted with the first argument given.
%0 – This will be substituted with the script name.

The first line will output 1s and then launch the script itself with an argument 1 if the script was called with the argument 1. Otherwise, the condition evaluates to false and the script will proceed to the second line. It will then output 0 and exit.

Batch, 31 bytes

@IF 0%1==01 echo 1&%0 1 @echo 0 
 

Batch, 31 bytes

@IF 0%1==01 echo 1&%0 1 @echo 0 

On my machine, running <script name> 1 twice from the command prompt caused CMD to crash. The first time it stopped after printing a lot of lines with 1s on it. (Presumably because of CMD running out of memory.)

Explanation

@ – This tells CMD not to print the commands on this line. (Output will still be printed.)
%1 – This will be substituted with the first argument given.
%0 – This will be substituted with the script name.

The first line will output 1s and then launch the script itself with an argument 1 if the script was called with the argument 1. Otherwise, the condition evaluates to false and the script will proceed to the second line. It will then output 0 and exit.

Source Link
user2428118
  • 2.1k
  • 1
  • 20
  • 36

Batch, 31 bytes

@IF 0%1==01 echo 1&%0 1 @echo 0