How to Replace a string in a file using windows batch

0

I have a file say C:/temp/example.xml

The contents are as below.

https://example.net/fndstring> https://example.net/fndstring>

I need a windows batch command to find the line with string "The link" and then replace the substring starting with "https://example.net" (the whole URL) with a new string "https://example.net/foundit" .

The final output should be as below:

https://example.net/foundit> https://example.net/findstring>

I just don't want to do a findstr on "fndstring" and replace it with "foundit" as the former substring might vary each time I run the batch script. My primary search should point me to the line containing "The link".

user3852605

Posted 2019-09-19T15:37:16.500

Reputation: 1

1

Would you accept an answer which relies on the GNU CoreUtils for Windows? They are open source.... http://gnuwin32.sourceforge.net/packages/coreutils.htm

– K7AAY – 2019-09-19T18:56:52.357

No answers