ANSI Command Line Colors under Windows
🌳 Evergreen(?) planted in Tools and Resources ANSI Windows Command Line
460 words, 3 min read.
Coming from a linux and osx background, the one thing that I missed the most when using windows was ANSI command line colours within the command prompt. ANSI escape sequences are supported in at least in one form or another in most terminal emulators except for the win32 console component of Microsoft Windows. Fortunately there is a project on github adoxa/ansicon that adds support for ANSI escape sequences to the Windows console by wrapping it and adding interpreting the ANSI sequences.
As of writting version 1.66 is the latest release of ANSICON and can be obtained from the github repository here. There have been 16 commits to the master repository since the 1.66 release and if you know how to compile the project from source then you will be able to run with version 1.70.
To begin download and extract the ansi166.zip from github. Then, if you have a 32-bit version of Windows copy the
x86 directory to
x64 if you have 64-bit Windows. Next rename the copied directory to
ansicon then with it selected in file explorer hold the [shift] key and right click on the
ansicon directory to bring up the context menu. From the menu click open command window here.
ansicon.exe -i from the newly opened command window will install ansicon into your system; it can just as easily be un-installed by running with the
-u flag like so
Alternatively if you are unable to install ansicon due to restrictions placed upon your computer that are out of your control simply running
ansicon.exe will open a new command window wrapped by ansicon and supporting ANSI escape sequences.
Once you have completed either of the above methods you should now be able to enjoy coloured output of command line tools, for example composer:
Version 1.66 of ANSICON was released on the 19th September 2013 ↩︎
Version 1.70 of ANSICON was released on the 26th February 2014 but requires compiling from the supplied source. ↩︎
Alternatively you can do
cd C:\ansiconbut you probably already knew that… ↩︎
It does this by adding an entry to the autorun registry valye for
ansicon.exeis run directly it will load and wrap the command window as defined in the environment variable
%ComSpec%which is usually but not always