'
Is it thee the obfuscator who brings to us another of your riddles ?
jeb wrote:My cat walks over my keyboard (again).
And I was supprised, that the code still works
, it prints
It seems that my cat knows some very strange batch tricks.
But is there anybody, who can explain how it works?
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set LF=^
set ^"-=:-)^
^% ;-) %^
% 8-( %^^
%lf:^=!LF!%!LF:^
&"=<&^|>!"
set ^"+=Why?This echo It works^^^^^^^^^^!"
(%-%%+%)
jeb
My imagination tickled, the answer missing.
Thy must speak out loud and remove all doubt !
But let's try it on:
it looks like
Then this line
expands to
My theory: 'Why?This' as label and 'echo It works^^!)' as command on a newline.
Now there is something special about the brackets, they are not even.
The 2nd bracket becomes part of the label which evens them out.
Then there are the outer brackets, I haven't figured this one out yet
Without jokes
Code: Select all
@echo on &prompt $G
setlocal EnableDelayedExpansion
set LF=^
set ^"-=:=^^^%LF%%LF%^%LF%%LF%"
set ^"+=Why?This echo It works^^^^^^^^^^!"
(
%-%%+%
)
set ""
pause
exit
it looks like
same effect.
Something similar,
the self initializing label also by jeb's cat ( what do you feed that beast ?? )
Code: Select all
< :label <nul %( null )% rem^ >nul &echo It works^^^^^^^^^^!
Would be interestingly faster if the redirections could be eliminated
Code: Select all
@echo on &prompt $G
setlocal EnableDelayedExpansion
set LF=^
:label^%LF%%LF% echo.this doesn't work.
pause
exit
But this doesn't work, and the label can only be found if it is not in a variable, as far as I know.
ed