Hi,
I am trying to run the script with Label and Switch in Menu format so that the main module calls the submodule and ends in the submodule. The submodule should be able to call another module.
Please correct the script, as I think I am going wrong
Do { Write-Host " ----------MENU A----------
1 = option 1
2 = Option 2
3 = Option 3
---------------------------"
$choice1 = read-host -prompt "Select number & press enter" }
until ($choice1 -eq "1" -or $choice1 -eq "2" -or $choice1 -eq "3")
Switch ($choice1)
{ "1" break :module1
"2" break :module2
"3" break :module3
}
module1
{
Do { Write-Host " ----------MENU B----------
1 = option 1
2 = Option 2
---------------------------"
$choice2 = read-host -prompt "Select number & press enter" }
until ($choice2 -eq "1" -or $choice2 -eq "2")
Switch ($choice2)
{ write "Module 2"
"1" break :module2
"2" break :module3
}
}
module2
{
Do { Write-Host " ----------MENU C----------
1 = option 1
---------------------------"
$choice3 = read-host -prompt "Select number & press enter" }
until ($choice3 -eq "1")
Switch ($choice3)
{ write "Module 3"
"1" break :module2
}