Generates a dynamic console menu featuring a list of options, allowing users to navigate and select choices using their keyboard arrows.
title : [string/optional]
Title for the menu.
Defaults: "Please make a selection..."
caption: [string/optional]
Menu caption (or title).
Defaults: ""
choices: [array/required]
List of choices to display in the menu.
yselect: [string/optional]
Text to display when the cursor is on the selected option.
Defaults: "🡢"
nselect: [string/optional]
Text to display when the cursor is not on the selected option.
Defaults: " "
default: [int/optional]
Index of the default option selected from the choices.
Don't forget that every array starts counting from zero.
Defaults: 0
# This example shows how to use the Show-Menu function to display a menu with a custom title and three options.
$choice = show-menu -title "Main Menu" -caption "Select an option." -default 2 -choices (
"Menu Option 1",
"Menu Option 2",
"Menu Option 3"
)
write-host "`nYou chose: $choice`n`n"