I need to open a file and search for substring. Then replace the other text on the same line.
Have to search for text: #define MyAppVersion and replace the version inside the double quotes (this is dynamic, will be fetched from a different file).
#define MyAppVersion "1.0.0"
So here is what I currently have:
rem version num to be retrieved elsewhere, set here for simplicity on sample
set VER=1.1.0
powershell -Command "(gc sample.iss) -replace '#define MyAppVersion', '#define MyAppVersion "%VER%"' | Out-File sample.iss"
But this only outputs like this:
#define MyAppVersion 1.1.0 "1.0.0"
How can I change the entire line then without using any 3rd party plugins?
Thanks!