Console's text colors are not working in Windows 10 build 15063.296
.
I have dug into it a bit and found myself lost. Here's everything I've found...
From several discussions, it seems that the support for 'Virtual terminal sequences' or 'control character sequences' was removed in recent versions of Windows 10 (#1, #2). Some also adviced to downgrade a git version (that didn't work for me).
I tried to copy a cmd.exe
from my other machine, the version was 10.0.10586.0
and the coloring worked, however, upon further reading and experimenting, I am no longer sure where the problem lies.
See compared the outputs of ls --color=auto
git\git-cmd.exe
, git\git-bash.exe
, windows' original cmd.exe
and older cmd.exe
According to this site, the support for coloring does not lie in a command window, but in a conhost.exe
, which brings up the question --Why does it work in some consoles and in some not?
If you start powershell.exe from cmd.exe, it will inherit the conhost settings since it’s attaching to a previously created console, not allocating a new one; this also enables escape sequences in powershell.exe.
Given this quote, I tried the following that only deepened my confusion.
I run a ls --color=auto
command in each cmd version, then tried running older cmd from newer and vice versa and got the following results.
(red underline is cmd v15063
, green underline is cmd v10586
)
old, new from old
new, old from new
/EDIT I've made few more experiments...
What is interesting/confusing is the different result of type
and cat
and a compared result of ls --color=auto
with the same content type
d from a file.
Console Virtual Terminal Sequences msdn
ANSI.SYS historical documentation
As for now, I have "fixed" it by replacing the newer
cmd_10.0.15063.0
with the oldercmd_10.0.10586.0
that I copied from my old system. If you have run a windows upgrade, you may find an older cmd version inC:\Windows.old\Windows\System32\cmd.exe
. (the folder is hidden)To replace the system's
cmd.exe
you will need to take ownership of the fileProperties -> Security -> Advanced
, there at the topOwner: TrustedInstaller (Change)
, set toAdministrators
, then give Administrators full permissions inPermissions -> Change permissions -> Administrators -> Edit -> Full control
.