I have a file containg (multiple) xml tags that contain the attribute type=“ABC”. The ABC needs to be replaced by XYZ.
I have tried to use the below (escape with backtick, as it seems to be the standard in powershell) and the variation of it by escaping the double quotes with the backslash (I’m basically a pure C programmer).
powershell -command "(gc %rootdir%\directory\file3.xml) -replace 'TYPE=`"ABC`"','TYPE=`"XYZ`"' | Out-File %rootdir%\directory\file.xml" -encoding ASCII
I eventually tried escaping the double quote with another double quote and that worked. The question is where I can read up on escaping in powershell or if somebody can explain why only the escaping the double quote with a double quote worked.
Thanks in advance