Here's a bit of an orthogonal answer to this quite-old question. It's not an answer to the question as literally asked, but more about the "spirit" of the question. It's also not an answer that was even possible for years after the question was asked. But now, it may be useful for some subset of folks who come looking for this information (as I did today).
Since the original question pointed out how easy this is in *nix, I realized that with WSL (Windows Subsystem for Linux) installed, it's a no-brainer to just use the Linux
ls -lh from PowerShell:
PS> wsl ls -lh
... gives me the results I want (and it sounds like the OP did) on the current directory from within PowerShell. Better yet, if you have
exa installed in your WSL instance,
wsl exa -l is much prettier (and defaults to
Note that if you want a different directory, there's a bit of a "trick" when using the
wsl command. Since utilities running inside a WSL instance (such as
ls) only understand Linux paths, you can't do something like:
PS> wsl ls -lh C:\
Instead, there are two options. First, you can use the WSL equivalent of the Windows path. E.g.:
PS> wsl ls -lh /mnt/c
PS> wsl exa -l /mnt/c
Or, just set the directory for the WSL instance with the
--cd option, like so:
PS> wsl --cd C:\ ls -lh # or
PS> wsl --cd C:\ exa -l
This also works with relative directory paths:
PS> wsl --cd .. ls -lh # or
PS> wsl --cd .. exa -l
Don't worry (if you were) -- it's not going to change the current directory in PowerShell. When the WSL instance exits after running
ls command, PowerShell will retain its current environment; just like running a subshell (in either PowerShell or a Linux shell like Bash).
PowerShell and WSL are each great on their own, but putting the two together gives you something even more powerful.
P.S. This works with either WSL1 or WSL2, but if you are going to be handling a lot of Windows files in WSL, version 1 is (currently) an order of magnitude faster. WSL2 is faster when using the virtualized ext4 filesystem.