简体   繁体   English

使用Install-Package时跳过确认?

[英]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上的yyes命令一样?

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.

相关问题 如何在PowerShell中使用install-package cmdlet安装多个包? - How to install multiple packages using install-package cmdlet in powershell? 如何使用nuget.org的OneGet / install-package安装软件包 - How do I install a package using OneGet / install-package from nuget.org 在安装包中添加自定义参数 - adding custom parameter to install-package Nuget的Powershell安装包 - Powershell Install-Package from Nuget Find-Package 有效,但 Install-Package 在 powershell 中使用 Chocolatey 仅显示 nuget 错误 - Find-Package works but Install-Package shows only nuget error using chocolatey in powershell 如何使用 Install-Package 为 PowerShell 安装 MongoDB 驱动程序? - How do I install MongoDB driver for PowerShell using Install-Package? Install-Package&NuGet Package安装位置 - 安装到哪里? - Install-Package & NuGet Package install location - where installed to? “nuget install”,“Install-Package”和“choco install”有什么区别? - What is the difference betwee “nuget install” , “Install-Package” and “choco install”? 如何为OneGet安装软件包创建可执行软件包? - How can I create executable package for OneGet Install-Package? 运行 install-package 而不提示安装 nuget - run install-package without it prompting to install nuget
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM