Powershell batch renaming file contains [] causing an error
All downloaded files contain "[download website address]", according to the usual method.
Get-ChildItem "D:\ Bluey\"-Recurse | ForEach-Object {Rename-Item-Path $_ .FullName-NewName $_ .FullName.Replace ('old','new')}
It has been reported that the source file could not be found. After consulting, I learned that when the file name contains special characters, the-LiteralPath parameter is required.
Get-ChildItem "D:\ Bluey\"-Recurse | Where-Object {$_ .Name-match'\ [. +\]'} | foreach {Rename-Item-LiteralPath $_ .FullName-NewName $($_ .Name-replace'\ [. +\]','-')}
Replace [] and the characters between them with -.