Windows PowerShell Backtick `

 

  • Backtick allows you to word-wrap PowerShell commands
1. # Backtick ` PowerShell word-wrap
    Get-Service * |Sort-Object ServiceType `
    | Format-Table name, status, `
    ServiceType, CanStop, –auto

2. Get-Service * |Sort-Object ServiceType | Format-Table name, ServiceType, status, CanStop, –auto

Above two commands are the same.

 

  • Problem with PowerShell's backtick and whitespace

Here is a really nasty problem with the PowerShell backtick, and that is if you inadvertently add whitespace after the ` and before the actual end of the line.

 

  • The PowerShell Backtick as an Escape Character
Escape sequence Corresponding Special Character
`n Newline
`t Horizontal tab
`a Alert
`b Backspace
`' Single quote
`" Double quote
`0 The NULL character (in other words, 0)
`` A single backtick
posted @ 2012-12-30 14:01  HelloWorld.Michael  阅读(274)  评论(0编辑  收藏  举报