Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Text in XML-Datei ändern

$
0
0

Hallo liebe Community,

habe eine XML-Datei, welche in meinem UserProfil liegt.
In dieser Datei möchte ich mit dem cmdlet replace ein Wort ersetzen.

Aber leider geschieht nichts.

Hier ist der Aufbau meiner XML-Datei.

<?xml version="1.0" encoding="UTF-8"?>
<window type="buttonmenu" id="1153">
 <defaultcontrol always="true">9000</defaultcontrol>
 <coordinates>
 </coordinates>
 <include>openclose</include>
 <controls>
  <include>DialogBackground</include>
  <control type="group">
  </control>
  <control type="image">
  </control>
  <control type="group">
   <include>opencloseslideup</include>
   <control type="group">
    <control type="group">
    </control>
    <control type="wraplist" id="9000">
     </itemlayout>
     <focusedlayout width="350" height="60">
     </focusedlayout>
     <content>
      <item id="13">
       <description>Set Settings Background</description>
       <label>13000</label>
       <label2>$VAR[backgroundfolder]home_settings$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_settings)]</icon>
       <onclick>Skin.SetImage(user_bkg_settings)</onclick>
      </item>
      <item id="2">
       <description>Music Files</description>
       <label>2</label>
       <label2>$VAR[backgroundfolder]home_music$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_music)]</icon>
       <onclick>Skin.SetImage(user_bkg_music)</onclick>
      </item>
      <item id="12">
       <description>PVR</description>
       <label>31502</label>
       <label2>$VAR[backgroundfolder]home_livetv$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_pvr)]</icon>
       <onclick>Skin.SetImage(user_bkg_pvr)</onclick>
      </item>
      <item id="12">
       <description>Radio</description>
       <label>31960</label>
       <label2>$VAR[backgroundfolder]home_fav3$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_fav3)]</icon>
       <onclick>Skin.SetImage(user_bkg_fav3)</onclick>
      </item>
      <item id="7">
       <description>PlayDVD</description>
       <label>341</label>
       <label2>$VAR[backgroundfolder]home_disc$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_dvd)]</icon>
       <onclick>Skin.SetImage(user_bkg_dvd)</onclick>
      </item>
      <item id="4">
       <description>Movie Library</description>
       <label>20342</label>
       <label2>$VAR[backgroundfolder]home_video$VAR[bkg_fileext]</label2>
       <icon>$INFO[Skin.String(user_bkg_movie)]</icon>
       <onclick>Skin.SetImage(user_bkg_movie)</onclick>

In Item id="4" wollte ich dann den folgenden Text "Home_Video"
in "Movie" ändern.

Folgenden Befehl habe ich hierfür benutzt:

$weg = "C:\Users\Media\AppData\Roaming\Kodi\addons\skin.horizonzv.helix\720p\Custom_1153_Backgrounds.xml"

$content = Get-Content $weg -Raw -force

$find = "home_video"
$replace = "movie"

#write replaced content back to the file
$content -replace $find,$replace | Out-File $file

Dieser Befehl funktionierte unter meinem Testverzeichnis:
C:\C:\Users\Media\Workzone

!! Aber nicht in meinem USERPROFILE = C:\Users\Media\AppData\Roaming\Kodi\addons\skin.horizonzv.helix\720p\

Woran könnte dies liegen?

LG

svensus


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>