如何更新除一个以外的所有Chocolatey软件包?


28

cup all -y用于在引导时更新所有Chocolatey软件包。目前,VirtualBox的最新版本存在问题,我想避免在启动时更新此程序包,而需要更新其他程序包。

尝试解决问题

我已经检查了命令的帮助功能:

C:\>cup all -h
Chocolatey v0.9.9.8
Upgrade Command

Upgrades a package or a list of packages. Some may prefer to use `cup`
 as a shortcut for `choco upgrade`.

Usage

    choco upgrade <pkg|all> [<pkg2> <pkgN>] [<options/switches>]
    cup <pkg|all> [<pkg2> <pkgN>] [<options/switches>]

NOTE: `all` is a special package keyword that will allow you to upgrade
 all currently installed packages.

Examples

    choco upgrade chocolatey
    choco upgrade notepadplusplus googlechrome atom 7zip
    choco upgrade notepadplusplus googlechrome atom 7zip -dvfy
    choco upgrade git --params="/GitAndUnixToolsOnPath /NoAutoCrlf" -y
    choco upgrade nodejs.install --version 0.10.35
    choco upgrade git -s "https://somewhere/out/there"
    choco upgrade git -s "https://somewhere/protected" -u user -p pass

Options and Switches

NOTE: Options and switches apply to all items passed, so if you are
 installing multiple packages, and you use `--version=1.0.0`, it is
 going to look for and try to install version 1.0.0 of every package
 passed. So please split out multiple package calls when wanting to
 pass specific options.


 -?, --help, -h
     Prints out the help menu.

 -d, --debug
     Debug - Run in Debug Mode.

 -v, --verbose
     Verbose - See verbose messaging.

     --acceptlicense, --accept-license
     AcceptLicense - Accept license dialogs automatically.

 -y, --yes, --confirm
     Confirm all prompts - Chooses affirmative answer instead of prompting.
       Implies --accept-license

 -f, --force
     Force - force the behavior

     --noop, --whatif, --what-if
     NoOp - Don't actually do anything.

 -r, --limitoutput, --limit-output
     LimitOutput - Limit the output to essential information

     --execution-timeout=VALUE
     CommandExecutionTimeoutSeconds - Override the default execution timeout
       in the configuration of 2700 seconds.

 -c, --cache, --cachelocation, --cache-location=VALUE
     CacheLocation - Location for download cache, defaults to %TEMP% or value
       in chocolatey.config file.

     --allowunofficial, --allow-unofficial, --allowunofficialbuild, --allow-unofficial-build
     AllowUnofficialBuild - When not using the official build you must set
       this flag for choco to continue.

 -s, --source=VALUE
     Source - The source to find the package(s) to install. Special sources
       include: ruby, webpi, cygwin, windowsfeatures, and python. Defaults to
       default feeds.

     --version=VALUE
     Version - A specific version to install. Defaults to unspecified.

     --pre, --prerelease
     Prerelease - Include Prereleases? Defaults to false.

     --x86, --forcex86
     ForceX86 - Force x86 (32bit) installation on 64 bit systems. Defaults to
       false.

     --ia, --installargs, --installarguments, --install-arguments=VALUE
     InstallArguments - Install Arguments to pass to the native installer in
       the package. Defaults to unspecified.

 -o, --override, --overrideargs, --overridearguments, --override-arguments
     OverrideArguments - Should install arguments be used exclusively without
       appending to current package passed arguments? Defaults to false.

     --notsilent, --not-silent
     NotSilent - Do not install this silently. Defaults to false.

     --params, --parameters, --pkgparameters, --packageparameters, --package-parameters=VALUE
     PackageParameters - Parameters to pass to the package. Defaults to
       unspecified.

 -m, --sxs, --sidebyside, --side-by-side, --allowmultiple, --allow-multiple, --allowmultipleversions, --allow-multiple-versions
     AllowMultipleVersions - Should multiple versions of a package be
       installed? Defaults to false.

 -i, --ignoredependencies, --ignore-dependencies
     IgnoreDependencies - Ignore dependencies when upgrading package(s).
       Defaults to false.

 -n, --skippowershell, --skip-powershell
     Skip Powershell - Do not run chocolateyInstall.ps1. Defaults to false.

     --failonunfound, --fail-on-unfound
     Fail On Unfound Packages - If a package is not found in feeds specified,
       fail instead of warn.

     --failonnotinstalled, --fail-on-not-installed
     Fail On Non-installed Packages - If a package is not already intalled,
       fail instead of installing.

 -u, --user=VALUE
     User - used with authenticated feeds. Defaults to empty.

 -p, --password=VALUE
     Password - the user's password to the source. Defaults to empty.

但是它似乎没有排除特定程序包的功能。

我如何在启动时更新所有软件包,除了一个?

Answers:


33

您有两种选择:预先固定包装,或在期间排除物品choco upgrade

引脚封装可抑制升级

您可以固定任何您不想更新的程序。

输入choco pin -h以获取更多详细信息。如果该命令没有给您任何帮助,请升级Chocolatey至少为0.9.9.x。

引脚命令

固定软件包以禁止升级。

choco upgrade为所有软件包运行时,这特别有用,因为它将自动跳过那些软件包。另一个选择是choco upgrade --except="pkg1,pk2"

用法

choco pin [list]|add|remove [<options/switches>]

例子

choco pin
choco pin list
choco pin add -n=git
choco pin add -n=git --version 1.2.3
C4B: choco pin add -n=git --version 1.2.3 --reason "'others may need to review'"
choco pin remove --name git

注意:此--reason选项仅在Chocolatey for Business(C4B)中可用。

升级时排除软件包

有时,您只是想排除通常包含在升级中的项目。您不希望使用引脚,因为它们的寿命要比单个命令运行的时间更长。这就是该Exclude选项进入您的升级命令的地方。

从Chocolatey v0.9.10开始,在调用升级时,您可以将可选参数--except作为升级开关。一个例子是choco upgrade all --except="'conemu'"


为什么choco pin呢 被cup all弃用了吗?
2015年

9
为什么会全部弃用杯子?Pin是一个命令,上面写着“保留此程序包的该版本”。
ferventcoder

注意:要将原因添加到图钉,您必须拥有Chocolatey for Business(C4B)。
ferventcoder

2

根据官方文件

choco upgrade all --except="'skype,conemu'"

在Windows上,即使您不使用,也将阻止软件包进一步升级!软件包文件夹已移至C:\ProgramData\chocolatey\lib-bad。如果您想再次升级,请移至C:\ProgramData\chocolatey\lib
Alireza Fattahi,
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.