windows 如何在 Windows7 64 位命令终端中识别 ansi 颜色转义码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2294281/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:58:23  来源:igfitidea点击:

How to recognize ansi color escape codes in Windows7 64 bit command terminal

windowscommand-promptansiwindows-7-x64

提问by VanRaizen

I have tried Ansicon and I still cannot get ansi escape sequences to become recognized and interpreted in my CMD.EXE command prompt on Windows 7 64 bit. Has anyone been able to work this correctly and get a colorized console with this OS?

我已经尝试过 Ansicon,但仍然无法在 Windows 7 64 位的 CMD.EXE 命令提示符中识别和解释 ansi 转义序列。有没有人能够正确工作并使用此操作系统获得彩色控制台?

回答by Marco Tolk

I ran into the same problem today, and found a workaround.

我今天遇到了同样的问题,并找到了解决方法。

The commandline utility Windows ANSI Colordetects ANSI color codes and sets the corresponding console color.

命令行实用程序Windows ANSI Color检测 ANSI 颜色代码并设置相应的控制台颜色。

Example:

例子:

myapp.bat | wac

where wac is the Windows ANSI color utility

其中 wac 是 Windows ANSI 颜色实用程序

回答by Steve Gury

Ansicon use dll injection in order to enable ansi color in cmd.exe, which is disabled with the standard user privileges.

Ansicon 使用 dll 注入来启用 cmd.exe 中的 ansi 颜色,该功能在标准用户权限下被禁用。

Try launching ansicon with "run as administrator" (right click)

尝试使用“以管理员身份运行”启动 ansicon(右键单击)

回答by Zoltan

I've played a lot with this, and the best console for me is FarManager on Windows. http://www.farmanager.com/

我玩了很多这个,对我来说最好的控制台是 Windows 上的 FarManager。http://www.farmanager.com/

It's a file manager, but with CTRL+O you will get the console, and very handy with full support of ANSI, autocomplete, etc.

它是一个文件管理器,但使用 CTRL+O 您将获得控制台,并且非常方便,完全支持 ANSI、自动完成等。

回答by Tracker1

ANSICON(source) seems to work fine for me...

ANSICON源代码)似乎对我来说很好用......

  • Put ansicon somewhere you intend to keep it...
  • Run ANSICON -I
  • Close the terminal
  • Open a new one...
  • 将 ansicon 放在您打算保留它的地方...
  • ANSICON -I
  • 关闭终端
  • 开一个新的...