运行结果为:复制代码
- $a="World"
- "Hello, $a"
PS E:\> $a="World" PS E:\> "Hello, $a" Hello, World |
则输出结果为:复制代码
- $a="World"
- 'Hello, $a'
PS E:\> $a="World" PS E:\> 'Hello, $a' Hello, $a |
运行结果为:复制代码
- $a="PowerShell"
- 'I''m $a'
PS E:\> $a="PowerShell" PS E:\> 'I''m $a' I'm $a |
PS E:\> 'I"m $a' I"m $a |
PS E:\> "Print a single quote:'" Print a single quote:' PS E:\> "Print a double quote:"" " Print a double quote:" |
运行结果如下:复制代码
- $a="PowerShell"
- """My name is $a"",this program said."
PS E:\> """My name is $a"",this program said." "My name is PowerShell",this program said. |
`' | 单引号 |
`" | 双引号 |
`0 | 空值 NULL |
`a | 报警 |
`b | 退格 |
`f | 跳页 |
`n | 新行 |
`r | 换行 |
`t | 横向Tab键(水平制表符) |
`v | 纵向Tab键(纵向制表符) |
输出结果将为:复制代码
- $a="PowerShell"
- """My name is `$a"",this program said."
上面的命令非常长,不仅不便于我们的输入,也不便于修改、查看,所以,可以使用反引号修改如下:复制代码
- Get-WmiObject Win32_NetworkAdapterConfiguration | Get-Member -MemberType Methods | Format-List
只需在命令结束后多敲一次回车,表示全部命令输入完毕即可,在命令中使用反引号与否,最终的运行结果是一样的。复制代码
- Get-WmiObject Win32_NetworkAdapterConfiguration |`
- Get-Member -MemberType Methods |`
- Format-List
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |