8000 Command line parameters prefixed /- · Issue #12013 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Command line parameters prefixed /- #12013
@NeQuissimus

Description

@NeQuissimus

This may or may not be intentional.
I was just looking at the code here for completely unrelated reasons:
https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs#L569

I noticed that (in contrast to Powershell 5.1), a combination of / and - for command line parameters is now allowed.
According to all documentation (in-code and external), one is supposed to pick between -, -- and /, no combination is ever mentioned.
However, the flow of the code also allows for /-.

Is this meant to be possible?

Steps to reproduce

pwsh.exe /-enc JwBUAGgAaQBzACAAaQBzACAAYQAgAHQAZQBzAHQALgAnAA==

Expected behavior

Invalid combination of / and -

Actual behavior

Execution of command

> pwsh.exe /-enc JwBUAGgAaQBzACAAaQBzACAAYQAgAHQAZQBzAHQALgAnAA==
This is a test

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS: I had a hard time searching for this, since symbols are not really searchable in GitHub. Apologies if this issue already exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    First-Time-IssueEasy issues first time contributors can work on to learn about this projectIssue-BugIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0