Forms &引用;你确定吗?”;通过powershell中的messagebox

Forms &引用;你确定吗?”;通过powershell中的messagebox,forms,xaml,powershell,Forms,Xaml,Powershell,早上好 我正在尝试在powershell中创建删除函数。我想要这样的东西: function deleteEnv(){ $result = [System.Windows.Forms.MessageBox]::Show('Are you sure?''Yes', 'No' 'Info') if(yes){ //Delete } else { //do nothing } } 单击“删除”按钮时,必须首先显示一个消息框,其中有两个按钮“是”或“否”。如果是,则“删

早上好

我正在尝试在powershell中创建删除函数。我想要这样的东西:

  function deleteEnv(){
    $result = [System.Windows.Forms.MessageBox]::Show('Are you sure?''Yes', 'No' 'Info')
    if(yes){
     //Delete
}

else {
//do nothing
}
}
单击“删除”按钮时,必须首先显示一个消息框,其中有两个按钮“是”或“否”。如果是,则“删除”,否则不执行任何操作。我该怎么做

问候

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$result = [System.Windows.Forms.MessageBox]::Show('Are you sure?' , "Info" , 4)
if ($result -eq 'Yes') {
    do stuff
}
补充阅读: