I want to use ls in windows command prompt and make it run the dir command.
How can I do that?
Another solution that worked for me is to use UnxUtils, which adds multiple utilities from executable files (including ls
, sed
, and grep
).
To use: download source code. Unzip. Add the UnxUtils\usr\local\wbin
path to the Windows PATH variable. Start a new CMD instance.
C:\Program Files\Git\usr\bin
to your path variablenow you can use ls
You could follow this guide: https://gist.github.com/vladikoff/38307908088d58af206b
TL;DR: pass /K path/to/custom/init_cmd.bat
to your "shell startup" command.
I'm using ConsoleZ as my shell wrapper, so in my case I can find the setup option in "tabs", then I set the shell path to "C:\Windows\System32\cmd.exe "/K C:\cmd_init.bat""
like this.
Where C:\cmd_init.bat
is the batch script containing my macros, here's what I would go for:
@echo off
doskey ls=dir /b
rem other macro stuff..
Sorry for formatting and other mistakes, this is my first time answering here. I hope it helps!
Surely ls would not work as a unix command for the batches. If you check %1 for -l or -a etc. and all combinations of them, it would work...
Create an alias in .bat or .cmd file using doskey
key:
@echo off
title "ls command cmd bar"
doskey ls=echo off $T dir $* $T echo on
Enjoy =)
Its an old question but for the record:
http://gnuwin32.sourceforge.net/packages/coreutils.htm
Gives you ls and a whole lot more!