PowerTip: New Lines with PowerShell

Doctor Scripto

Summary: Create new lines with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to add a new line between lines for my text output?

Hey, Scripting Guy! Answer Use the `n character, for example:

PS C:\> "string with new line `n in it"

string with new line

 in it

Note  If you need a carriage return, use `r. For a carriage return and a new line, use `r`n.

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Shinish Sasidharan 0

     `r`n. Works like a charm!! Thanks

  • Markus Wehr 0

    How to remember? first r then n like “ReturN”

    • Nikolay Kozhemyak 1

      Could be more self-describing like Return Newline.

Feedback usabilla icon