You are here

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

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 $_}
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
3 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer