Prompt for choice in PowerShell The article provides a PowerShell script example demonstrating how to use the `$host.UI.PromptForChoice` method to present a user with three options: "Yes", "No", and "Cancel". It sets a title, prompt text, and a default selection, then uses a switch statement to execute different code blocks based on the user's choice. Demo-Choices.ps1 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters PromptForChoice Args $Title = "Do you want to proceed further?" $Prompt = "Enter your choice" $Choices = System.Management.Automation.Host.ChoiceDescription @ "&Yes", "&No", "&Cancel" $Default = 1 Prompt for the choice $Choice = $host.UI.PromptForChoice $Title, $Prompt, $Choices, $Default Action based on the choice switch $Choice { 0 { Write-Host "Yes - Write your code"} 1 { Write-Host "No - Write your code"} 2 { Write-Host "Cancel - Write your code"} }