【发布时间】:2022-11-30 06:49:52
【问题描述】:
我想执行 .exe 文件,但执行该工具后需要键入 y/n 然后输入以继续该过程。是否可以通过键入 y/n 并输入来在没有任何人为干预的情况下执行它?
非常感谢你的想法。
【问题讨论】:
-
尝试
'y' | & 'path\to\my.exe'它可能会或可能不会 :P
标签: powershell exe silent
我想执行 .exe 文件,但执行该工具后需要键入 y/n 然后输入以继续该过程。是否可以通过键入 y/n 并输入来在没有任何人为干预的情况下执行它?
非常感谢你的想法。
【问题讨论】:
'y' | & 'path\to\my.exe' 它可能会或可能不会 :P
标签: powershell exe silent
如何使用 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"
【讨论】: