LS instead of DIR for Windows
Are you used to using the command ls in Linux, BSD and Mac OSX? Do you keep typing ls instead of dir in Windows? Well, you’ll be glad to know there is a simple solution to ease your burden. A submission to the Internet show Hak5 (episode 1019) suggested creating a file called ls.cmd which contained only the word dir and placing it in the c:\windows directory. Now, when you type ls it automatic replaces it with dir.
This alas has a bit of a glaring problem. If you typed ls *.bat it would only run dir not the logical expectation of dir *.bat. However, with a small re-write this is possible since the suggestion was basically a Windows batch file (.bat) and can come with a host of other commands.
So, I did a minor re-write which maintains some of the common parameters which are shared by both directory listing tools.
@echo off
dir %1 %2 %3 %4 %5 %6 %7 %8 %9
This new file saved as ls.bat (I’ll call a spoon, a spoon, thanks) now executes dir and passes parameters. So if you type ls *.bat you get dir *.bat as expected.
There are a lot of other improvements to make like changing ls parameters into the dir equivalent. But that is a project for another day.


