如何在 WinXP cmd shell 中加载 ANSI 转义码或获取彩色文件列表? [英] How to load ANSI escape codes or get coloured file listing in WinXP cmd shell?

查看:24
本文介绍了如何在 WinXP cmd shell 中加载 ANSI 转义码或获取彩色文件列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我正在尝试获取 windows cmd shell 中的彩色文件列表,你相信吗?如果重要的话,Windows 是 XP SP2.
在过去的 DOS 时代,曾经有像 hdir、adir 之类的小程序,它们显示的很好.如今,此类程序已不复存在.

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.

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

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.

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

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.

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

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 ?

推荐答案

我在 http://adoxa.110mb.com/ansicon/index.html ansicon github回购

使用它为 NAnt 输出着色.ls --color 正在正确处理.

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

提供了源代码,但我没有检查过.

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

这篇关于如何在 WinXP cmd shell 中加载 ANSI 转义码或获取彩色文件列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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