如何在WinXP cmd shell中加载ANSI转义码或获取彩色文件列表?

时间:2022-06-26 06:00:39

This is related to this question : How to get coloured file listing in windows cmd shell ?

这与此问题有关:如何在windows cmd shell中获取彩色文件列表?

I'm trying to get, wouldn't you believe it, coloured file listing in windows cmd shell. Windows are XP SP2, if that matters.
In the old DOS days there used to be little programs like hdir, adir and such which displayed that nice. Nowadays, such programs are no more.

我试图得到,你不相信它,在Windows cmd shell中的彩色文件列表。 Windows是XP SP2,如果重要的话。在旧的DOS时代,曾经有过像hdir,adir这样的小程序,这些程序表现得很好。如今,此类计划已不复存在。

There is however, ls, from unixkit-tiny or unixtools. Unfortunatelly, it uses ANSI escape codes for displaying colours, and cmd doesn't handle those too well.

然而,有来自unixkit-tiny或unixtools的ls。不幸的是,它使用ANSI转义码来显示颜色,而cmd也不能很好地处理它们。

There are several solutions which include loading ansi.sys and command.com, but command.com doesn't handle long filenames that well, and is awfully slow. Even then sometimes it has problems displaying colours.

有几个解决方案,包括加载ansi.sys和command.com,但是command.com不能很好地处理长文件名,而且速度非常慢。即使这样,有时也会出现显示颜色的问题

So what I'm asking, is there a way to get coloured file listing in windows cmd shell, apart from using cygwin ? Or is there a way to get ANSI escape codes to work with cmd.exe in a way so that native ls will play nicely ?

所以我要问的是,除了使用cygwin之外,有没有办法在windows cmd shell中获得彩色文件列表?或者有没有办法让ANSI转义码以某种方式使用cmd.exe,以便本机ls可以很好地播放?

4 个解决方案

#1


I ran across ANSICON at http://adoxa.110mb.com/ansicon/index.html ansicon github repo

我在http://adoxa.110mb.com/ansicon/index.html ansicon github repo上遇到了ANSICON

Using it to colorize NAnt output. ls --color is being processed correctly.

用它来着色NAnt输出。 ls --color正在正确处理。

Source code is provided, but I haven't examined it.

提供了源代码,但我没有检查它。

#2


Actually I reckon A+ for ansicon -- Use

实际上我认为A +代表ansicon - 使用

  • ansicon.exe -I

Installs it as a filter on your CMD.exe sessions. Works a treat with HTTY (ruby gem).

将其安装为CMD.exe会话的过滤器。与HTTY(红宝石宝石)一起享受美食。

:-)

#3


You could start the builtin Telnet server, firewall it to only allow localhost access, and use a telnet client that understands such escapes - even the native one. (I know, an ugly hack.)

你可以启动内置的Telnet服务器,防火墙只允许本地主机访问,并使用一个了解这种转义的telnet客户端 - 甚至是本机的。 (我知道,这是一个丑陋的黑客。)

#4


It's possible to patch cmd.exe....

可以修补cmd.exe ....

http://gynvael.coldwind.pl/?id=130&lang=en

#1


I ran across ANSICON at http://adoxa.110mb.com/ansicon/index.html ansicon github repo

我在http://adoxa.110mb.com/ansicon/index.html ansicon github repo上遇到了ANSICON

Using it to colorize NAnt output. ls --color is being processed correctly.

用它来着色NAnt输出。 ls --color正在正确处理。

Source code is provided, but I haven't examined it.

提供了源代码,但我没有检查它。

#2


Actually I reckon A+ for ansicon -- Use

实际上我认为A +代表ansicon - 使用

  • ansicon.exe -I

Installs it as a filter on your CMD.exe sessions. Works a treat with HTTY (ruby gem).

将其安装为CMD.exe会话的过滤器。与HTTY(红宝石宝石)一起享受美食。

:-)

#3


You could start the builtin Telnet server, firewall it to only allow localhost access, and use a telnet client that understands such escapes - even the native one. (I know, an ugly hack.)

你可以启动内置的Telnet服务器,防火墙只允许本地主机访问,并使用一个了解这种转义的telnet客户端 - 甚至是本机的。 (我知道,这是一个丑陋的黑客。)

#4


It's possible to patch cmd.exe....

可以修补cmd.exe ....

http://gynvael.coldwind.pl/?id=130&lang=en