Question:
I need to have a popup window in PowerShell that has the information mark icon with yes & no buttons.
My current code is as follows:
1 2 3 4 5 |
$wshell = New-Object -ComObject Wscript.Shell $answer = $wshell.Popup("Do you want to continue?",0,"Alert",0x4) if($answer -eq 7){exit} |
With only the yes or no part. I need an icon there too.
Answer:
You can do it like this:
1 2 |
$answer = $wshell.Popup("Do you want to continue?",0,"Alert",64+4) |
The values for the icons are as follows:
1 2 3 4 5 |
Stop 16 Question 32 Exclamation 48 Information 64 |
The values for the buttons are as follows:
1 2 3 4 5 6 7 |
OK 0 OKCancel 1 AbortRetryIgnore 2 YesNoCancel 3 YesNo 4 RetryCancel 5 |
So information icon and yes/no buttons is 64 + 4
IMO in this situation it makes more sense to use a question icon since you are asking a question rather than just conveying information so it would be 32 + 4 in that case.