Page 1 of 1

A quine?

Posted: 25 Sep 2012 00:04
by spatters
Is this cheating?:

Code: Select all

@type %0

Re: A quine?

Posted: 25 Sep 2012 00:09
by foxidrive
When you launch a batch file by typing the name then %0 only contains what you typed.

This is more robust:

Code: Select all

@echo off
echo "%~f0"
type "%~f0"

Re: A quine?

Posted: 25 Sep 2012 01:20
by spatters
Sure. But if you type the full name of the batch file this works. Apparently it is okay to specify how the batch file should be called, judging by the quine page. Also judging by that page, brevity matters. If robustness is a goal you could do this:

Code: Select all

@type "%~dfx0"

Re: A quine?

Posted: 03 Oct 2013 14:56
by spatters
According to Wikipedia it is indeed cheating:

http://en.wikipedia.org/wiki/Quine_(computing)

Thanks to DigitalSnow answering this on another thread