I'm curious to see Jeffery's answer, but in the mean time, this will work.
#Keep looping and running the menu until the user selects Q (or q).
Do {
#use a Switch construct to take action depending on what menu choice is selected.
$back = 1
Switch (Show-Menu $menu1 "Menu1" -clear) {
"1" {
Do {
Switch (Show-menu $menu2 "Menu2" -clear) {
"1" {
}
"2" {
}
"0" {$back = 0}
} #switch
} #do
While ($back)
} #menu
"2" {}
"Q" {Write-Host "End" -ForegroundColor Cyan
Return
}
Default {Write-Warning "Wrong choice, try again"
sleep -seconds 1}
} #switch
} While ($True)