unreadable output file in powershell

If you redirect a not-completly-string output (like a spfile) to a file in powershell, you may not see the same in the file as in the output

  • without redirection

    PS C:\> Select-String "compatible" .\spfileDB01.ora
  • with redirection

    PS> Select-String "compatible" .\spfileDB01.ora > compatible.txt
    PS> vim -b .\compatible.txt
  • With redirection and conversion to ascii

    PS> Select-String "compatible" .\spfileDB01.ora |
    Out-File -Encoding ASCII .\compatible.txt

    PS> vim .\compatible.txt


With Out-File (instead of >), you can specify the encoding, which does the trick

1 thought on “unreadable output file in powershell

Comments are closed.