[System.Environment]::NewLine not working in Console, but works in ISE

I just noticed this but feel i have not had this problem in the past. Can anyone verify and or give me some insight? I am sure there is an easier way to show off this difference but this just happened to be how i was using it.

Code

$temp = @" AAA BBB "@ $temp2 = $temp $temp = $temp -split [System.Environment]::NewLine $temp2 = $temp2 -split "n" $temp.GetType() $temp.Count $temp2.GetType() $temp2.Count 

Output ISE

IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String[] System.Array 2 True True String[] System.Array 2 

Output Console

IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String[] System.Array 1 True True String[] System.Array 2 

My $host is Version : 5.1.17763.134

submitted by /u/justusiv
[link] [comments]

Leave a Reply