Use this PowerShell script to replace a string in all files in a directory. This can be helpful when moving applications from one server to another, or changing server names. The ” | Where-Object { $_.Name -like “*.” }” can be dropped if you aren’t looking for a particular file type. Be sure to match the output file encoding.
$files = (get-childitem -recurse | Where-Object { $_.Name -like “*.” }).fullname
ForEach ( $file in $files ) {
(get-content $file).replace(”,”) | out-file $file -encoding ASCII
}