小编Mav*_*vid的帖子

Powershell - 提示用户在xx秒后过期提示

我正在尝试显示用户操作的提示,如果不采取任何操作,则提示关闭并继续执行脚本.这是我的命令提示符对话框configuraiton


$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&Cancel",""
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no,$cancel)
$caption = "Caption message here"
$dialogmessage = ("Do you want to do something?:`n")

$timer = #set some value
#While the value is grater than zero keep the prompt open

while($timer -gt 0)
{
    $result = $Host.UI.PromptForChoice($caption,$dialogmessage,$choices,0)

    if($result -eq 0){Write-Host "Yes was selected"}

    if($result -eq 1){Write-Host "No was selected"}

    if($result -eq 2){Write-Host "Canceled by user.";exit}
 }
Run Code Online (Sandbox Code Playgroud)

我已经在互联网上上下移动了,我已经看到这在C#中实现了,但对于我的生活,我无法确定PowerShell的最佳方法.我将不胜感激任何帮助.

谢谢

编辑:谢谢诺亚,这里是更新的代码,它更加紧凑!

        $prompt = new-object …
Run Code Online (Sandbox Code Playgroud)

powershell prompt timer timed

7
推荐指数
1
解决办法
6862
查看次数

如何诊断,调试MinGW-get GUI(guimain.exe)崩溃?

最初,我想使用MinGW-get GUI安装更新的MinGW软件包,但是当我从"安装"下拉菜单中选择"标记所有升级"时(无论我是否更新目录),它都会崩溃.

现在,我想弄明白为什么guimain.exe会崩溃.

在我的计算机上崩溃的MinGW-get GUI的屏幕截图

如何诊断和调试此持久性问题?我对GDB模糊不清,但我从未使用它.我不承诺使用Visual Studio调试器.

我假设我需要在最新的MinGW安装程序分支中使用一些辅助二进制文件或调试库:https://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta- 20131004-1 /

有人可以指导我吗?任何帮助或建议阅读表示赞赏.

windows gcc gnu mingw mingw-w64

5
推荐指数
2
解决办法
981
查看次数

标签 统计

gcc ×1

gnu ×1

mingw ×1

mingw-w64 ×1

powershell ×1

prompt ×1

timed ×1

timer ×1

windows ×1