Replace Entire Line Based on Partial Value RRS feed

  • Question

  • Hi All,

    Apologies if this is not the appropriate forum, wasn't sure where to post.  Running Windows 7 and attempting to use PowerShell to replace a certain line in a text file:


    I'd like to replace the 117 with 120, and this works as long as I'm able to use -replace 'Value=117', 'Value=120'.  However, I won't always know what the value to the right of the equal sign is, so how would I go about replacing the entire line based on a partial search string?  I tried -replace 'Value=*', 'Value=120' but this got me Value=117120.

    Any help is greatly appreciated!

    Best Regards


    Monday, May 29, 2017 7:02 PM