10

I have added ChocolateyGet as a provider on Powershell so I can use it with PackageManagement (OneGet), it works but every package I try to install warns:

https://www.chocolatey.org is not a trusted package source

Then asks for confirmation. It also asks me if I agree to the license of the package.

I wanted to make a script to automatically install some packages, but I needed this script to be unattended, and it's not possible now because it asks those two previous questions.

Is there anyway to circumvent/automatically respond these confirmations? Like the y or yes command on Linux?

4

2 回答 2

22

您需要-Force在任何 cmdlet 上有可用的 Force 属性的地方使用,否则如果没有但有确认,您可以使用-Confirm:$False与按 Yes 相同的行为。

但是要小心使用它,就好像您实际上不想处理该操作一样……您没有第二次机会。

于 2017-04-23T15:44:57.253 回答
2
choco feature enable -n allowGlobalConfirmation

将在安装过程中禁止许可证和其他提示。

Set-PackageSource -Name chocolatey -Trusted

将包源设置为受信任。

于 2018-02-18T15:02:18.203 回答