Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell does not open in current directory if its name contains a left square bracket (wildcard) #5752

louistio opened this issue Dec 28, 2017 · 6 comments


Copy link

@louistio louistio commented Dec 28, 2017

Steps to reproduce

C:\>mkdir "[T]est"

C:\>cd "[T]est"

PowerShell v6.0.0-rc.2
Copyright (c) Microsoft Corporation. All rights reserved.
Type 'help' to get help.

PS C:\Programs\PowerShell\6.0.0-rc.2>
  1. Make a directory called "[T]est".
  2. Run cmd (or powershell) and cd to the directory.
  3. Run powershell.

Expected behavior

Powershell always starts in the folder the parent process runs it in, regardless of the name of the folder.

Actual behavior

3 observed behaviors:
- Powershell starts in its home directory if the folder has left and right brackets. (ex: "Te[st]")
- Powershell starts in C:\ if the folder only has left brackets. (ex: "Te[st")
- Powershell starts in the current directory if it only has right brackets. (ex: "Te]st")

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-rc.2
PSEdition                      Core
GitCommitId                    v6.0.0-rc.2
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
WSManStackVersion              3.0

Additional Information

Hope this isn't a known issue, I've experienced it myself both when starting powershell from cmd and from Visual Studio Code ("Open in Terminal"). I've seen it discussed a little bit here. It might be related to Issue #4726. Hope we can see this fixed.

Copy link

@iSazonov iSazonov commented Dec 28, 2017

@mklement0 Could you please comment the Issue?

Copy link

@mklement0 mklement0 commented Dec 28, 2017

@iSazonov: The problem sounds closely related to #4726, as @enchanted13 has already pointed out.

Copy link

@KillyMXI KillyMXI commented Jan 7, 2018

Hello. Author of the mentioned page here. Recently I ran into another issue, so I made a follow-up post.

Until this issue is fixed, the only reliable way to open PowerShell in any folder would be some proxy application, doing all the required escaping, I think.

Copy link
Contributor Author

@louistio louistio commented Jan 10, 2018

@KillyMXI Hey, great follow-up post, I think this shows that native workarounds aren't really reliable for all the possible edge cases. A third party solution would be possible, but I really hope we can see these issues being fixed in powershell itself in the near future!

Copy link

@SteveL-MSFT SteveL-MSFT commented Jun 18, 2018

Reverting the previous change due to side effects. Will have to revisit this later.

Copy link

@JamesWTruher JamesWTruher commented Jul 6, 2018

just posted PR #7240 for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment