title: Powershell Out-File not working as expected with a reversed string
body: <p>I need to write a file backwards line by line to another file. I can get it to work fine in the PowerShell window, but when I try to pipe it to an <code>Out-File</code>, it doesn't work. This is my script:</p>
  
  <pre><code>Get-Content C:\Users\Administrator\Desktop\files.txt | ForEach-Object {
      $text = $_.toCharArray()
      [Array]::Reverse($text)
      -join $text | Out-File 'C:\Users\Administrator\Desktop\reversed.txt'
  }
  </code></pre>
  
  <p>This actually creates a file on the Desktop, but doesn't give it any content. </p>
  
  <p>If I simply don't pipe to <code>Out-File</code> on the last line, it works fine, and prints the reversed file straight to the PowerShell window. </p>
  
  <p>I have tried it with and without the single quotes, as well as using the <code>-FilePath</code> option. Nothing's working. Any ideas out there?</p>