I am attempting to edit a configuration file using a batch script. I looked around and I believe powershell is the way to go here. I have zero experience with powershell so I'm guessing that the syntax is what is causing me problems.
Here is what the file looks like now (This section is located in the middle of the file)
<!--add key="MinNumCycles" value="25"/-->
<!--add key="MaxNumCycles" value="40"/-->
Here's what I want it to look like
<!--add key="MinNumCycles" value="25"/-->
<!--add key="MaxNumCycles" value="40"/-->
<!--RerunMode: 1 write to DB, 2 write to DB and add to RUN export/-->
<add key="RerunMode" value="0"/>
Here's what I'm trying to do in my batch file that I need help with
SET pattern=<!--add key="MaxNumCycles" value="40"/-->
SET textToAdd1=<!--RerunMode: 1 write to DB, 2 write to DB and add to RUN export/-->
SET textToAdd2=<add key="RerunMode" value="0"/>
SET filename=Software.exe.config
powershell -Command "(gc %filename%) -replace "%pattern%", "$&`n`n%textToAdd1%"'n"%textToAdd2%" | sc %filename%"