Mostrar Mensaje de Confirmacion en PowerShell

$caption = "TITLE"
$message = "MESSAGE"
$yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes","HELP_FOR_YES"
$no = new-Object System.Management.Automation.Host.ChoiceDescription "&No","HELP_FOR_NO"
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
$answer = $host.ui.PromptForChoice($caption,$message,$choices,0)
if($answer -eq 0){
    //YOUR_CODE_IF_YES
}

Categories:

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *