How do I automatically answer “yes” to a prompt in Powershell?

后端 未结 5 1710
旧时难觅i
旧时难觅i 2020-12-16 13:53

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

5条回答
  •  一个人的身影
    2020-12-16 14:18

    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.

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

提交回复
热议问题