In my profile.ps1 file, I have various functions with line widths greater
than 80 columns. My console is 80 columns.
If I use the following:
get-content function:foo >filename
The function body will be written to the filename, but the lines will be
wrapped at the width of the console. This of course results in invalid code
when the end of a comment is on its own line, or a variable name gets cut
off in the middle.
I've had to do the following:
(get-content function:foo).ToString() >filename
Which works as expected.
I imagine there are probably other instances of the console formatting being
applied to things that are being sent to a text file.