起手式,核心的一点是寻求帮助。choco与正常的linux命令查询大相径庭。
比如scoop的查询是这样的:
PS C:UsersgaoweiVideosBibleProject> scoop help update
Usage: scoop update [options]
'scoop update' updates Scoop to the latest version.
'scoop update ' installs a new version of that app, if there is one.
You can use '*' in place of to update all apps.
Options:
-f, --force Force update even when there isn't a newer version
-g, --global Update a globally installed app
-i, --independent Don't install dependencies automatically
-k, --no-cache Don't use the download cache
-s, --skip Skip hash validation (use with caution!)
-q, --quiet Hide extraneous messages
但是choco却将help放置在了后面,而且还是single-dash,既然如此也便只能“客随主便”了。
PS C:UsersgaoweiVideosBibleProject> choco list -help
Chocolatey v0.10.15
List/Search Command
Chocolatey will perform a search for a package local or remote. Some
may prefer to use `clist` as a shortcut for `choco list`.
安装案例如下:
choco install sysinternals
choco install notepadplusplus googlechrome atom 7zip
choco install notepadplusplus --force --force-dependencies
choco install notepadplusplus googlechrome atom 7zip -dvfy
choco install git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'"
choco install git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" --install-arguments="'/DIR=C:git'"
# Params are package parameters, passed to the package
# Install args are installer arguments, appended to the silentArgs
# in the package for the installer itself
choco install nodejs.install --version 0.10.35
choco install git -s "'https://somewhere/out/there'"
choco install git -s "'https://somewhere/protected'" -u user -p pass
查阅已安装的软件,不能直接输入命令:
PS C:UsersgaoweiVideosBibleProject> choco list
Chocolatey v0.10.15
系统会始终处于pending的状态。解决方案必须加上options:
choco list --local-only
choco list -li
choco list -lai
choco list --page=0 --page-size=25
choco search git
choco search git --source="'https://somewhere/out/there'"
choco search bob -s "'https://somewhere/protected'" -u user -p pass
升级apps前,先检查是否已经过期。
PS C:Usersgaoweiscoopappsscoopcurrent> choco outdated
Chocolatey v0.10.15
Outdated Packages
Output is package name | current version | available version | pinned?
adobereader|2020.012.20043|2020.012.20048|false
calibre|4.23.0|5.3.0|false
dotnetcore3-desktop-runtime|3.1.8|3.1.9|false
KB2533623|1.0.4|2.0.0|false
microsoft-edge|84.0.522.63|86.0.622.56|false
powertoys|0.21.1|0.25.0|false
vcredist140|14.26.28720.3|14.27.29112|false
visualstudio2017buildtools|15.9.26.0|15.9.28.0|false
升级全部的安装程序:
PS C:UsersgaoweiVideosBibleProject> sudo choco upgrade all -y
Chocolatey v0.10.15
Upgrading the following packages:
all
By upgrading you accept licenses for the packages.
7zip v19.0 is the latest version available based on your source(s).
7zip.install v19.0 is the latest version available based on your source(s).
You have adobereader v2020.012.20043 installed. Version 2020.012.20048 is available based on your source(s).
Progress: Downloading adobereader 2020.012.20048... 100%
adobereader v2020.012.20048 [Approved]
adobereader package files upgrade completed. Performing other installation steps.
True
True
Using system proxy server '127.0.0.1:57356'.
Downloading adobereader
from 'https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/1901020064/AcroRdrDC1901020064_MUI.exe'
Using system proxy server '127.0.0.1:57356'.
Progress: 22% - Saving 59.37 MB of 261.05 MB
升级部分程序的方法:
choco upgrade chocolatey
choco upgrade notepadplusplus googlechrome atom 7zip
choco upgrade notepadplusplus googlechrome atom 7zip -dvfy
choco upgrade git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'"
choco upgrade git -y --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" --install-args="'/DIR=C:git'"
# Params are package parameters, passed to the package
# Install args are installer arguments, appended to the silentArgs
# in the package for the installer itself
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
choco upgrade all
choco upgrade all --except="'skype,conemu'"
可以卸载软件的指定版本:
choco uninstall git
choco uninstall notepadplusplus googlechrome atom 7zip
choco uninstall notepadplusplus googlechrome atom 7zip -dv
choco uninstall ruby --version 1.8.7.37402
choco uninstall nodejs.install --all-versions
比如卸载adobe-reader:
PS C:UsersgaoweiVideosBibleProject> sudo choco uninstall adobereader
Chocolatey v0.10.15
Uninstalling the following packages:
adobereader
adobereader v2020.012.20048
The package adobereader wants to run 'chocolateyuninstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y
Running auto uninstaller...
Auto uninstaller has successfully uninstalled adobereader or detected previous uninstall.
adobereader has been successfully uninstalled.
查阅安装包信息:
PS C:UsersgaoweiVideosBibleProject> choco info powershell
Chocolatey v0.10.15
PowerShell 5.1.14409.20180811 [Approved]
Title: Windows Management Framework and PowerShell | Published: 2018-08-11
Package approved as a trusted package on Jul 13 2020 04:02:21.
Package testing status: Passing on Aug 11 2018 20:14:14.
Number of Downloads: 4461899 | Downloads for this version: 2038939
Package url
Chocolatey Package Source: n/a
搜索安装包wps:
PS C:UsersgaoweiVideosBibleProject> choco info wps-office-free
Chocolatey v0.10.15
wps-office-free 11.2.0.9718 [Approved] Downloads cached for licensed users
Title: WPS Office Free | Published: 2020-10-20
Package approved as a trusted package on Oct 21 2020 07:04:37.
choco config
choco config list
choco config get cacheLocation
choco config get --name cacheLocation
choco config set cacheLocation c: empchoco
choco config set --name cacheLocation --value c: empchoco
choco config unset proxy
choco config unset --name proxy
比如list选项:
PS C:UsersgaoweiVideosBibleProject> choco config list
Chocolatey v0.10.15
Settings
cacheLocation = | Cache location if not TEMP folder. Replaces `$env:TEMP` value for choco.exe process. It is highly recommended this be set to make Chocolatey more deterministic in cleanup.
containsLegacyPackageInstalls = true | Install has packages installed prior to 0.9.9 series.
commandExecutionTimeoutSeconds = 2700 | Default timeout for command execution. '0' for infinite (starting in 0.10.4).
proxy = | Explicit proxy location. Available in 0.9.9.9+.
proxyUser = | Optional proxy user. Available in 0.9.9.9+.
proxyPassword = | Optional proxy password. Encrypted. Available in 0.9.9.9+.
webRequestTimeoutSeconds = 30 | Default timeout for web requests. Available in 0.9.10+.
proxyBypassList = | Optional proxy bypass list. Comma separated. Available in 0.10.4+.
proxyBypassOnLocal = true | Bypass proxy for local connections. Available in 0.10.4+.
upgradeAllExceptions = | A comma-separated list of package names that should not be upgraded when running `choco upgrade all'. Defaults to empty. Available in 0.10.14+.
以上为choco的8项高频操作。
日常还是主要用scoop,scoop找不到再尝试choco,因为scoop更快。
页面更新:2024-05-28
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号