{"id":5082,"date":"2012-08-24T11:59:00","date_gmt":"2012-08-24T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/08\/24\/powertip-create-an-ascii-file-from-inside-powershell\/"},"modified":"2012-08-24T11:59:00","modified_gmt":"2012-08-24T11:59:00","slug":"powertip-create-an-ascii-file-from-inside-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-create-an-ascii-file-from-inside-powershell\/","title":{"rendered":"PowerTip: Create an ASCII File from Inside PowerShell"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to create an ASCII file from inside Windows PowerShell.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;I want to create an ASCII text file to hold the results of the&nbsp;<b>Get-Process<\/b>&nbsp;cmdlet. How can this be done?<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/><\/p>\n<p style=\"padding-left: 90px\"><strong>a.<\/strong> Pipe the results to the&nbsp;<b>Out-File<\/b>&nbsp;cmdlet and use the&nbsp;<b>-encoding<\/b>&nbsp;parameter to specify ASCII:<\/p>\n<p style=\"padding-left: 120px\">GPS | Out-File -FilePath c:\\fso\\myproc.txt -Encoding ascii<\/p>\n<p style=\"padding-left: 90px\"><strong>b.<\/strong> Use the&nbsp;<b>InputObject<\/b><i>&nbsp;<\/i>parameter of the&nbsp;<b>Out-File<\/b>&nbsp;cmdlet and use the&nbsp;<b>&ndash;encoding<\/b>&nbsp;parameter to specify ASCII:<\/p>\n<p style=\"padding-left: 120px\">Out-File -InputObject (gps) -FilePath c:\\fso\\myproc.txt -Encoding ascii<\/p>\n<p style=\"padding-left: 90px\"><strong>c.<\/strong> Use redirection like this:<\/p>\n<p style=\"padding-left: 120px\">Get-Process &gt;&gt;c:\\fso\\myprocess.txt<\/p>\n<p style=\"padding-left: 90px\">\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" border=\"0\" alt=\"\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to create an ASCII file from inside Windows PowerShell. &nbsp;I want to create an ASCII text file to hold the results of the&nbsp;Get-Process&nbsp;cmdlet. How can this be done? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a. Pipe the results to the&nbsp;Out-File&nbsp;cmdlet and use the&nbsp;-encoding&nbsp;parameter to specify ASCII: GPS | Out-File -FilePath [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[356,3,45],"class_list":["post-5082","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to create an ASCII file from inside Windows PowerShell. &nbsp;I want to create an ASCII text file to hold the results of the&nbsp;Get-Process&nbsp;cmdlet. How can this be done? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a. Pipe the results to the&nbsp;Out-File&nbsp;cmdlet and use the&nbsp;-encoding&nbsp;parameter to specify ASCII: GPS | Out-File -FilePath [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=5082"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5082\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=5082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=5082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=5082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}