Setting up Windows to use ls like dir

After spending a lot of time with the unix command line you can get used to simply using the ls command to list the files in the current directory, it can be annoying when the option is suddenly not there on the Windows. Using the cd command to traverse through directories is the same, so it is a bit jarring when suddenly ls does not work.

Fortunately I was able to find a simple way to fix this from Stack Overflow. This approach maps the ls command to the dir, and is so simple that the file to do so can be created with a single statement on the command line.

echo dir %1 > %systemroot%\system32\ls.bat

This statement will create a new bat file that is always visible and will replace ls with dir behind the scenes. Now you can just use the ls command without having to think about what operating system you are running.