Last active
October 22, 2019 16:37
-
-
Save sleepless-p03t/1d29dac5b814d1f84d41ca20943e54df to your computer and use it in GitHub Desktop.
Batch roundabout sys32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Patterns for setting and expanding variables, based on a depth of 5 | |
:: V(n) is a set representing the variable depth | |
:: V(0) = 0 | |
:: V(1) = 1 | |
:: V(2) = !1 -> V(2-1) * 3 - 2 = 1 * 3 - 2 = 1 | |
:: V(3) = !5 -> V(3-1) * 3 + 2 = 1 * 3 + 2 = 5 | |
:: V(4) = !13 -> V(4-1) * 3 - 2 = 5 * 3 - 2 = 13 | |
:: V(n) = V(n-1) * 3 - 2; n is even; n > 1 | |
:: V(n) = V(n-1) * 3 + 2; n is odd; n > 1 | |
:: E(n) is a set representing variable expansion depth | |
:: E(0) = !(1) | |
:: E(1) = 3 -> E(1-1) * 2 + 1 = 1 * 2 + 1 = 3 | |
:: E(2) = 7 -> E(2-1) * 2 + 1 = 3 * 2 + 1 = 7 | |
:: E(3) = 15 -> E(3-1) * 2 + 1 = 7 * 2 + 1 = 15 | |
:: E(4) = 31 -> E(4-1) * 2 + 1 = 15 * 2 + 1 = 31 | |
:: E(n) = E(n-1) * 2 + 1; n > 0 | |
:: Level 3 | |
echo Level 3: | |
setlocal EnableDelayedExpansion | |
set a0=win | |
set %a0%=sys | |
call set !%a0%!=dir | |
call call set x=!a0!%%%a0%%%%%%%%%%a0%%%%%%% | |
for /f %%n in ('call echo %%%x%%%') do ( | |
echo %%n | |
) | |
echo. | |
echo Level 4: | |
:: Level 4 | |
setlocal EnableDelayedExpansion | |
set a0=wi | |
set %a0%=n | |
call set !%a0%!=sys | |
call call set !%%%%%a0%%%%%!=dir | |
call call call set x=!a0!%%%a0%%%%%%%%%%a0%%%%%%%%%%%%%%%%%%%%%%a0%%%%%%%%%%%%%%% | |
for /f %%n in ('call echo %%%x%%%') do ( | |
echo %%n | |
) | |
echo. | |
echo Level 5: | |
:: Level 5 | |
setlocal EnableDelayedExpansion | |
set a0=w | |
set %a0%=i | |
call set !%a0%!=n | |
call call set !%%%%%a0%%%%%!=sys | |
call call call set !%%%%%%%%%%%%%a0%%%%%%%%%%%%%!=dir | |
call call call call set x=!a0!%%%a0%%%%%%%%%%a0%%%%%%%%%%%%%%%%%%%%%%a0%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%a0%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
for /f %%n in ('call echo %%%x%%%') do ( | |
echo %%n | |
) | |
exit /B | |
:: Result %%n is the value of winsysdir in every instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment