Skip to content

Set-Location: does not escape on -Path - when resolved path contains wildcard character #27507

@sharpchen

Description

@sharpchen

Prerequisites

Steps to reproduce

New-Item -ItemType Directory -Path "foo - bar(123-456)[foo]"
cd -LiteralPath '.\foo - bar(123-456)[foo]'
cd ..
cd -

Set-Location: Cannot find path 'C:\Users\user\foo - bar(123-456)[foo]' because it does not exist.

Expected behavior

no error.

Actual behavior

error

Error details

Environment data

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

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions