Command Attribute

The Command attribute is used to decorate a command class and is one of two required components of every command (the other being the InputCommand base class).

The Command attribute exposes two properties which can both be set as optional parameters within the constructor.

public Command(string name=null, string defaultParameterSet=null)

  • Name - specifies the name of the command by which it can be invoked from the command line - If this property is null, the name of the class will be used as the command name
  • DefaultParameterSet - specifies the name of the default parameter set for the command
    • This property is required if the command supports parameter sets
    • Likewise, if a Parameter attribute specifies a parameter set, then this property must have a value that matches one or more of the defined parameter sets

see also Command API, Parameter Sets, Creating Commands, Parameter Attribute

Last edited Apr 13, 2013 at 6:23 PM by jeffhewitt, version 11


No comments yet.