How to replace multiple strings in a file using PowerShell
One option is to chain the -replace operations together. The ` at the end of each line escapes the newline, causing PowerShell to continue parsing the expression on the next line: $original_file=”path\filename.abc” $destination_file=”path\filename.abc.new” (Get-Content $original_file) | Foreach-Object { $_ -replace ‘something1’, ‘something1aa’ ` -replace ‘something2’, ‘something2bb’ ` -replace ‘something3’, ‘something3cc’ ` -replace ‘something4’, ‘something4dd’ ` … Read more