'How do I find & replace file contents in PowerShell?

I need to find text in a file, like:

PolicyFile=$(SrcRoot)BeHttp

and replace it with this:

PolicyFile=$(SrcRoot)PPCore/BeHttp

So I wrote following script but it's not working.

Get-ChildItem 'D:\SomeFolder\\*.MKE' -Recurse | ForEach {
     (Get-Content $_ | ForEach  {   
       $_  -replace "PolicyFile=$(SrcRoot)BeHttp", "PolicyFile=$(SrcRoot)PPCore//BeHttp"
     }) | Set-Content $_
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source