Windows PowerShell offers several facilities for working with plain-text data.
To define a literal string (one in which no variable or escape expansion occurs), enclose it in single quotes:
To define an expanding string (one in which variable and escape expansion occurs), enclose it in double quotes:
To include a single quote in a single-quoted string, or a double quote in a double-quoted string, you may include two of the quote characters in a row:
To define a here string (one that may span multiple lines), place the two characters @” at the beginning, and the two characters “@ on their own line at the end.
For example:
Here strings may be of either the literal or expanding variety.
Windows PowerShell supports the following escape sequences inside of strings:
Windows PowerShell escape sequences | |
---|---|
Sequence | Meaning |
| The null character. |
| The alarm character. Generates a beep when displayed on the console. |
| The backspace character. The previous character remains in the string but is overwritten when displayed on the console. |
| A form feed. Creates a page break when printed on most printers. |
| A newline. |
| A carriage return. Newlines in
PowerShell are indicated entirely by the |
| A tab. |
| A vertical tab. |
’’ (Two single quotes) | A single quote, when in a literal string. |
‘’ (Two double quotes) | A double quote, when in an expanding string. |
| That character, taken literally. |
3.137.221.163