Replace here-string in file

I have the following string in a batch file:

@Echo Off

rem Comment

If Exist “C:\Windows\installer\21dc3e5.msi” Call msiexec.exe “C:\Windows\installer\21dc3e5.msi”

I want to replace this entire block at once because my batch files contains similar lines. I tried here-strings but after I escape the backslash with \\ the resulting string won't match the one that is in the file.

Thank you

Check out Adam’s blog here https://www.adamtheautomator.com/use-powershell-to-do-a-findreplace-on-a-set-of-text-files/ Should do what you need.

Solved. Thanks!