Search code examples
powershelldirectoryformatted

Is there a PowerShell equivalent to the dir /w of the old Windows command prompt?


In the older Windows command prompt dir /w formatted the directory output in wide format, providing a more at-a-glance view of contents to pick out folder names without having to scroll through the larger output that happens when they are all stacked vertically. This is especially useful when in VS Codes integrated terminal where the terminal window size is often restricted. Does PowerShell have an equivilent?


Solution

  • This final, and my preferred, solution involves creating a function in my Powershell profile:

    function List-Wide
    {
        Get-ChildItem | Format-Wide -Column 5
    }
    

    Then, further down in my profile script, setting an alias to call this function:

    Set-Alias -Name lsw -Value List-Wide