Advertisement
About80Ninjas

Question

Jan 8th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #requires -Version 1
  2. $title = 'Question'
  3. $message = 'Do you want to do somthing?'
  4.  
  5. $yes = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes', 'yes, yes I do.'
  6.  
  7. $no = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList '&No', 'No no no'
  8.  
  9. $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
  10.  
  11. $result = $host.ui.PromptForChoice($title, $message, $options, 1)
  12.  
  13. switch ($result){
  14.     0 {'You selected Yes.'}
  15.     1 { 'You selected No.'}
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement