Tag Archives: text based

Powershell: A text based menu

Hi,

a long time ago I wrote a Menu function for quickly choose predefined options in a script. An example

Source the menu.ps1 in your script and call  fShowMenu. This will show the menu. The function needs 2 parameters:
Parameter 1: The menu title as string
Parameter 2: A hashtable with the Menuentries. The key of an Menuitem is returned by the function the corresponding value is shown at the menu.

# Source the file
. .\menu.ps1
# Call Menu funtion
fShowMenu "Choose your favorite Band" @{"sl"="Slayer";"me"="Metallica";"ex"="Exodus";"an"="Anthrax"}
A text based Powershell Menu
A text based Powershell Menu

Continue reading Powershell: A text based menu

Advertisment to support michlstechblog.info