On Sun, 29 Jan 2017 00:45:17 +0000, "
mic...@tempo.com"
<
mic...@tempo.com> wrote in microsoft.public.windows.powershell:
>I'm running a powershell script viaa TFS and want to write a log file to
>stderr. I've tried using write-error but all the line feeds are removed
>when writing and the result is difficult to read.
>
>What I'm doing is:
>
>$c=Get-Content logfile.txt
>Write-Error "$c"
>
>But this writes everything on one line [...]
Yes. That is what happens when you stringify an array.
>Is there a better way to write a file to standard error so that it
>retains it's line breaks?
write-error never sees the line breaks. You are removing them beforehand
by stringifying $c. Just don't do that.
Just see the differnce in output between
$c
"$c"
jue