UI/Get-Choice.ps1
function Get-Choice { Param( $Caption = "Please select a value", $Message="Values", [parameter(Mandatory=$true)] $ChoiceList, [int] $DefaultChoice = 0, [switch] $ReturnChoiceIndex ) $Choices = [System.Management.Automation.Host.ChoiceDescription[]] $ChoiceList $ChoiceIndex = $host.ui.PromptForChoice($Caption,$Message, $Choices, $DefaultChoice) If ($ReturnChoiceIndex){ Return $ChoiceIndex } # Else Return $ChoiceList[$ChoiceIndex].Replace("&","") } Export-ModuleMember -Function Get-Choice |