Replace here-string in file

Welcome Forums General PowerShell Q&A Replace here-string in file

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year ago.

  • Author
    Posts
  • #84050

    Participant
    Points: 0
    Rank: Member

    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

  • #84053

    Participant
    Points: 56
    Rank: Member
  • #84097

    Participant
    Points: 0
    Rank: Member

    Solved. Thanks!

The topic ‘Replace here-string in file’ is closed to new replies.