I\'m trying to write a simple script that reads a file, locates a string, replaces the string with another string, and stores all new file contents (with replaced string), i
I guess it is because after first pipe you are not processing each result. so the right one will be according to me :
(Get-Content C:\file1.txt) | %{$_ -replace "this:text", "withthis:text"} | Set-Content C:\file2.txt