Powershell - Backtick



Backtick (`) operator is also called word-wrap operator. It allows a command to be written in multiple lines. It can be used for new line (`n) or tab (`t) in sentences as well. See the examples below −

Example 1

Get-Service * | Sort-Object ServiceType `
| Format-Table Name, ServiceType, Status -AutoSize

It will become

Get-Service * | Sort-Object ServiceType | Format-Table Name, ServiceType, Status -AutoSize

Verify the output as

Name                                                   ServiceType  Status
----                                                   -----------  ------
MSSQLServerADHelper100                             Win32OwnProcess Stopped
ntrtscan                                           Win32OwnProcess Running
...

Example 2

Use of new line and tab.

> Write-host "Title Subtitle"
Title Subtitle

> Write-host "Title `nSubtitle"
Title 
Subtitle

> Write-host "Title `tSubtitle"
Title   Subtitle
Print
Advertisements