Export (0) Print
Expand All

Command Class

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.dll)

'Usage
Dim instance As Command

public sealed class Command
public final class Command
public final class Command

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.

This class cannot be inherited.


System.Object
  System.Management.Automation.Runspaces.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


Show:
© 2015 Microsoft