Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

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

2 Answers 2

up vote 4 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)

share|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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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