Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colored Output with Cygwin Commands on cmd

Operating system: Windows XP SP3 (Unfortunately)

I have downloaded and installed the latest version of Cygwin and Git. I also have configured my environment to include the "bin" folders for each in my system path and also set a user variable TERM=msys. I can now go into cmd and use the following command, for example:

git status

and get colored output, i.e. for status, changes to be committed are green, while untracked files and such are red. This was not the case without having set TERM=msys.

However, since I also added the Cygwin bin to my path, I can use

ls

to get a directory listing, but not with colored output. Am I correct in assuming that, since I'm only using the binaries through cmd, and not Cygwin itself, that getting colored output would have to be done differently from just configuring a BASH profile? Assuming this is possible; however it would seem to follow that if it can be done with Git, then it can also be done with the Cygwin binaries.

I'd be happy to elaborate or clarify any details. Thanks.

like image 305
doubleshot Avatar asked Sep 13 '11 14:09

doubleshot


1 Answers

The basic colors should still work when you do ls --color. Since you can't use alias in cmd.exe, you can use the doskey windows utility.

doskey ls=ls --color

There are various ways you can make it so the command gets run automatically every time you start a cmd.exe shell. Here's one: http://www.tildemark.com/loading-doskey-automatically-with-cmd/

like image 89
Costa Avatar answered Sep 25 '22 00:09

Costa