Powershell 如何创建带有是/否按钮和信息标记图标的弹出窗口?
我需要在PowerShell中有一个弹出窗口,其中包含带有“是”和“否”按钮的信息标记图标 我目前的代码如下:Powershell 如何创建带有是/否按钮和信息标记图标的弹出窗口?,powershell,popup,Powershell,Popup,我需要在PowerShell中有一个弹出窗口,其中包含带有“是”和“否”按钮的信息标记图标 我目前的代码如下: $wshell = New-Object -ComObject Wscript.Shell $answer = $wshell.Popup("Do you want to continue?",0,"Alert",0x4) if($answer -eq 7){exit} Stop 16 Question 32
$wshell = New-Object -ComObject Wscript.Shell
$answer = $wshell.Popup("Do you want to continue?",0,"Alert",0x4)
if($answer -eq 7){exit}
Stop 16
Question 32
Exclamation 48
Information 64
OK 0
OKCancel 1
AbortRetryIgnore 2
YesNoCancel 3
YesNo 4
RetryCancel 5
只有“是”或“否”部分。我也需要一个图标。你可以这样做:
$answer = $wshell.Popup("Do you want to continue?",0,"Alert",64+4)
图标的设置如下所示:
$wshell = New-Object -ComObject Wscript.Shell
$answer = $wshell.Popup("Do you want to continue?",0,"Alert",0x4)
if($answer -eq 7){exit}
Stop 16
Question 32
Exclamation 48
Information 64
OK 0
OKCancel 1
AbortRetryIgnore 2
YesNoCancel 3
YesNo 4
RetryCancel 5
按钮的值如下所示:
$wshell = New-Object -ComObject Wscript.Shell
$answer = $wshell.Popup("Do you want to continue?",0,"Alert",0x4)
if($answer -eq 7){exit}
Stop 16
Question 32
Exclamation 48
Information 64
OK 0
OKCancel 1
AbortRetryIgnore 2
YesNoCancel 3
YesNo 4
RetryCancel 5
因此,信息图标和是/否按钮为64+4
在这种情况下,使用问题图标更有意义,因为你是在问问题,而不仅仅是在传达信息,所以在这种情况下是32+4。
有很多方法可以满足你的需求
或者这个
[System.Windows.Forms.MessageBox]::Show("We are proceeding with next step." , "Status" , 4, 64)
[System.Windows.Forms.MessageBox]::Show("Continue Task?","What a Mess", "YesNo" , "Information" , "Button1")
[void][System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.VisualBasic’)
# [microsoft.visualbasic.interaction]::Msgbox($message,"$button,$icon",$title)
[Microsoft.VisualBasic.Interaction]::MsgBox(“Do you agree?”, ‘YesNoCancel,Information’, “Respond please”)
或者这个
[System.Windows.Forms.MessageBox]::Show("We are proceeding with next step." , "Status" , 4, 64)
[System.Windows.Forms.MessageBox]::Show("Continue Task?","What a Mess", "YesNo" , "Information" , "Button1")
[void][System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.VisualBasic’)
# [microsoft.visualbasic.interaction]::Msgbox($message,"$button,$icon",$title)
[Microsoft.VisualBasic.Interaction]::MsgBox(“Do you agree?”, ‘YesNoCancel,Information’, “Respond please”)
或者这个
[System.Windows.Forms.MessageBox]::Show("We are proceeding with next step." , "Status" , 4, 64)
[System.Windows.Forms.MessageBox]::Show("Continue Task?","What a Mess", "YesNo" , "Information" , "Button1")
[void][System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.VisualBasic’)
# [microsoft.visualbasic.interaction]::Msgbox($message,"$button,$icon",$title)
[Microsoft.VisualBasic.Interaction]::MsgBox(“Do you agree?”, ‘YesNoCancel,Information’, “Respond please”)