Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Create an ASCII File from Inside PowerShell

$
0
0

Summary: Learn how to create an ASCII file from inside Windows PowerShell.

Hey, Scripting Guy! Question I want to create an ASCII text file to hold the results of the Get-Process cmdlet. How can this be done?

               Hey, Scripting Guy! Answer

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


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>