Don't know if this helps anyone, but I have a couple of programs that, while
compiled for native Win32 (GnuWin32's ls.exe, for instance), still output
colored text using ANSI escape sequences. (Which is just jibberish to cmd.exe)
Anyways, using the DLL supplied by
can hook into PyCmd's console, and the output will come out just the same as
it would on Linux. (Without affecting cmd.exe's output)
Code snippet for your init.py file below:
handle = ctypes.windll.kernel32.LoadLibraryW(u'ANSI32.dll') # Or ANSI64.dll on x64 processors.
if not handle and not quiet:
print 'Failed to load ANSI-compatibility layer.'
An alternative is to run ansicon.exe with pycmd.exe as its argument (I haven't
actually checked this with pycmd but I've used this approach before with other
I often look through many diffs and server logs. In server logs I try to find messages only from certain classes. I wrote two python scripts. First colors diffs. Second finds words I need and colors them. This scripts helps me very much. But it starting is very uncomfortable. Now I have found PyCmd (Zinc in future) and will try to inject my code to it.
I believe, this feature will be very useful for many peoples if it be able natively. Especcially if it will have support main formats, easy rules definition and capability of changing needed words or phrases without stopping server (e.g. in config file).
For exaple, try to find messages from RolesInterceptor here
I am not sure if I fully understand your idea; what you describe feels like a feature of the "console" (i.e. the terminal window) rather than of the "shell".
In other words, I think the cleanest way is to enhance a console replacement like Console2 (https://sourceforge.net/projects/console/) to automatically color the buffer contents based on some user-defined rules....