gpt4 book ai didi

forms - "Are you sure?"通过 powershell 中的消息框

转载 作者:行者123 更新时间:2023-12-03 01:09:50 31 4
gpt4 key购买 nike

早安开发者,

我正在尝试在 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
}

补充阅读: http://powershell-tips.blogspot.com.by/2012/02/display-messagebox-with-powershell.html

关于forms - "Are you sure?"通过 powershell 中的消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41179883/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com