Skip to content

Can't cd to path copied from Windows Explorer #21013

Description

@soredake

Prerequisites

Steps to reproduce

  1. mkdir "$HOME\[TEST] Directory"
  2. Do "copy as path" from Windows Explorer on this directory.
  3. Do cd "C:\Users\user\[TEST] Directory"

Expected behavior

Directory changed to "C:\Users\user\[TEST] Directory"

Actual behavior

cd "C:\Users\user\[TEST] Directory"
Set-Location: Cannot find path 'C:\Users\user\[TEST] Directory' because it does not exist.

Error details

Get-Error

Exception             :
    Type                 : System.Management.Automation.ItemNotFoundException
    ErrorRecord          :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : Cannot find path 'C:\Users\user\[TEST] Directory' because it does not exist.
            HResult : -2146233087
        TargetObject          : C:\Users\user\[TEST] Directory
        CategoryInfo          : ObjectNotFound: (C:\Users\user\[TEST] Directory:String) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : PathNotFound
    ItemName             : C:\Users\user\[TEST] Directory
    SessionStateCategory : Drive
    TargetSite           :
        Name          : SetLocation
        DeclaringType : System.Management.Automation.SessionStateInternal, System.Management.Automation, Version=7.4.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message              : Cannot find path 'C:\Users\user\[TEST] Directory' because it does not exist.
    Source               : System.Management.Automation
    HResult              : -2146233087
    StackTrace           :
   at System.Management.Automation.SessionStateInternal.SetLocation(String path, CmdletProviderContext context, Boolean literalPath)
   at Microsoft.PowerShell.Commands.SetLocationCommand.ProcessRecord()
TargetObject          : C:\Users\user\[TEST] Directory
CategoryInfo          : ObjectNotFound: (C:\Users\user\[TEST] Directory:String) [Set-Location], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
InvocationInfo        :
    MyCommand        : Set-Location
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 10
    Line             : cd 'C:\Users\user\[TEST] Directory'
    Statement        : cd 'C:\Users\user\[TEST] Directory'
    PositionMessage  : At line:1 char:1
                       + cd 'C:\Users\user\[TEST] Directory'
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : cd
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

❯ echo $PSVersionTable

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

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    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