PowerShell fails to start if path contains brackets
In a variety of cases, attempting to launch PowerShell from a path containing square brackets either fails entirely, or fails to resolve the relative working directory. For example:
With this command, PowerShell won't launch:
PS C:\T[e]st> Start PowerShell
Start : Cannot perform operation because the wildcard path C:\T[e]st did not resolve to a file.
At line:1 char:1
+ Start PowerShell
+ CategoryInfo : OpenError: (C:\T[e]st:String) [Start-Process], FileNotFoundException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.StartProcessCommand
From CMD or Powershell, this command starts Powershell, but with the wrong working directory:
Copyright (C) 2015 Microsoft Corporation. All rights reserved.
Likewise, a PowerShell shortcut (.lnk) that has its "Start in" field cleared or set to %CD% (which should launch to the same the working directory as the shortcut), fails to resolve a path containing brackets (again, defaulting to the powershell.exe dir).
Here's another manifestation this bug: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088702-start-process-doesn-t-work-if-in-a-directory-name
Thanks! I almost never use brackets in my folder names. Would not have figured this was a PowerShell issue if you hadn't posted it.
PS C:\PS\Word Doc [placeholders]> start [file].docx
Not a big deal for me to rename the folder, but I could see this is a problem if you can't change the folder name.