什么是完整的 PowerShell 命令?

What is a full-fledged PowerShell command?

如果 -let 是一个小后缀,PowerShell 命令被称为 command-lets,什么是完整的 PowerShell 命令?

'cmdlets' 用于将 PowerShell commandlet 与传统 shell 中的命令进行比较,而不是与 PowerShell 中的其他内容进行比较。例如:

A cmdlet (pronounced "command-let") is a single-feature command that manipulates objects in Windows PowerShell. You can recognize cmdlets by their name format -- a verb and noun separated by a dash (-), such as Get-Help, Get-Process, and Start-Service.

In traditional shells, the commands are executable programs that range from the very simple (such as attrib.exe) to the very complex (such as netsh.exe).

In Windows PowerShell, most cmdlets are very simple, and they are designed to be used in combination with other cmdlets.

和:

A cmdlet is a lightweight command that is used in the Windows PowerShell environment. [..] Cmdlets perform an action and typically return a Microsoft .NET Framework object to the next command in the pipeline.

How Cmdlets Differ from Commands

Cmdlets differ from commands in other command-shell environments in the following ways:

  • Cmdlets are instances of .NET Framework classes; they are not stand-alone executables.

  • Cmdlets can be created from as few as a dozen lines of code.

  • Cmdlets do not generally do their own parsing, error presentation, or output formatting. Parsing, error presentation, and output formatting are handled by the Windows PowerShell runtime.

  • Cmdlets process input objects from the pipeline rather than from streams of text, and cmdlets typically deliver objects as output to the pipeline.

  • Cmdlets are record-oriented because they process a single object at a time.