How do I....

ucGrad

Member
May 3, 2004
91
0
0
Hi All, I'm too used to linux that now I'm always typing ls instead of dir in Windows.
How can I make an ls command equal dir?

I've tried setting a new environment variable with: set ls = dir , but that makes %ls% = dir , not ls.

Thanks in advance for the help!
 

Apathetic

Platinum Member
Dec 23, 2002
2,587
6
81
Since "dir" is an "internal" command handled directly by the shell (there is no "dir.exe") I'm not sure how you could do it. You can find a bunch of the common unix tools for windows, though (e.g. ls, kill, grep, etc).

Dave
 

dullard

Elite Member
May 21, 2001
25,913
4,506
126
The easiest way is to go to any folder in your path and put this file there:

ls.bat

Inside the file put these three simple letters:

dir

That'll do the most simple directory listing for you. You could of course make this much more complicated if you want to (for different ls and dir options). Of course the better solution is to NOT do this and actually learn to be proficient at both.
 

ucGrad

Member
May 3, 2004
91
0
0
Originally posted by: dullard
The easiest way is to go to any folder in your path and put this file there:

ls.bat

Inside the file put these three simple letters:

dir

That'll do the most simple directory listing for you. You could of course make this much more complicated if you want to (for different ls and dir options). Of course the better solution is to NOT do this and actually learn to be proficient at both.

Thanks for the simple solution. I am pretty proficient at both. I grew up with MS-DOS then used Unix in college. 'ls' is just more habitual to me now that I just type it to list the directory without thinking 'what operating system am i on?'. 80% of the time I'm on a linux machine so there's no problem. the other 20% i'm in the the Windows command window.
 
Jan 31, 2002
40,819
2
0
Originally posted by: ucGrad
Originally posted by: dullard
The easiest way is to go to any folder in your path and put this file there:

ls.bat

Inside the file put these three simple letters:

dir

That'll do the most simple directory listing for you. You could of course make this much more complicated if you want to (for different ls and dir options). Of course the better solution is to NOT do this and actually learn to be proficient at both.

Thanks for the simple solution. I am pretty proficient at both. I grew up with MS-DOS then used Unix in college. 'ls' is just more habitual to me now that I just type it to list the directory without thinking 'what operating system am i on?'. 80% of the time I'm on a linux machine so there's no problem. the other 20% i'm in the the Windows command window.

For a little bit more usefulness, you can use

@dir %1 %2 %3 %4 %5 %6 %7 %8 %9

that way you can at least pass switches/filters/wildcards to DIR. My batch scripting is still way too rusty to even consider the huge remapping of Unix > DOS flags. :p

- M4H