我如何自动回答“是"?到 Powershell 中的提示? [英] How do I automatically answer "yes" to a prompt in Powershell?

查看:118
本文介绍了我如何自动回答“是"?到 Powershell 中的提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 PowerShell 会话中输入是"作为交互式问题的答案?我知道,在 Bash 中,Yes 是在提示中回答是"的工具.在我的情况下,我无法抑制提示.

How can I input "yes" as an answer to an interactive question in a PowerShell session? I know, in Bash, Yes is the tool to answer "yes" on the prompt. In my situation, I can't suppress the prompt.

我正在运行的脚本在

如果您想继续,请回复是":

Please reply "yes" if you want to continue:

powershell 如何运行脚本并在提示时回答"是?

How powershell can run the script and "answer" yes when pompted?

推荐答案

使用 ECHO 对我有用.我在 Powershell 脚本中运行 RSKeyMgmt.exe,它提示 Yes(Y)/No(N).所以当我做

Using ECHO worked for me. I am running RSKeyMgmt.exe in my Powershell script and it prompted Yes(Y)/ No(N). So when I do

ECHO Y |RSKeyMgmt.exe...

没有提示问题,命令执行正确.

It did not prompt the question and the command was executed correctly.

所以我认为 ECHO 'someoption' 也应该适用于其他情况.

So I think ECHO 'someoption' should work for other cases too.

这篇关于我如何自动回答“是"?到 Powershell 中的提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆