title: Search and replace multiple strings in multiple xml files via batch file
body: <p>I have some xml files (about 100, some in subfolders) whose IDs need to be changed. Therefore I have an Excel list with about 1.100 lines, left column is the old ID name and right column the new one which should replace the old one. </p>
  
  <p>I found this script on Stackoverflow (and changed it a little):</p>
  
  <pre><code>@rem replaceids.bat
  
  ECHO off
  SETLOCAL enabledelayedexpansion
  
  SET source=%1
  SET target=%2
  
  IF EXIST %target% DEL /f %target%
  
  FOR /f "delims=" %%i IN ('FINDSTR . %source%') DO (
     SET line=%%i
     SET line=!line:ö=oe!
     SET line=!line:ä=ae!
     SET line=!line:ü=ue!
     ECHO !line! &gt;&gt; %target%
  )
  </code></pre>
  
  <p>Here's the original link:
  <a href="https://stackoverflow.com/questions/11744230/batch-replace-multiple-different-strings">batch replace multiple different strings</a></p>
  
  <p>Then I created another batch file to call the one above and run it through my files:</p>
  
  <pre><code>for /R %%F in (*.xml) do (
     replaceids.bat "%%~dpnxF" "C:\mytargetfolder%%~pnxF"
  )
  </code></pre>
  
  <p>Found this on Stackoverflow as well; here's the link:
  <a href="https://stackoverflow.com/questions/5642021/batch-process-all-files-in-directory">Batch process all files in directory</a></p>
  
  <p>Also thanks to Meltz014 from reddit, who helped me get this far. </p>
  
  <p>The problem I have now is that it says that the network path can not be found when I start it (not sure what it says exactly in English since I'm not in the office and running it on a German Windows right now). As far as I can see I'm not referencing to any networks. </p>
  
  <p>Any help would be appreciated. </p>
  
  <p>My command line experience is very limited by the way. </p>
  
  <p>EDIT</p>
  
  <p>I just found something else that might get me closer, it still doesn't work yet though:
  <a href="https://stackoverflow.com/questions/25164000/how-to-find-replace-multiple-strings-in-multiple-text-files-using-powershell">How to Find Replace Multiple strings in multiple text files using Powershell</a> </p>
  
  <pre><code>$Iteration = 0
  $FDPATH = 'D:\opt\HMI\Gfilefind_rep'
  #&amp; 'D:\usr\fox\wp\bin\tools\fdf_g.exe' $FDPATH\*.fdf
  $GraphicsList = Get-ChildItem -Path $FDPATH\*.g | ForEach-Object FullName
  $FindReplaceList = Import-Csv -Path $FDPATH\Input.csv
  foreach($Graphic in $Graphicslist){
      Write-Host "Processing Find Replace on : $Graphic"
      foreach($item in $FindReplaceList){
      Get-Content $Graphic | ForEach-Object { $_ -replace "$($item.FindString)", "$($item.ReplaceString)" } | Set-Content ($Graphic+".tmp")
          Remove-Item $Graphic
          Rename-Item ($Graphic+".tmp") $Graphic
          $Iteration = $Iteration +1
          Write-Host "String Replace Completed for $($item.ReplaceString)"
      }
  }
  </code></pre>
  
  <p>It seems to do something, but then after finnishing it always says </p>
  
  <blockquote>
    <p>String Replace Completed for</p>
  </blockquote>
  
  <p>My CSV file is created as it is in the example, that means:</p>
  
  <pre><code>FindString  ReplaceString
  AA1A    171PIT9931A
  BB1B    171PIT9931B
  etc..
  </code></pre>
  
  <p>Since it doesn't find anything, I assume something with the CSV might be wrong? Any help would be highly appreciated!</p>