PowerShell – Replace All Instances Of Something In All Files In Directory

By | 2016-03-18

This script searches every file in a directory for a particular string and replaces it with another value.

get-childItem  | ForEach { (Get-Content $_ | ForEach {$_ -replace "OLDVALUE,"NEWVALUE"}) | Set-Content $_}

Leave a Reply

Your email address will not be published. Required fields are marked *