Skip to content

-CommandWithArgs CLI parameter doesn't work with - (code provided via stdin) #22891

Open

Description

Prerequisites

Steps to reproduce

Note: To run the repro, experimental feature PSCommandWithArgs must be enabled.

'"Args: $args"' | pwsh -NoProfile -CommandWithArgs - foo bar

Note:

Expected behavior

Args: foo bar

Actual behavior

The CLI call fails:

'-' was specified with the -Command parameter; no other arguments to -Command are permitted.

That is, -CommandWithArgs unexpectedly behaves like -Command, even though there's no good reason to prevent this combination of arguments.

Error details

No response

Environment data

PowerShell 7.5.0-preview.2

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions