#4578 shows that you can sometimes use --prefixed bareword as parameter values - namely only if the bareword happens not to (prefix)-match a parameter name of the target command - and when such barewords are recognized as values, they don't behave the same way as non---prefixed barewords with respect to interpolation and being recognized as a single argument.
This inconsistency is problematic.
Given, @lzybkr's comment at #4576 (comment)
The "workaround" is in my opinion the preferred style - use quotes.
it seems that the desired solution is to disallow --prefixed barewords as values and to always assume that such an unquoted --prefixed token is a parameter name.
# Currently interpreted as *value*, because no Write-Output parameter name starts with -z.
# This should no longer be supported.
> Write-Output -InputObject -z
-z
# Interpreted as *parameter name*, because -n prefix-matches parameter -NoEnumeration
> Write-Output -InputObject -n
Write-Output : Missing an argument for parameter 'InputObject'. Specify a parameter of type 'System.Management.Automation.PSObject[]' and try again.
Environment data
PowerShell Core v6.0.0-beta.5
#4578 shows that you can sometimes use
--prefixed bareword as parameter values - namely only if the bareword happens not to (prefix)-match a parameter name of the target command - and when such barewords are recognized as values, they don't behave the same way as non---prefixed barewords with respect to interpolation and being recognized as a single argument.This inconsistency is problematic.
Given, @lzybkr's comment at #4576 (comment)
it seems that the desired solution is to disallow
--prefixed barewords as values and to always assume that such an unquoted--prefixed token is a parameter name.Environment data