Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo Off & Setlocal DisableDelayedExpansion
- mode 170,40
- rem // Creates variable /AE = Ascii-27 escape code.
- For /F %%a in ('echo prompt $E ^| cmd')do set "/AE=%%a"
- (Set \n=^^^
- %=!Newline DNR!=%
- )
- Set "EOF=Pause > Nul & Endlocal & Endlocal & Goto :EOF" & rem // balance setlocal environment stacks
- rem // Usage: %Print%{Vt Color Sequence}{Y;X Position}{"text to be output"}
- Set Print=For %%n in (1 2)Do If %%n==2 (%\n%
- For /F "Delims=" %%G in ("!Args!")Do (%\n%
- For /F "Tokens=1,2,3 Delims={}" %%i in ("%%G")Do Set "Output=%/AE%[%%~im%/AE%[%%~jH%%~k%/AE%[0m"%\n%
- ^< Nul set /P "=!Output!"%\n%
- )%\n%
- Endlocal%\n%
- )Else Setlocal EnableDelayedExpansion ^& Set Args=
- Setlocal EnableDelayedExpansion
- rem // Usage example (complex)
- Set "Chars=1<2>3?4^5&6$7(8)9|0@"
- Set "[x1]=19 -2 1"& Set "[x2]=2 2 20"&Set "[y1]=20 -1 1"&Set "[y2]=0 1 20"
- Set /A [g1]=75,[g2]=170
- For %%v in (1 2) Do For /L %%Y in (![y%%v]!) Do for /L %%X in (![x%%v]!) Do %Print%{38;2;%%!!!!!%%v]!;%%X0}{%%Y;%%X}{"!Chars:~%%X,1!"}
- rem // exit script balancing environment stacks
- %EOF%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement