【notes 1】manning windows powershell in action

From $2.2

 

1, One problem with using matching quotes as we did in the previous examples is that<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

you have to remember to start the token with an opening quote. This raises an issue

when you want to quote a single character. You can use the backquote ( ` ) character

to do this (the backquote is usually the upper leftmost key, below escape):

PS (6) > cd c:/program` files

PS (7) > pwd

Path

----

C:/Program Files

 

2, what’s the difference between simple and double quotes?

In double quotes, variables are expanded. In other words, if the string contains a variable

reference starting with a “$”, it will be replaced by the string representation of the

value stored in the variable. Let’s look at an example of this. First assign the string

"files" to the variable $v:

PS (10) > $v = "files"

Now let’s reference that variable in a string with double quotes:

PS (11) > cd "c:/program $v"

PS (12) > pwd

Path

----

C:/Program Files

 

3, lists the special characters that can be generated using backtick (also called

escape) sequences.

Table 2.1 Backtick escape sequences

Escape Sequence Corresponding Special Character

`n Newline

`r Carriage return

`t Horizontal tab

`a Alert

`b Backspace

`' Single quote

`" Double quote

`0 Null

`` A single backtick

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章