Cmdlet
Read-ConsoleNumber
Asks for a number.
Syntax
Read-ConsoleNumber [-Default <Decimal>] [-Description <String>] [-Integer] [-Maximum <Decimal>] [-Minimum <Decimal>] [-Mode <Rich|Line|Accessible>] [-ParameterName <String>] [-Step <Decimal>] [-Title] <String> [-Validate <ScriptBlock>] [<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Asks for a number.
Whole numbers with -Integer (returns [int]), decimals otherwise (returns [decimal]). -Minimum and -Maximum are shown as a hint and checked; Up and Down step by -Step (PgUp and PgDn by ten steps).
Examples
EXAMPLE 1
Read-ConsoleNumber -Title 'Value'Parameters
- -Default Decimal
- The default.
- -Description String
- Help text under the question.
- -Integer SwitchParameter
- Accepts whole numbers only and returns [int].
- -Maximum Decimal
- The largest value.
- -Minimum Decimal
- The smallest value.
- -Mode InteractionMode
- Forces how to ask: Rich (in-place prompt), Line (question and typed answer), Accessible (numbered, no redraws) or None (use the default or fail).
- Possible values:
Rich,Line,Accessible - -ParameterName String
- The parameter of your script that supplies this value without a prompt (named in the non-interactive error, for example -Domain).
- -Step Decimal
- The step of Up and Down (default 1).
- -Title String
- The question.
- -Validate ScriptBlock
- A validator: $_ is the number; return $true, $false or an error message.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.