You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Typo in Get-Foo cmdlet" instead of "Typo."
Verify Version: If there is a mismatch between documentation and the behavior on your system, ensure that the version you are using is the same as the documentation. Check this box if they match or the issue you are reporting is not version specific.
1] The no-loc metadata is missing the Command -CommandWithArgs and its alias -cwa
2] The example given works, but only when it's launched from a pwsh.exe but not cmd.exe or powershell.exe
I thought the cmd.exe and powershell.exe cases were common enough to be worth mentioning.
Details
For completion here's fixes for all 4 cases:
# When ran from cmd.exe# ( the original throws )
pwsh -CommandWithArgs "$args | % { ""arg: $_"" }" arg1 arg2
# from a pwsh session with default values# ( the original works )
pwsh -CommandWithArgs '$args | % { "arg: $_" }' arg1 arg2
# ran from a powershell.exe session 5.1# ( the original outputs blank )
pwsh -CommandWithArgs '"$args | % { ""arg: $_"" }"' arg1 arg2
# from a pwsh session using legacy argument passing# ( the original outputs blank )$PSNativeCommandArgumentPassing='Legacy'
pwsh -CommandWithArgs '$args | % { ""arg: $_"" }' arg1 arg2
Prerequisites
Get-Foo
cmdlet" instead of "Typo."Links
Summary
1] The
no-loc
metadata is missing the Command-CommandWithArgs
and its alias-cwa
2] The example given works, but only when it's launched from a
pwsh.exe
but notcmd.exe
orpowershell.exe
I thought the
cmd.exe
andpowershell.exe
cases were common enough to be worth mentioning.Details
For completion here's fixes for all 4 cases:
Tested using
pwsh 7.4.2
andpowershell 5.1
Suggested Fix
Maybe Part 2 should simplify to the
info
link about_parsing#passing-arguments-that-contain-quote-charactersLegacy
could be assumed knowledge, and left out.I included examples because common cases fail. Some show no errors. That could be confusing for users
Part 3 I am not sure if this is correct behavior or possibly a bug? The lack of syntax error is what originally triggered these tests.
The text was updated successfully, but these errors were encountered: