Skip to content

cd - (switch directories) doesn't work as expected. #11145

@bagajjal

Description

@bagajjal

Steps to reproduce

cd c:\windows\system32\opensh
cd c:\windows\
cd - (First time it does right. It switches directory to c:\windows\system32\openssh)
cd - (From now on.. it's broken. It switches to c:\)

Expected behavior

Just like Unix, cd - should only switch between last 2 directories.
In this case, second command "cd -" should switch back to c:\windows

Actual behavior

Second command "cd -" switch back to "c:".
Subsequent "cd -" commands gives error message.

Environment data


PS C:\> $psversiontable

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

PS C:\>

Windows
image

Unix
image

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-By DesignThe reported behavior is by design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions