I am writing a batch script in which I am trying to replace a value in a prop file. I am using PowerShell for the replacement code as I couldn't find any comparable way to do in batch script.
powershell -Command "(gc %PROPFILEPATH%) -replace '%FTPoldfilepath%', '%FTPnewfile%' | Set-Content %PROPFILEPATH%"
The variables %PROPFILEPATH%
, %FTPoldfilepath%
and %FTPnewfile%
contain double backslashes (Eg: C:\\testing\\feed
)
I realize that backslashes need to be escaped, can anyone guide me how to implement the escape function here.