Using the ForEach-Object -Parallel cmdlet in a directory with a name containing "[" will return a WildcardPatternException. Remove -Parallel, it will run successfully.
I created a few directories and ran the following commands.1..5 | ForEach-Object -Parallel {Write-Host $_}
A difference of a return for each ran directory is as follows.
PS D:\[example> 1..5 | ForEach-Object -Parallel {Write-Host $_}
WildcardPatternException will be returned.
PS D:\[]example> 1..5 | ForEach-Object -Parallel {Write-Host $_} PS D:\[ex]ample> 1..5 | ForEach-Object -Parallel {Write-Host $_}
ItemNotFoundException will be returned.
PS D:\[e]xample> 1..5 | ForEach-Object -Parallel {Write-Host $_} PS D:\]example> 1..5 | ForEach-Object -Parallel {Write-Host $_}
Ran successfully and 5 values are returned.
Is there a way to resolve this without renaming directories?