2021年3月29日星期一

How to list all files in a folder (do cmd's `dir /a`) in PowerShell?

In cmd you can run C:\path> dir /a, it will list you all the files in a folder (including the hidden .git/ directory for example).

You can run dir in cmd and PowerShell.

You can run dir /a in cmd, but can't run dir /a in PowerShell. It will complain : powershell error pic

Similarly, in PowerShell, you can run PS C:\path> ls like in Linux bash, but you can't run ls -a like in all Linux or la like in Ubuntu.

Why is this? I mean why would Microsoft implement things so partially ? So how to list ALL files in a folder in PowerShell, like dir /a in cmd or ls -a in bash?

And am I experiencing this because I am still running these in Windows 7 or is it the same on Windows 10?

https://stackoverflow.com/questions/66859219/how-to-list-all-files-in-a-folder-do-cmds-dir-a-in-powershell March 30, 2021 at 01:57AM

没有评论:

发表评论