Summary: Learn how to create an ASCII file from inside Windows PowerShell.
I want to create an ASCII text file to hold the results of the Get-Process cmdlet. How can this be done?
a. Pipe the results to the Out-File cmdlet and use the -encoding parameter to specify ASCII:
GPS | Out-File -FilePath c:\fso\myproc.txt -Encoding ascii
b. Use the InputObject parameter of the Out-File cmdlet and use the –encoding parameter to specify ASCII:
Out-File -InputObject (gps) -FilePath c:\fso\myproc.txt -Encoding ascii
c. Use redirection like this:
Get-Process >>c:\fso\myprocess.txt
0 comments