title: How to replace multiple strings in a file using PowerShell
body: <p>I am writing a script for customising a configuration file. I want to replace multiple instances of strings within this file, and I tried using PowerShell to do the job.</p>
  
  <p>It works fine for a single replace, but doing multiple replaces is very slow because each time it has to parse the whole file again, and this file is very large. The script looks like this:</p>
  
  <pre><code>$original_file = 'path\filename.abc'
  $destination_file =  'path\filename.abc.new'
  (Get-Content $original_file) | Foreach-Object {
      $_ -replace 'something1', 'something1new'
      } | Set-Content $destination_file
  </code></pre>
  
  <p>I want something like this, but I don't know how to write it:</p>
  
  <pre><code>$original_file = 'path\filename.abc'
  $destination_file =  'path\filename.abc.new'
  (Get-Content $original_file) | Foreach-Object {
      $_ -replace 'something1', 'something1aa'
      $_ -replace 'something2', 'something2bb'
      $_ -replace 'something3', 'something3cc'
      $_ -replace 'something4', 'something4dd'
      $_ -replace 'something5', 'something5dsf'
      $_ -replace 'something6', 'something6dfsfds'
      } | Set-Content $destination_file
  </code></pre>