Feed choice menu with options

07/01/2012 01:36

#Feed choice menu with options.

function SelectChoice

if(($options.length -gt 1))
        write-host "======================================================="
        write-host "There are more options of parameter, choose the number."
        write-host "======================================================="
        for($i=0; $i -le $options.length-1; $i++)
                write-host ($i+1) ". " $options[$i]
        $index=read-host "Select the option number."
        #write-host "You selected number "$index " with value " $options[$index-1]
        return $result
    #write-host "They are no choices, only this one value: "$options[0]
    return $result

#array input
$pole=1, 2, 10, 16
$a=SelectChoice -options $pole
write-host "Call result: "$a

#collection input
$b=SelectChoice -options $c
write-host "Call result: "$b

#single value input
$d=SelectChoice -options $single
write-host "Call result: "$d