I want to use ls in windows command prompt and make it run the dir command.
How can I do that?
You could:
ls.bat
and have it contain the dir
command onlyls.bat
file exists to your PATH
environment variableYou could then execute ls
from a command prompt.
If you just want to have cmd recognize ls
as an alias for dir
, you can use the doskey
command (from this answer on superuser).
This does not change the original command line parameter handling of the dir command.
You can solve this question with one simple command:
echo @dir %* > %systemroot%\system32\ls.bat
Make sure you run cmd.exe
as admin first if you are on vista and up
Easiest way I have found is:
bin
directory of Git to your Path variable. Mine was located in C:\Program Files\Git\usr\bin
.ls
in all its glory.you could also use cygwin and just use the ls command directly along with all the other unix command line tools you might be used to.
If you have Node.js installed on your system, you can install it from Cash, a library I wrote for Linux commands on Windows:
npm install cash-ls -g