Get-Content Can Now Read Raw Text

by Aug 20, 2012

In PowerShell v3, Get-Content was reading text files line by line. This was great for pipeline processing but could take a long time and also changed/removed the original line endings.

In PowerShell v3, Get-Content now has a parameter -Raw. When specified, the text file will be read in as one single string, keeping line endings exactly the way they were.

Use -Raw for example if you want to read in a text file, change or replace parts and then write it back (for example, by using Set-Content).

Twitter This Tip! ReTweet this Tip!