I'm trying to accomplish a search and replace in multiple files. See sample code below. But when I use the characters [] , :: , / it replaces multiple times all over the place. Is there a way around this?
PS C:"Some_Path"> $newFiles = Get-ChildItem . *.par -rec
foreach ($file in $newFiles)
{(Get-Content $file.PSPath) | Foreach-Object { $_ -replace "[text]", " /Text/Text_Data1::[404PC001]" } | Set-Content $file.PSPath }
Thanks
.par is a text file