Command Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Defines a command that contains a single cmdlet or script. The Command object is used by the PowerShell and Pipeline objects to define a single command.
Namespace: System.Management.Automation.Runspaces
Assembly: System.Management.Automation (in System.Management.Automation)
System.Management.Automation.Runspaces Namespace
AddCommand
PowerShell Class
Invoke
InvokeAsync
Pipeline
PSCommand
Command Class
CommandCollection
Commands
Namespace: System.Management.Automation.Runspaces
Assembly: System.Management.Automation (in System.Management.Automation)
The Command object can be used in two ways.
-
The AddCommand method of the PowerShell object can use the Command object when creating a pipeline.
-
The Invoke or InvokeAsync methods of the Pipeline object can use the Command object when invoking the pipeline.
In this case, the Command objects are contained in a CommandCollection that is accessed through the Commands property.
Windows PowerShell provides two classes that can define a command. The PSCommand class allows you to build a pipeline of commands (A|B|C) that contain one or more cmdlets and scripts. In contrast, the Command class allows you to specify only a single cmdlet or script in the command.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Target Platforms
Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Server 2008, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional, Windows Vista, Windows Server 2003 R2, Windows XP, Windows 7, Windows 2008 R2, Windows Developer Preview, Windows Server Developer PreviewReference
Command MembersSystem.Management.Automation.Runspaces Namespace
AddCommand
PowerShell Class
Invoke
InvokeAsync
Pipeline
PSCommand
Command Class
CommandCollection
Commands
Other Resources
Windows PowerShell SDKSend comments about this topic to Microsoft.