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

后端 未结 5 1709
旧时难觅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 13:57

    I was trying to kill a pesky startup program and found that the Stop-Process and / or the program would not accept a piped input (no Echo Y | for me!) but I changed JPs answer a little bit: Stop-Process -name [program.name] -Force ; ran as administrator and it worked like a charm.

提交回复
热议问题