I want to update a xml file from a batch file using powershell command and think i'm close but have a syntax problem.
This is the powershell command that is in a batch file:
powershell -Command "& {$xml = [xml](Get-Content "C:\Temp\Test\configuration.xml"); $xml.root.settings.installingUser.value = 'NewID'; $xml.Save("C:\Temp\Test\configuration_ny.xml")}"
Example on the configuration.xml:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test engine="2011.0.0" />
<settings>
<installDir value="C:\Program Files\App\Path" />
<installingUser value="InstallID" />
</settings>
</root>
The error message say it is missing End Parenthesis and would appreciate all help or suggestion i can get to solve this.
powershell -Command "& {$xml = [xml](Get-Content \"C:\Temp\Test\configuration.xml\"); $xml.root.settings.installingUser.value = 'NewID'; $xml.Save(\"C:\Temp\Test\configuration_ny.xml\")}"