I'm using ls (from Msys) on Windows. By default, ls doesn't colour-code directories and archives, but that's something I want. I'm tired of typing "ls -C" and "ls --color". Is there any way apart from setting up a bash script that will let me do this. (Remember, I'm on Windows)

link|improve this question
This may be of some relevance stackoverflow.com/questions/946546/… – ldigas Oct 14 '09 at 16:52
feedback

2 Answers

up vote 3 down vote accepted
doskey ls=ls --color $*

doskey is built-in, even!

I have a startup .bat file that acts as sort-of a .bashrc, and throw all my aliases in there, as well as having a small Python script to manage them more easily. cmd is really very bearable with a few additional tools (Cygwin goes a long way, just add its \bin to your PATH)

link|improve this answer
Um... how do I get this to work permanently with all instances of cmd.exe? – aviraldg Oct 14 '09 at 17:24
1  
That's what the .config file is for. HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Autorun (make it if it doesn't exist), and point that towards a .bat. This means you can very easily configure ANY variable without actually making any changes that aren't very easy to reverse. Make sure to add an @ECHO OFF so it doesn't tell you what you're doing every time you start a prompt :) – Phoshi Oct 14 '09 at 17:29
1  
Well, it does what it should, but it silently chops off all other arguments to ls – aviraldg Oct 14 '09 at 17:39
aaaand this is why I use a python script. Append a $* (means "all arguments", like %* in a batch file), and sorry for missing it out! – Phoshi Oct 14 '09 at 18:16
feedback

Instead of typing ls --color, you could define a bash alias:

alias ls='ls --color'

This would produce ls --color each time you write ls.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.