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

PowerTip: Read Text File in Raw Mode with PowerShell

$
0
0

Summary: Use Windows PowerShell to read a text file in raw mode.

Hey, Scripting Guy! Question How can I use Windows PowerShell to read a text file as a single line of text, not as an array of strings created by
           end-of-line returns?

Hey, Scripting Guy! Answer Use the –Raw parameter with Get-Content. This forces Windows PowerShell to ignore new line characters and
           end-of-line returns, and instead, return the contents of the file as one string. Here is an example:

Get-Content C:\fso\AnEmptyFile.txt -Raw


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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