mkdir "["
cd -LiteralPath "["
start cmd
Start-Process works with the -WorkingDirectory option.
mkdir "["
cd -LiteralPath "["
start -WorkingDirectory . cmd
Start-Process works
start : The specified wildcard character pattern is not valid: [
At line:1 char:1
+ start cmd
+ ~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Start-Process], WildcardPatternException
+ FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.StartProcessCommand
Tested with Powershell:
- 5.1 (Windows 10 1909)
- 6.2.4 (Windows 10 1909)
- 7.0.0 RC3 (Windows 10 1909)
I see the problem here and will put it in a pull request for it.
Really the issue asks to process WorkingDirectory as LiteralPath. I think we should do so. We consider WorkingDirectory as literal path for Start-Job and pwsh parameter.
/cc @mklement0 @SteveL-MSFT for conclusion.
@iSazonov As I mentioned in my PR for this, the redirection parameters also suffer from the parsing issue. The documentation says that these parameters do not support wildcards and it's hard to imagine what practical value processing them as patterns would have.
Related:
> and >> treat the filename operand as a wildcard expression)Set-Content -Path not only treats its operand as a wildcard expression, but allows writing to _multiple_ files).:tada:This issue was addressed in #11946, which has now been successfully released as v7.1.0-preview.4.:tada:
Handy links: