-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I originally filed this bug under #14279, but today, the @microsoft-github-policy-service bot told me to verify it against the latest version and file it again! I tested the following on version 7.3.9. Just 12 minutes after I filed this issue, version 7.3.10 and 7.4.0 reached GA! So, I went back tested it on 7.4.0 too.
Open a PowerShell 7.1 window, navigate to a safe folder for experimentation, e.g., D:\, and enter the following commands:
# Create a folder called '[Meta]'. Careful! '-Type Folder' doesn't work!
New-Item -Name '[Meta]' -Type Directory
# Output:
#
# Directory: D:\Desktop
#
# Mode LastWriteTime Length Name
# ---- ------------- ------ ----
# d---- 2020-11-27 23:37 [Meta]
#
# Change the current folder to '[Meta]'
Set-Location -Path '.\`[Meta`]\'
# Alternatively, this:
Set-Location -LiteralPath '.\[Meta]\'
# Navigate back to "Desktop"
Set-Location -Path '-'
# Navigate forward to '[Meta]'
Set-Location -Path '+'Expected behavior
PS D:\> Set-Location -Path '+'
PS D:\[Meta] >Actual behavior
PS D:\> Set-Location -Path '+'
Set-Location: Cannot find path 'D:\[Meta]' because it does not exist.
PS D:\ >Error details
Exception :
Type : System.Management.Automation.ItemNotFoundException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Cannot find path 'D:\[Meta]' because it does not exist.
HResult : -2146233087
TargetObject : D:\[Meta]
CategoryInfo : ObjectNotFound: (D:\[Meta]:String) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : PathNotFound
ItemName : D:\[Meta]
SessionStateCategory : Drive
TargetSite :
Name : SetLocation
DeclaringType : System.Management.Automation.SessionStateInternal, System.Management.Automation, Version=7.3.9.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : Cannot find path 'D:\[Meta]' 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 : D:\[Meta]
CategoryInfo : ObjectNotFound: (D:\[Meta]:String) [Set-Location], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
InvocationInfo :
MyCommand : Set-Location
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 9
Line : Set-Location -Path '+'
PositionMessage : At line:1 char:1
+ Set-Location -Path '+'
+ ~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Set-Location
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module