Skip to content

Parameter parsing/passing: a hyphen at the start of an argument situationally prevents string interpolation #14587

Closed

Description

Closely related: #13489

In a --prefixed argument (that ends up not being a named argument), an embedded variable reference isn't expanded unless it happens to be preceded by :

Steps to reproduce

Write-Output -foo=$HOME | Should -Be "-foo=$HOME"

Expected behavior

The test should succeed.

Actual behavior

The test fails, because the variable reference is unexpectedly not expanded.

Expected strings to be the same, but they were different.[...]
Expected: '-foo=/Users/jdoe' But was:  '-foo=$HOME'

Environment data

PowerShell Core 7.2.0-preview.2

Activity

  1. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Jan 10, 2021
  2. changed the title [-]Parameter parsing/passing: a hyphen at the start of an argument situationally prevent string interpolation[/-] [+]Parameter parsing/passing: a hyphen at the start of an argument situationally prevents string interpolation[/+] on Jan 10, 2021
  3. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  6. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-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