Hacker News new | ask | show | jobs
by zanecodes 1970 days ago
You can shorten any argument name in PowerShell, so long as it can be disambiguated:

    PS C:\> ls -di # same as Get-ChildItem -Directory; -d would pass the -Depth parameter instead
    

        Directory: C:\


    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----       2020-07-24     18:09                PerfLogs
    d-r---       2020-12-14     22:45                Program Files
    d-r---       2020-12-24     22:57                Program Files (x86)
    d-----       2020-07-23     11:29                temp
    d-r---       2020-07-24     14:19                Users
    d-----       2021-01-15     21:33                Windows
1 comments

  > ls -di # same as Get-ChildItem -Directory; -d would pass the -Depth parameter instead
Ouch, that is actually worse than I thought. So not only can you abbreviate parameters, but when the abbreviation is ambiguous Powershell just arbitrarily picks one instead of giving an error?