How to create ls in windows command prompt?

前端 未结 19 2264
一向
一向 2020-12-07 08:34

I want to use ls in windows command prompt and make it run the dir command.

How can I do that?

相关标签:
19条回答
  • 2020-12-07 09:04

    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.

    0 讨论(0)
  • 2020-12-07 09:04

    The most easiest way is

    • install git
    • add C:\Program Files\Git\usr\bin to your path variable

    now you can use ls

    0 讨论(0)
  • 2020-12-07 09:04

    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!

    0 讨论(0)
  • 2020-12-07 09:07

    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...

    0 讨论(0)
  • 2020-12-07 09:07

    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 =)

    0 讨论(0)
  • 2020-12-07 09:08

    Its an old question but for the record:

    http://gnuwin32.sourceforge.net/packages/coreutils.htm

    Gives you ls and a whole lot more!

    0 讨论(0)
提交回复
热议问题