Windows 10控制台颜色不起作用(虚拟终端控件字符序列) [英] Windows 10 console colors not working (Virtual terminal control character sequences)

查看:294
本文介绍了Windows 10控制台颜色不起作用(虚拟终端控件字符序列)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Console的文本颜色在Windows 10 内部版本15063.296 中不起作用。

我已经对其进行了深入研究,发现自己迷路了。这就是我发现的所有内容...


从几次讨论中,似乎支持'虚拟终端序列''控制字符序列'在Windows 10的最新版本中已删除(


根据


新控制台


控制台虚拟终端序列msdn

ANSI.SYS历史文档

解决方案

到目前为止,我有修复 ,将新的 cmd_10.0.15063.0 替换为旧的 cmd_10.0.10586.0 我从旧系统复制而来。如果已运行Windows升级,则可能在 C:\Windows.old\Windows\System32\cmd.exe 中找到较旧的cmd版本。 (文件夹是隐藏的)



要替换系统的 cmd.exe ,您需要获取文件的所有权属性->安全->高级,顶部所有者:TrustedInstaller(更改),设置为管理员,然后在权限->中为管理员授予完全权限。更改权限->管理员->编辑->完全控制


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 typed from a file.

Old console

New console

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 older cmd_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 in C:\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 file Properties -> Security -> Advanced, there at the top Owner: TrustedInstaller (Change), set to Administrators, then give Administrators full permissions in Permissions -> Change permissions -> Administrators -> Edit -> Full control.

这篇关于Windows 10控制台颜色不起作用(虚拟终端控件字符序列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆