Skip to content

Instantly share code, notes, and snippets.

@JeremyTBradshaw
Last active December 1, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyTBradshaw/79f826015653369e5e901bcb4b5cbb30 to your computer and use it in GitHub Desktop.
Save JeremyTBradshaw/79f826015653369e5e901bcb4b5cbb30 to your computer and use it in GitHub Desktop.
#Requires -Version 5.1
using namespace System.Management.Automation.Host
switch (
$host.UI.PromptForChoice(
"Caption (e.g. 'XYZ has come up!')",
"Message (e.g. 'How would you like to proceed?",
[ChoiceDescription[]]@(
[ChoiceDescription]::new('&Proceed', 'Help message'),
'&Abort',
'&Suspend'
),
0 # Default choice
)
) {
0 { <# Proceed #> }
1 { <# Abort #> }
2 { <# Suspend #> }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment