Line Break in PowerShell
- Line Breaks in PowerShell
-
Use
`N
to Break Lines in PowerShell -
Use
[Environment]::NewLine
to Break Lines in PowerShell

This tutorial will teach you to break lines in PowerShell.
Line Breaks in PowerShell
PowerShell includes a set of special character sequences for representing characters, such as line breaks and tabs. They are also known as escape sequences.
The backslash \
shows a special character in most programming languages. But, PowerShell uses the backtick character `
.
So, escape sequences begin with `
and are case-sensitive.
Examples of escape sequences are `0
, `a
, `b
, `e
, `f
, `n
, `r
, etc. Escape sequences are only interpreted when enclosed in double-quotes " "
.
Use `N
to Break Lines in PowerShell
You can use the new line `n
character to break lines in PowerShell. The line break or new line is added after the `n
character.
The following example shows how to use `n
to break lines in the output.
Write-Host "Welcome to the`nPowerShell Tutorial."
Output:
Welcome to the
PowerShell Tutorial.
You can use multiple `n
characters to create multiple line breaks.
Write-Host "Welcome `nto `nthe `nPowerShell Tutorial."
Output:
Welcome
to
the
PowerShell Tutorial.
Use [Environment]::NewLine
to Break Lines in PowerShell
You can also use the [Environment]::NewLine
object to break lines or add a new line to command output in PowerShell. It is equivalent to `n`r
.
The `r
character moves the cursor to the beginning of the current line.
The following example shows how to use [Environment]::NewLine
to break lines when displaying the array items in the output.
$number='one','two','three','four'
$new = [Environment]::NewLine
$number | ForEach {"$_$new"}
Output:
one
two
three
four
We hope this article helps you understand how to break lines in PowerShell.