Type: bool; Default value: $false (named) This argument specifies whether the parameter accepts all of the remaining arguments that are not bound to the parameters of the function. A value of $true indicates that it does. A value of $false indicates that it does not. The following example shows a parameter $others that accepts all the remaining arguments of the input object that is passed to the function Test: param ( [parameter(Mandatory = $true)][int] $p1, [parameter(Mandatory = $true)][int] $p2, [parameter(ValueFromRemainingArguments = $true)] [string[]] $others ) Test 10 20 # $others has Length 0 Test 10 20 30 40 # $others has Length 2, value 30,40 An implementation may define other attributes as well. Windows PowerShell: The following attributes are provided as well: HelpMessageBaseName: Specifies the location where resource identifiers reside. For example, this parameter could specify a resource assembly that contains Help messages that are to be localized. HelpMessageResourceId: Specifies the resource identifier for a Help message. The ValidateCount attribute This attribute is used in a script-parameter to specify the minimum and maximum number of argument values that the parameter can accept. The following arguments are used to define the characteristics of the parameter: Parameter Name Purpose MinLength (position 0) Type: int This argument specifies the minimum number of argument values allowed. MaxLength (position 1) Type: int This argument specifies the maximum number of argument values allowed. In the absence of this attribute, the parameter's corresponding argument value list can be of any length. Consider a function call Test that has the following param block, and which is called as shown: param ( [ValidateCount(2,5)] [int[]] $Values )
(named) Type: bool; Default value: $false This argument specifies whether the parameter accepts all of the remaining arguments that are not bound to the parameters of the function. A value of $true indicates that it does. A value of $false indicates that it does not. The following example shows a parameter $others that accepts all the remaining arguments of the input object that is passed to the function Test: param ( [parameter(Mandatory = $true)][int] $p1, [parameter(Mandatory = $true)][int] $p2, [parameter(ValueFromRemainingArguments = $true)] [string[]] $others ) Test 10 20 # $others has Length 0 Test 10 20 30 40 # $others has Length 2, value 30,40 An implementation may define other attributes as well. Windows PowerShell: The following attributes are provided as well: HelpMessageBaseName: Specifies the location where resource identifiers reside. For example, this parameter could specify a resource assembly that contains Help messages that are to be localized. HelpMessageResourceId: Specifies the resource identifier for a Help message. The ValidateCount attribute This attribute is used in a script-parameter to specify the minimum and maximum number of argument values that the parameter can accept. The following arguments are used to define the characteristics of the parameter: Parameter Name Purpose MinLength (position 0) Type: int This argument specifies the minimum number of argument values allowed. MaxLength (position 1) Type: int This argument specifies the maximum number of argument values allowed. In the absence of this attribute, the parameter's corresponding argument value list can be of any length. Consider a function call Test that has the following param block, and which is called as shown: param ( [ValidateCount(2,5)] [int[]] $Values )
PowerShell%202%200%20Language%20Specification.docx