Creating a menu in powershell using items in an array of unknown size as options

bartyam

New Member
I'm looking to create a command line menu in powershell, with the options coming from an array of unknown size.I had previously been using a switch statement, but at that time I knew how many options there were going to be. Now, the options are being parsed from an XML file, and changing all of the time, so the old way won't work.This is the old way:\[code\]switch ($a) { 1 { Write-Host $USR_ID "on SERVER "$SERVER_NAME"`n" $query = $USR_ID } 2 { Write-Host $PRFL_NM "on SERVER "$SERVER_NAME"`n" $query = $PRFL_NM } 3 { Write-Host $APP_NM "on SERVER "$SERVER_NAME"`n" $query = $APP_NM } 4{ Write-Host $COMBO "on SERVER " $SERVER_NAME"`n" $query = $COMBO confirm } default { "** Invalid Input **"; exit }}\[/code\]Anybody got any ideas?Thanks!
 
Back
Top