Skip to content

Latest commit

 

History

History

Positional-Command-File

Different positional parameters in powershell and pwsh

In v5- powershell treated unknown arguments as a command line to execute. To align with POSIX so that things like shebang scripts work correctly, v6 changes powershell (now pwsh) so that it treats unknown arguments (aka positional argument) as a file.

As a result, commands that do not specify the parameter name -File or -Command explicitly may fail either in v5- or in v6+.

When v6+ PowerShell executable at some point became pwsh the issue is less likely, i.e. it is not possible to use same commands with Windows PowerShell v3-v5 and PowerShell Core v6+.