如何“回答"PowerShell 中的控制台输入提示(在代码中) [英] How to "answer" a console input prompt in PowerShell (in the code)

查看:51
本文介绍了如何“回答"PowerShell 中的控制台输入提示(在代码中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用第三方软件供应商提供的 PowerShell 命令行实用程序.他们的 cmdlet 之一提示输入;但是,我想通过在代码中输入值而不是输入提示来绕过此提示.有没有办法在 PowerShell 脚本中做到这一点?

I am using a PowerShell command line utility from a third party software vendor. One of their cmdlets prompts for input; however, I would like to bypass this prompt by entering the value in the code rather than the input prompt. Is there a way to do this in PowerShell script?

他们的 cmdlet 是这样的:

Their cmdlet is something like this:

设置配置

所以,我试过了:

Set-Config -config "blah"

Set-Config -config "blah"

运气不好.

推荐答案

Hrad 通过查看 cmdlet 来告诉我们.通过查看您的代码,我假设有一个 Config 参数,对吗?如果是这样,我也会寻找一个 Force 参数并使用它.通常通过强制参数抑制确认.

Hrad to tell with looking at the cmdlet. By looking at your code I assume there is a Config parameter, am I right? If so, I would also look for a Force parameter and use it. Usually thr Force parameter supress confirmations.

这篇关于如何“回答"PowerShell 中的控制台输入提示(在代码中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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