主题
about_Reserved_Words
简短说明
列出 Windows PowerShell 中因具有特殊含义而不能用作标识符的保留字。
详细说明
在 Windows PowerShell 中存在一些具有特殊含义的单词。当这些单词不在引号中出现时,
Windows PowerShell 将尝试应用其特殊含义,而不是将其作为字符串处理。若要将这些
单词用作命令或脚本中形式参数的实际参数,而不调用其特殊含义,请将保留字括在引号中。
以下为 Windows PowerShell 中的保留字:
Break
Continue
Do
Else
Elseif
Filter
For
Foreach
Function
If
In
Local
Private
Return
Switch
Until
Where
While
有关语言语句(例如 Foreach、If、For 和 While)的信息,请键入“get-help”,再键入前缀
“about_”,然后键入语句的名称。例如,若要获取有关 Foreach 语句的信息,请键入:
get-help about_foreach
有关 Filter 语句或 Return 语句语法的信息,请键入:
get-help about_functions
另请参阅
about_Command_Syntax
about_Escape_Characters
about_Parsing
about_Quoting_Rules
about_Script_Blocks
about_Special_Characters