[英]Skip confirmation while using Install-Package?
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: 我在Powershell上添加了
ChocolateyGet
作为提供程序,因此我可以将它与PackageManagement(OneGet)一起使用,它可以工作,但我尝试安装的每个软件包都会发出警告:
https://www.chocolatey.org is not a trusted package source
https://www.chocolatey.org不是受信任的包源
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? 像Linux上的
y
或yes
命令一样?
You need to use -Force
where there is a Force property available on any cmdlets, otherwise if there isn't but there is a confirm, you are able to use -Confirm:$False
which acts the same as pressing Yes. 你需要在任何cmdlet上有Force属性的情况下使用
-Force
,否则如果没有,但是有确认,你可以使用-Confirm:$False
,其行为与按Yes一样。
Be careful using this however as if you in fact didn't want to process the action...you don't get a second chance. 小心使用它,但好像你实际上不想处理动作......你没有第二次机会。
choco feature enable -n allowGlobalConfirmation
will suppress license and other prompts during install. 将在安装过程中禁止许可证和其他提示。
Set-PackageSource -Name chocolatey -Trusted
will set package source as trusted. 将包源设置为受信任。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.