Skip to main content
Commonmark migration
Source Link

#DOS Batch — the answer to life, the Universe and everything

DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ ping 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it, and wait 75 seconds:

> answer
42

#DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ ping 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it, and wait 75 seconds:

> answer
42

DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ ping 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it, and wait 75 seconds:

> answer
42
edited body
Source Link
user15259
user15259

#DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ echoping 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it, and wait 75 seconds:

> answer
42

#DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ echo 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it:

> answer
42

#DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ ping 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it, and wait 75 seconds:

> answer
42
Removed dependency on CRLF terminated lines!
Source Link
user15259
user15259

#DOS Batch — 38, but that's not the actual length ofanswer to life, the code (hintUniverse and everything

Thanks to mynameiscoffey for his simplification!)

Save in NotePad as questionanswer.bat, with a carriage return after each line:

@ pingecho 127.0.0.1 -n 76 >nul
  && @ echo %~z0

Then run it:

> questionanswer
42

If you don't get this answer, confirm the following:

  • are you using NotePad and not NotePad++ or WordPad?
  • did you enter a carriage return after each line?

The true answer awaits...

#DOS Batch — 38, but that's not the actual length of the code (hint!)

Save in NotePad as question.bat, with a carriage return after each line:

@ ping 127.0.0.1 -n 76 >nul
 @ echo %~z0

Then run it:

> question
42

If you don't get this answer, confirm the following:

  • are you using NotePad and not NotePad++ or WordPad?
  • did you enter a carriage return after each line?

The true answer awaits...

#DOS Batch — the answer to life, the Universe and everything

Thanks to mynameiscoffey for his simplification!

Save as answer.bat:

@ echo 127.0.0.1 -n 76 >nul && @ echo %~z0

Then run it:

> answer
42
Found out why people are getting 40!
Source Link
user15259
user15259
Loading
Alternate for NotePad++ users.
Source Link
user15259
user15259
Loading
added 35 characters in body
Source Link
user15259
user15259
Loading
Notepad only...
Source Link
user15259
user15259
Loading
Alternate for weird Windows not using CR/LF line endings?
Source Link
user15259
user15259
Loading
added 2 characters in body
Source Link
user15259
user15259
Loading
Source Link
user15259
user15259
Loading