Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Make `n to create a new line for redirected output

$
0
0

Hello

I have a string as below:

$String = "Test1`nTest2"

While printing to screen, I have 2 lines. But on redirection I get one line.

Code: $String >> Log.log

Output for Log.log: Test1Test2

How can I make`n to create a new line for logging mechanism. I tried to use Replace function  for 'n and [Environment]::NewLine but I didn't run it.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles