I play with the new (limited) VT-100 escape sequences support in the Windows 10 console. Supported sequences are documented at https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85 ) .aspx .
I use batch files to test functions, and I can get almost all of the documented functions to work. But I am having problems with the "View Positioning" sequences (scroll up / down). In my hands they are completely dysfunctional (no effect).
ESC[<n>S - Scroll Up <n> lines
ESC[<n>T - Scroll Down <n> lines
Can someone make them work under any circumstances, or is the MS documentation just wrong?
In addition, there are standard query sequences that MicroSoft has not documented, but seems to work.
In particular, I am interested in the following sequence, reporting the current cursor position.
ESC[6n - responds with ESC[<n>;<m>R,
where <n> is the row number, and <m> the column number
The answer is transmitted as keyboard input and appears on the screen, but I have no idea how to programmatically use this information. Ideally I would like to get the values <n>and <m>environment variables from a batch file.
But if anyone can demonstrate how to capture variables using any language, then I can use this knowledge to develop an effective batch file strategy.
I can get closer to the next simple script called ANSI.BAT
@echo off
setlocal enableDelayedExpansion
for /f "delims=" %%C in (
'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo(0x1B"'
) do set "esc=%%C"
set "csi=%esc%["
echo(Inquiry:%csi%6n
set /p "pos="
echo response=!pos:%esc%=ESC!
- CONCLUSION -
C:\test>ansi
Inquiry:
^[[3;9R
response=ESC[3;9R
C:\test>
, FOR/F, . , , - <Enter> , , SET/P. , ...
EDIT - : , , . , , , .