Using JREPL with Special Characters

422 Views Asked by At

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.

1

There are 1 best solutions below

1
Stephan On BEST ANSWER

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 -