BUG: current working directory is reset to $PSHOME when powershell is launched from a folder with square brackets
To reproduce run this command line from a Command Prompt console or a .bat file:
md "%temp%[test]" & cd /d "%temp%[test]" & powershell -c "$pwd"
Prints "C:\Windows\System32\WindowsPowerShell\v1.0" instead of ".....[test]"
There are other methods to reproduce as well, for example put a powershell script in a folder with square brackets and run it.
Windows 7, Powershell 4.
Sebastian N. commented
That's a known limitation of PowerShell. The PS parser interprets the square brackets if used with the -Path parameter. That's why there is the -LiteralPath parameter to tell PS to skip interpreting the specified path entirely.
Prasoon Karunan V commented
Yes, cannot do Set-Location to a Directory surrounded by [path]
Derp McDerp commented
There is a similar problem in Windows Explorer if you go to "File | Open With PowerShell" on a path containing square brackets.