Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Take Command (Environment) doesn't show v2 ANSI colors

May
80
0
Obviously in Windows 10 CU (1703), the TCMD environment doesn't display 256 or 24bit colors that conhost on its own displays. I've tried it with TCC21, TCC20, CMD and PowerShell. In all cases, instead of displaying colors, black was displayed.

  • TCC:
    Code:
    echo %@char[27][48;2;139;0;139mtest
  • PowerShell:
    Code:
    Write-Host (([char]27)+"[48;2;139;0;139mtest")
  • CMD: (^[ means [Ctrl]+[Left Bracket])
    Code:
    echo ^[[48;2;139;0;139mtest
When running as standalone apps (with pure conhost), all of the above display the correct colors.

When running inside the Take Command Environment, the same apps display empty lines (black on black, I'd guess)

The "v2" in the title refers to Conhostv2.dll, the new Console Host that came with Windows 10 Creators Update (1703).
 
Last edited:
Do you have ANSI turned on in Tcmd? In the TakeCommand Options dialog, under the 'Tabs' tab, in the Windows section, make sure the checkbox next to 'ANSI Colors' is checked.
 
Yes, I do. Both in TCC and TCE. I also tried all 4 combinations.

EDIT: In PowerShell, it's more obvious. If ANSI is off, the actual escape character is displayed. If (TCE) ANSI is on, the escape character is parsed, but it has no effect.
 
It should only be set in one of them. I have it set in TakeCommand. And I have this statement in my TCSTART.btm file:
Code:
iff %_tctab == 0 then
  option //ANSI=Yes
endiff
 
  1. If you disable ANSI in TCC and enable it in TCE, ANSI parsing is completely ignored. As I said, I tried all combinations.
  2. In any case, this doesn't explain the fact that it doesn't work in PowerShell.

EDIT: I neglected to post my software versions:

Code:
TCC  21.00.32 x64   Windows 10 [Version 10.0.15063]
TCC Build 32   Windows 10 Build 15063
 
How are you getting ANSI support in CMD and PS? It's a feature of TCC and TCMD. But AFAIK, it is not built in to CMD or PS.
 
As I said, Windows 10 Creators Update.

The new conhost has better support for ANSI than TCMD/TCC ever had. In addition to a 256 palette color (ESC [ 38/48; 5 ) and full 24-bit color (ESC [38/48; 2), it also has support for DEC Line Drawing, underlining, positioning etc. I think that MS has implemented the whole VT100/VT220 manual, just because they had a manual in front of them and forgot to stop :smile:
 
I have disabled it in both but all I get inside TCMD (by which I man the Take Command Environment), are the escape codes as raw text. With ANSI=No
I get that both tin Take Command Environment and standalone (Conhost-ed) Take Command Console.

upload_2017-6-22_18-39-6.png


upload_2017-6-22_18-40-8.png


upload_2017-6-22_18-41-6.png
 
The third picture shows exactly that ANSI codes are enabled in my Windows console (conhost). It's a pure cmd.exe

Here's its settings for reference:

upload_2017-6-22_19-14-9.png
 
Just a programming question. If an extended color is shown in a TCC console, can you tell the color after reading the console out buffer?
 
So there are no APIs? Do you know if there will ever be? I read that the console must be put in "VT" mode. Is there an API for that?
 
So there are no APIs? Do you know if there will ever be? I read that the console must be put in "VT" mode. Is there an API for that?

I don't know if there will ever be - Microsoft says they're working on Windows support (they already have *some* Linux support for the 256 / 24-bit color console). There is an API to turn the ANSI on and off. But that's it for now.
 
So there are no APIs? Do you know if there will ever be? I read that the console must be put in "VT" mode. Is there an API for that?

The API to enable VT input is part of SetConsoleMode. Just set ENABLE_VIRTUAL_TERMINAL_INPUT. There's also an example in the master page.
 
they already have *some* Linux support for the 256 / 24-bit color console

I recently found out they have even implemented the DEC Drawing Line mode - they don't have *some* Linux support, they have implemented the full VT100/VT220 manual!
 
TCC supports the extended colors in a console window, but you can't do it in a TCMD tab window, because TCMD has no way of knowing what those colors are. (TCMD looks at the screen buffer attributes, which are 16-color only, to determine the colors to display.)

Can COLORDIR be extended to use the additional colors? (if this was indeed announced, I missed the memo).
 
Just to reiterate: The only way I could make TCC (not TCMD/TCE, as apparently it doesn't support 24-bit or 256-palette color) is through this:

upload_2017-6-25_14-1-33.png


Code to reproduce:

Code:
for /l %i in (0,1,255) do (echos %@char[27][48;5;%im%@char[32]%@char[27][0m & if (%i GT 8 .and. %@eval[%i mod 12] == 3) echo.)

With ANSI=No (which should mean that ANSI is handled through Windows Conhostv2.dll), the result is this:

upload_2017-6-25_15-8-38.png
 
Just to reiterate: The only way I could make TCC (not TCMD/TCE, as apparently it doesn't support 24-bit or 256-palette color) is through this:

With ANSI=No (which should mean that ANSI is handled through Windows Conhostv2.dll), the result is this:

In Windows 10, ANSI is *always* handled through conhost. The only difference is that if you set ANSI on in TCC, it checks to see if it's running Win 10 Creators update, and if so it turns off its internal ANSI and sets the ANSI flag in SetConsoleMode (if you didn't already set it).
 
If I activate ANSI within Win 10 (Legacy = Off) then I have display problems as described here:

https://jpsoft.com/forums/threads/problem-if-command-prompt-is-not-legacy.8080/

You cannot use the Windows 10 ANSI in TCMD, because Microsoft hasn't provided any APIs yet.

If you're having a problem with ANSI in TCC, then you need to contact Microsoft, because it's 100% their code. TCC just sets the Windows 10 flag requesting ANSI support, and conhost does all of the work.
 
Aha, okay, I see NOW. Sorry that I didn't understand first. I should read a thread more carefully next time, really!

Thank you!
 
BTW: some official Windows 10 Creator versions (AS MINE 15063 1703) are still buggy for ANSI codes. So I can set a color prompt in pure CMD console but I can't display this for example:

Code:
echo ^e[31;1mERROR: Script ^e[35;1m"Acc. [Administrator] Info.btm"^e[31;1m LÄUFT BEREITS ODER wurde INKORREKT BEENDET!^e[0m
Others with the same build can display such things - weird ... maybe it has to do with the digits behind the build-no. so mine is 15063.447 or related to the language version (mine is de_CH) or because NVIDIA driver or or or whatever ;-) ...
 
Last edited:
BTW: some official Windows 10 Creator versions (AS MINE 15063 1703) are still buggy for ANSI codes.

Mine definitely is. However, I've found a workaround!

It turns out that you can disable ANSI processing within Windows 10 Creator, using a registry setting.
In HKEY_CURRENT_USER\Console, there is a REG_DWORD setting called "ForceV2".
Set it to zero and reboot. Restart TCmd or TCC and re-enable ANSI. Voila! You get the JpSoft limited (but correct) ANSI processing!

Disable_ANSI.png



ObDisclaimer:
I have not tried this in TCmd v.21 yet since I haven't upgraded yet. (I'm between jobs, and conserving funds.) But it does seem to work nicely with previous versions.

regards,
- forbin
 
Back
Top
[FOX] Ultimate Translator
Translate