So lerne ich, wie ein XML-Dokument mit Powershell zu manipulieren. Im Moment versuche ich nur, einen Geben-Knoten zu ändern und dann die Änderungen zu speichern. Ich bin derzeit daran fest, wie ich meine Änderungen speichern kann.Ändern und XML-Dokument mit Powershell und dann speichern
Hier ist, was ich habe.
$xmlfile = "testFile.xml"
$xml = [xml](get-content $xmlfile)
$employee = $xml.employees.employee
$employee[1].name = "New Name" // this is where I change the content of the xml file
//is this an okay way to change the value of the element??
$xml.save($xmlfile) //why wouldn't this line save my changes??
Vielen Dank für Ihre Hilfe :)
Ich denke, mein Skript ist geschrieben, das Problem ist, dass mein Speichern Befehl meine Datei gespeichert hat nach 'home' nicht das aktuelle Arbeitsverzeichnis --- http://stackoverflow.com/questions/4822575/saving-an-xml- file-in-powershell-requires-complete-path-why – Jeff