ricardobohner
Goto Top

Text ersetzen im Powershell

Wie kann ich folgenden text im powershell in einer text datai ersetzen:

EnterAuxOnLogin="true" duch EnterAuxOnLogin="false"

Die text datei also xml datei heisst meu.xml

Was ich bisher versucht habe ohne erfolg:

(get-content meu.xml).replace("EnterAuxOnLogin=""true""', "EnterAuxOnLogin=""false""") | set-Content meu2.xml  

(get-content meu.xml).replace('EnterAuxOnLogin="true"', "EnterAuxOnLogin="false"') | set-Content meu2.xml  

(get-content meu.xml).replace('EnterAuxOnLogin=`"true`"', "EnterAuxOnLogin=`"false`"") | set-Content meu2.xml  

  • Ich verdächtige das die Ausrufezeichen das problem sind

Content-Key: 542861

Url: https://administrator.de/contentid/542861

Printed on: May 2, 2024 at 22:05 o'clock

Member: NordicMike
NordicMike Feb 04, 2020 at 00:42:22 (UTC)
Goto Top
Hi, ich habe mir mal erlaubt für Dich zu googeln:

https://stackoverflow.com/questions/42245091/replace-xml-attributes-usin ...

Keep rockin

Der Mike
Member: ricardobohner
ricardobohner Feb 04, 2020 at 17:39:39 (UTC)
Goto Top
Danke @NordicMike,

Also was funktioniert hat ist:

(get-content meu.xml).replace('EnterAuxOnLogin="true"'', 'EnterAuxOnLogin="false"') | set-Content meu2.xml