0

I am trying to replace the below

UninstallPassword="1"

with

UninstallPassword="0"

I am using JREPL.bat and so far can only replace content that does not have special characters. Reading the documentation under /x says I must use /q but I am not sure how to format the line of code for it. I have tried:

jrepl.bat "\qUninstallPassword="1"" "\qUninstallPassword="0"" /f "%userprofile%\pol.txt" /o -

and

jrepl.bat "UninstallPassword\q=\q"1\q"" "UninstallPassword\q=\q"0\q"" /f "%userprofile%\pol.txt" /o -

but both make no change to the text.

Any help appreciated, and alternatively if Windows CMD has a builtin function to acheive the same as JREPL then that would be ideal and keep the script as a standalone.

David
  • 127
  • 3
  • 10
  • if there were a built-in function in `cmd`, Dave wouldn't have written `jrepl.bat` in the first place. You can write a script (reading and processing the file line by line - there are several examples on SO), but `jrepl` makes it easier, safer and faster (when you know how to use it's numerous features). – Stephan Jul 18 '20 at 17:40

1 Answers1

1

to use \q, you have to enable it with /XSEQ. \q is then used as a placeholder for ", so replace each " with \q within the patterns. Don't replace the outer quotes surrounding the patterns:

jrepl.bat "UninstallPassword=\q1\q" "UninstallPassword=\q0\q" /XSEQ /f "%userprofile%\pol.txt" /o -
Stephan
  • 53,940
  • 10
  • 58
  • 91
  • Wow, I spent the better part of my afternoon trying to get this right and it was as simple as that to get it working. Thank you very much Stephen – David Jul 18 '20 at 17:51