How to Search and Replace Text in a File in Windows PowerShell
Problem
You want to search for text in a file and replace that text with something new.
Solution
To search and replace text in a file, first store the content of the file in a variable, and then store the replaced text back in that file as shown in Example 74.
Example 74. Replacing text in a file