PowerShell入门:命令、帮助与基础概念
1. PowerShell命令探索
PowerShell和大多数语言一样,拥有命令,它是可执行命名表达式的通用术语。命令可以是任何东西,从传统的 ping.exe 工具到之前提到的 Get-Alias 命令,甚至你还能创建自己的命令。不过,若使用不存在的命令,就会看到著名的红色错误文本,例如:
PS> foo
foo : The term 'foo' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ foo
+ ~~~
+ CategoryInfo : ObjectNotFound: (foo:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
你可以执行 Get-Command 来查看PowerShell默认已知的所有命令列表。多数命令名称遵循 Verb-Noun 的模式,这是PowerShell的独特之处。虽然遵循此命名约定并非强制,但在创建自己的命令
超级会员免费看
订阅专栏 解锁全文
38

被折叠的 条评论
为什么被折叠?



