About80Ninjas icon

Question

About80Ninjas | PRO | 01/08/16 01:54:25 PM UTC | 0 ⭐ | 383 👁️ | Never ⏰ | []
PowerShell |

540 B

|

None

|

0 👍

/

0 👎

#requires -Version 1
$title = 'Question'
$message = 'Do you want to do somthing?'
 
$yes = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes', 'yes, yes I do.'
 
$no = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList '&No', 'No no no'
 
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
 
$result = $host.ui.PromptForChoice($title, $message, $options, 1) 
 
switch ($result){
    0 {'You selected Yes.'}
    1 { 'You selected No.'}
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎