【问题标题】:How to execute .exe file silently using powershell?如何使用powershell静默执行.exe文件?
【发布时间】:2022-11-30 06:49:52
【问题描述】:

我想执行 .exe 文件,但执行该工具后需要键入 y/n 然后输入以继续该过程。是否可以通过键入 y/n 并输入来在没有任何人为干预的情况下执行它?

非常感谢你的想法。

【问题讨论】:

  • 尝试 'y' | & 'path\to\my.exe' 它可能会或可能不会 :P

标签: powershell exe silent


【解决方案1】:

如何使用 while 循环直到输入正确的字符:

# run the exe
calc.exe

$response = "N"

while ($response -ne "Y")
{
    $response = Read-Host -Prompt "Press Y/N"
}

# this is the rest of the process
Write-host "continuing the process"

【讨论】:

    猜你喜欢
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 2011-06-06
    • 1970-01-01
    • 2019-02-19
    • 2017-10-15
    • 2021-03-26
    相关资源
    最近更新 更多