简:这几天想学一下React Native ,不过今天的主角可不是React Native。而是Windows 下的包管理器“巧克力味儿” ----Chocolatey
写这篇博客的原因是,在配置React Native 开发环境的时候。需要安装Nodejs,但是当前的Nodejs的版本是7.1.0,要说高版本的Nodejs肯定是好的,怎奈Node 7.1版本的在Windows上是无法正常工作的(此时心中倍感无奈),好吧、那就安装一下别的版本的Node吧。于是我就安装了‘巧克力味儿’ --Chocolatey
当我使用命令行安装Node的时候由于默认安装的是最新版本的(也就是Nodejs 7.1.0,Windows不能用的),不能使用。于是我就想能不能在命令中指定要安装的软件的版本。结果我搜遍平时搜索的全部网站,全部都没有说怎么指定的。于是我模仿nmp的命令,结果不行,此时心中在想命令行难道不能有一个标准???
行了~下面直接进主题,不说了!说多了都是泪~~~
第一步:安装Chocolatey
安装方式有两种:
第一种:使用管理员权限打开命令提示符窗口(也就是以管理员的身份去打开cmd.exe,不知道这个怎么操作的请自觉搜索资源,网上一堆资源在等着你):
打开窗口之后:在里面粘贴下面这行命令,点击回车即可:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
第二种:打开管理员权限的Powershell(这个不知道怎么做的也请自行搜索资源):
打开之后粘贴下面的命令,点击回车即可:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
其中在第二种方式下输入下面的命令也是可以的(是Chocolatey作者创建的短网址,包含了Chocolatey安装脚本):
iwr https://cin.st | iex
命令行执行结束后,我们输入choco 命令,如果显示如下图所示,代表安装成功了:
注:
以上都是安装到了默认位置 C 盘
,具体默认安装的位置,在窗口中会有提示。如果现在其他地方安装Chocolatey的话,需要新建一个环境变量ChocolateyInstall
,值是你希望安装到的文件夹。然后手动创建这个文件夹。然后再运行上面的命令。如果已经安装了,可以再次运行安装命令,这样可以重新安装到你指定的位置。
第二步:看看 Chocolatey 的常用命令:
search & list 命令:搜索包含关键字的软件包
格式:
choco search <filter> [<options/switches>]
choco list <filter> [<options/switches>]
clist <filter> [<options/switches>]
举例:
choco list --local-only
choco list -li
choco list -lai
choco list --page=0 --page-size=25
choco search git
choco search git -s "'https://somewhere/out/there'"
choco search bob -s "'https://somewhere/protected'" -u user -p pass
下面看一下官网的动态图:
下面我们说一下命令后面的options: 官网地址: https://chocolatey.org/docs/commands-list
首先也是先看一下官网的注释:
-?, --help, -h
Prints out the help menu. // 打印帮助菜单
-d, --debug
Debug - Show debug messaging. // 显示调试信息
-v, --verbose
Verbose - Show verbose messaging. // 显示详细信息
--acceptlicense, --accept-license
AcceptLicense - Accept license dialogs automatically. Reserved for future use. // 自动接受许可对话框,预留选项
-y, --yes, --confirm
Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license // 追加命令设置,代表同意(不用询问我啦)
-f, --force
Force - force the behavior. Do not use force during normal operation -
it subverts some of the smart behavior for commands. // 个人觉得应该是不允许程序自己执行中断操作
--noop, --whatif, --what-if
NoOp / WhatIf - Don't actually do anything. // 后续什么都不做
-r, --limitoutput, --limit-output
LimitOutput - Limit the output to essential information // 限制输出基本信息
--timeout, --execution-timeout=VALUE
CommandExecutionTimeout (in seconds) - The time to allow a command to
finish before timing out. Overrides the default execution timeout in the
configuration of 2700 seconds. // 设置请求超时时间 value
-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. // 如果不适用官方的设置,这个设置项必须要加上
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
FailOnStandardError - Fail on standard error output (stderr), typically
received when running external commands during install providers. This
overrides the feature failOnStandardError. // 失败
--use-system-powershell
UseSystemPowerShell - Execute PowerShell using an external process
instead of the built-in PowerShell host. Should only be used when
internal host is failing. Available in 0.9.10+. // 使用管理者身份的powershell
-s, --source=VALUE
Source - Source location for install. Can include special 'webpi'.
Defaults to sources. // 资源位置,可以类比这种写法:choco install IISExpress --source webpi
-l, --lo, --localonly, --local-only
LocalOnly - Only search against local machine items. // 仅仅搜索本地
--pre, --prerelease
Prerelease - Include Prereleases? Defaults to false. // 是否包含Pre版本,默认不包含
-i, --includeprograms, --include-programs
IncludePrograms - Used in conjunction with LocalOnly, filters out apps
chocolatey has listed as packages and includes those in the list.
Defaults to false. // 与LocalOnly 一起使用,用于过滤搜索到的应用,是否本地搜索设置,默认false
-a, --all, --allversions, --all-versions
AllVersions - include results from all versions. // 所有版本
--version=VALUE
Version - Specific version of a package to return. // 指定版本
-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. // 指定密码
--cert=VALUE
Client certificate - PFX pathname for an x509 authenticated feeds.
Defaults to empty. Available in 0.9.10+. // 客户端证书---x509身份验证源路径名称,默认是空
--cp, --certpassword=VALUE
Certificate Password - the client certificate's password to the source.
Defaults to empty. Available in 0.9.10+. // 客户端证书密码,默认空
--page=VALUE
Page - the 'page' of results to return. Defaults to return all results.
Available in 0.9.10+. // 返回结果,默认返回所有结果
--page-size=VALUE
Page Size - the amount of package results to return per page. Defaults
to 25. Available in 0.9.10+. // 一个页面返回结果数量,默认25个
-e, --exact
Exact - Only return packages with this exact name. Available in 0.9.10+. // 精确要返回的结果,只返回包含这个名字的
--by-id-only
ByIdOnly - Only return packages where the id contains the search filter. // 只返回这个id包含的内容
Available in 0.9.10+.
--id-starts-with
IdStartsWith - Only return packages where the id starts with the search
filter. Available in 0.9.10+. // 只返回以id开头的
--order-by-popularity
OrderByPopularity - Sort by package results by popularity. Available in // 排序
0.9.10+.
--approved-only
ApprovedOnly - Only return approved packages - this option will filter
out results not from the [community repository](https://chocolatey.org/packages). Available in 0.9.10+. // 返回经过过滤的内容
--download-cache, --download-cache-only
DownloadCacheAvailable - Only return packages that have a download cache
available - this option will filter out results not from the community
repository. Available in 0.9.10+. // 只返回包的下载缓存
--not-broken
NotBroken - Only return packages that are not failing testing - this
option only filters out failing results from the [community feed](https://chocolatey.org/packages). It will
not filter against other sources. Available in 0.9.10+. // 只返回可用的包
--detail, --detailed
Detailed - Alias for verbose. Available in 0.9.10+. // 详细别名
update 命令:
格式:
choco upgrade <pkg|all> [<pkg2> <pkgN>] [<options/switches>]
cup <pkg|all> [<pkg2> <pkgN>] [<options/switches>]
举例:
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
choco upgrade all
choco upgrade all --except="'skype,conemu'"
动图:
下面我们说一下命令后面的options: 官网地址: https://chocolatey.org/docs/commands-upgrade
-?, --help, -h
Prints out the help menu.
-d, --debug
Debug - Show debug messaging.
-v, --verbose
Verbose - Show verbose messaging.
--acceptlicense, --accept-license
AcceptLicense - Accept license dialogs automatically. Reserved for
future use.
-y, --yes, --confirm
Confirm all prompts - Chooses affirmative answer instead of prompting.
Implies --accept-license
-f, --force
Force - force the behavior. Do not use force during normal operation -
it subverts some of the smart behavior for commands.
--noop, --whatif, --what-if
NoOp / WhatIf - Don't actually do anything.
-r, --limitoutput, --limit-output
LimitOutput - Limit the output to essential information
--timeout, --execution-timeout=VALUE
CommandExecutionTimeout (in seconds) - The time to allow a command to
finish before timing out. Overrides 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.
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
FailOnStandardError - Fail on standard error output (stderr), typically
received when running external commands during install providers. This
overrides the feature failOnStandardError.
--use-system-powershell
UseSystemPowerShell - Execute PowerShell using an external process
instead of the built-in PowerShell host. Should only be used when
internal host is failing. Available in 0.9.10+.
-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.
--argsglobal, --args-global, --installargsglobal, --install-args-global, --applyargstodependencies, --apply-args-to-dependencies, --apply-install-arguments-to-dependencies
Apply Install Arguments To Dependencies - Should install arguments be
applied to dependent packages? Defaults to false.
--paramsglobal, --params-global, --packageparametersglobal, --package-parameters-global, --applyparamstodependencies, --apply-params-to-dependencies, --apply-package-parameters-to-dependencies
Apply Package Parameters To Dependencies - Should package parameters be
applied to dependent packages? Defaults to false.
--allowdowngrade, --allow-downgrade
AllowDowngrade - Should an attempt at downgrading be allowed? Defaults
to false.
-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, --skipscripts, --skip-scripts, --skip-automation-scripts
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.
--cert=VALUE
Client certificate - PFX pathname for an x509 authenticated feeds.
Defaults to empty. Available in 0.9.10+.
--cp, --certpassword=VALUE
Certificate Password - the client certificate's password to the source.
Defaults to empty. Available in 0.9.10+.
--ignorechecksum, --ignore-checksum, --ignorechecksums, --ignore-checksums
IgnoreChecksums - Ignore checksums provided by the package. Overrides
the default feature 'checksumFiles' set to 'True'. Available in 0.9.9.9+.
--allowemptychecksum, --allowemptychecksums, --allow-empty-checksums
Allow Empty Checksums - Allow packages to have empty/missing checksums
for downloaded resources from non-secure locations (HTTP, FTP). Use this
switch is not recommended if using sources that download resources from
the internet. Overrides the default feature 'allowEmptyChecksums' set to
'False'. Available in 0.10.0+.
--allowemptychecksumsecure, --allowemptychecksumssecure, --allow-empty-checksums-secure
Allow Empty Checksums Secure - Allow packages to have empty checksums
for downloaded resources from secure locations (HTTPS). Overrides the
default feature 'allowEmptyChecksumsSecure' set to 'True'. Available in
0.10.0+.
--requirechecksum, --requirechecksums, --require-checksums
Require Checksums - Requires packages to have checksums for downloaded
resources (both non-secure and secure). Overrides the default feature
'allowEmptyChecksums' set to 'False' and 'allowEmptyChecksumsSecure' set
to 'True'. Available in 0.10.0+.
--checksum, --downloadchecksum, --download-checksum=VALUE
Download Checksum - a user provided checksum for downloaded resources
for the package. Overrides the package checksum (if it has one).
Defaults to empty. Available in 0.10.0+.
--checksum64, --checksumx64, --downloadchecksumx64, --download-checksum-x64=VALUE
Download Checksum 64bit - a user provided checksum for 64bit downloaded
resources for the package. Overrides the package 64-bit checksum (if it
has one). Defaults to same as Download Checksum. Available in 0.10.0+.
--checksumtype, --checksum-type, --downloadchecksumtype, --download-checksum-type=VALUE
Download Checksum Type - a user provided checksum type. Overrides the
package checksum type (if it has one). Used in conjunction with Download
Checksum. Available values are 'md5', 'sha1', 'sha256' or 'sha512'.
Defaults to 'md5'. Available in 0.10.0+.
--checksumtype64, --checksumtypex64, --checksum-type-x64, --downloadchecksumtypex64, --download-checksum-type-x64=VALUE
Download Checksum Type 64bit - a user provided checksum for 64bit
downloaded resources for the package. Overrides the package 64-bit
checksum (if it has one). Used in conjunction with Download Checksum
64bit. Available values are 'md5', 'sha1', 'sha256' or 'sha512'.
Defaults to same as Download Checksum Type. Available in 0.10.0+.
--ignorepackagecodes, --ignorepackageexitcodes, --ignore-package-codes, --ignore-package-exit-codes
IgnorePackageExitCodes - Exit with a 0 for success and 1 for non-succes-
s, no matter what package scripts provide for exit codes. Overrides the
default feature 'usePackageExitCodes' set to 'True'. Available in 0.-
9.10+.
--usepackagecodes, --usepackageexitcodes, --use-package-codes, --use-package-exit-codes
UsePackageExitCodes - Package scripts can provide exit codes. Use those
for choco's exit code when non-zero (this value can come from a
dependency package). Chocolatey defines valid exit codes as 0, 1605,
1614, 1641, 3010. Overrides the default feature 'usePackageExitCodes'
set to 'True'. Available in 0.9.10+.
--except=VALUE
Except - a comma-separated list of package names that should not be
upgraded when upgrading 'all'. Defaults to empty. Available in 0.9.10+.
--sdc, --skipdownloadcache, --skip-download-cache
Skip Download Cache - Use the original download even if a private CDN
cache is available for a package. Overrides the default feature
'downloadCache' set to 'True'. Available in 0.9.10+. [Licensed editions](https://chocolatey.org/compare)
only. See https://chocolatey.org/docs/features-private-cdn
--dc, --downloadcache, --download-cache, --use-download-cache
Use Download Cache - Use private CDN cache if available for a package.
Overrides the default feature 'downloadCache' set to 'True'. Available
in 0.9.10+. [Licensed editions](https://chocolatey.org/compare) only. See https://chocolate-
y.org/docs/features-private-cdn
--svc, --skipvirus, --skip-virus, --skipviruscheck, --skip-virus-check
Skip Virus Check - Skip the virus check for downloaded files on this ru-
n. Overrides the default feature 'virusCheck' set to 'True'. Available
in 0.9.10+. [Licensed editions](https://chocolatey.org/compare) only. See https://chocolate-
y.org/docs/features-virus-check
--virus, --viruscheck, --virus-check
Virus Check - check downloaded files for viruses. Overrides the default
feature 'virusCheck' set to 'True'. Available in 0.9.10+. Licensed
editions only. See https://chocolatey.org/docs/features-virus-check
--viruspositivesmin, --virus-positives-minimum=VALUE
Virus Check Minimum Scan Result Positives - the minimum number of scan
result positives required to flag a package. Used when virusScannerType
is VirusTotal. Overrides the default configuration value
'virusCheckMinimumPositives' set to '5'. Available in 0.9.10+. Licensed
editions only. See https://chocolatey.org/docs/features-virus-check
--install-arguments-sensitive=VALUE
InstallArgumentsSensitive - Install Arguments to pass to the native
installer in the package that are sensitive and you do not want logged.
Defaults to unspecified. Available in 0.10.1+. [Licensed editions](https://chocolatey.org/compare) only.
--package-parameters-sensitive=VALUE
PackageParametersSensitive - Package Parameters to pass the package that
are sensitive and you do not want logged. Defaults to unspecified.
Available in 0.10.1+. [Licensed editions](https://chocolatey.org/compare) only.
--dir, --directory, --installdir, --installdirectory, --install-dir, --install-directory=VALUE
Install Directory Override - Override the default installation director-
y. Chocolatey will automatically determine the type of installer and
pass the appropriate arguments to override the install directory. The
package must use Chocolatey install helpers and be installing an
installer for software. Available in 0.9.10+. [Licensed editions](https://chocolatey.org/compare) only.
See https://chocolatey.org/docs/features-install-directory-override
uninstall 命令:
格式:
choco uninstall <pkg|all> [pkg2 pkgN] [options/switches]
cuninst <pkg|all> [pkg2 pkgN] [options/switches]
举例:
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
动图:
下面我们说一下命令后面的options:官网地址:https://chocolatey.org/docs/commands-uninstall
-?, --help, -h
Prints out the help menu.
-d, --debug
Debug - Show debug messaging.
-v, --verbose
Verbose - Show verbose messaging.
--acceptlicense, --accept-license
AcceptLicense - Accept license dialogs automatically. Reserved for
future use.
-y, --yes, --confirm
Confirm all prompts - Chooses affirmative answer instead of prompting.
Implies --accept-license
-f, --force
Force - force the behavior. Do not use force during normal operation -
it subverts some of the smart behavior for commands.
--noop, --whatif, --what-if
NoOp / WhatIf - Don't actually do anything.
-r, --limitoutput, --limit-output
LimitOutput - Limit the output to essential information
--timeout, --execution-timeout=VALUE
CommandExecutionTimeout (in seconds) - The time to allow a command to
finish before timing out. Overrides 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.
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
FailOnStandardError - Fail on standard error output (stderr), typically
received when running external commands during install providers. This
overrides the feature failOnStandardError.
--use-system-powershell
UseSystemPowerShell - Execute PowerShell using an external process
instead of the built-in PowerShell host. Should only be used when
internal host is failing. Available in 0.9.10+.
-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 uninstall. Defaults to unspecified.
-a, --allversions, --all-versions
AllVersions - Uninstall all versions? Defaults to false.
--ua, --uninstallargs, --uninstallarguments, --uninstall-arguments=VALUE
UninstallArguments - Uninstall Arguments to pass to the native installer
in the package. Defaults to unspecified.
-o, --override, --overrideargs, --overridearguments, --override-arguments
OverrideArguments - Should uninstall arguments be used exclusively
without appending to current package passed arguments? Defaults to false.
--notsilent, --not-silent
NotSilent - Do not uninstall this silently. Defaults to false.
--params, --parameters, --pkgparameters, --packageparameters, --package-parameters=VALUE
PackageParameters - Parameters to pass to the package. Defaults to
unspecified.
--argsglobal, --args-global, --installargsglobal, --install-args-global, --applyargstodependencies, --apply-args-to-dependencies, --apply-install-arguments-to-dependencies
Apply Install Arguments To Dependencies - Should install arguments be
applied to dependent packages? Defaults to false.
--paramsglobal, --params-global, --packageparametersglobal, --package-parameters-global, --applyparamstodependencies, --apply-params-to-dependencies, --apply-package-parameters-to-dependencies
Apply Package Parameters To Dependencies - Should package parameters be
applied to dependent packages? Defaults to false.
-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.
-x, --forcedependencies, --force-dependencies, --removedependencies, --remove-dependencies
RemoveDependencies - Uninstall dependencies when uninstalling package(s-
). Defaults to false.
-n, --skippowershell, --skip-powershell, --skipscripts, --skip-scripts, --skip-automation-scripts
Skip Powershell - Do not run chocolateyUninstall.ps1. Defaults to false.
--ignorepackagecodes, --ignorepackageexitcodes, --ignore-package-codes, --ignore-package-exit-codes
IgnorePackageExitCodes - Exit with a 0 for success and 1 for non-succes-
s, no matter what package scripts provide for exit codes. Overrides the
default feature 'usePackageExitCodes' set to 'True'. Available in 0.-
9.10+.
--usepackagecodes, --usepackageexitcodes, --use-package-codes, --use-package-exit-codes
UsePackageExitCodes - Package scripts can provide exit codes. Use those
for choco's exit code when non-zero (this value can come from a
dependency package). Chocolatey defines valid exit codes as 0, 1605,
1614, 1641, 3010. Overrides the default feature 'usePackageExitCodes'
set to 'True'. Available in 0.9.10+.
--autouninstaller, --use-autouninstaller
UseAutoUninstaller - Use auto uninstaller service when uninstalling.
Overrides the default feature 'autoUninstaller' set to 'True'. Available
in 0.9.10+.
--skipautouninstaller, --skip-autouninstaller
SkipAutoUninstaller - Skip auto uninstaller service when uninstalling.
Overrides the default feature 'autoUninstaller' set to 'True'. Available
in 0.9.10+.
--failonautouninstaller, --fail-on-autouninstaller
FailOnAutoUninstaller - Fail the package uninstall if the auto
uninstaller reports and error. Overrides the default feature
'failOnAutoUninstaller' set to 'False'. Available in 0.9.10+.
--ignoreautouninstallerfailure, --ignore-autouninstaller-failure
Ignore Auto Uninstaller Failure - Do not fail the package if auto
uninstaller reports an error. Overrides the default feature
'failOnAutoUninstaller' set to 'False'. Available in 0.9.10+.
下面我们说一下命令后面的options:
首先也是先看一下官网的注释:
-?, --help, -h
Prints out the help menu. // 打印帮助菜单
-d, --debug
Debug - Show debug messaging. // 显示调试信息
-v, --verbose
Verbose - Show verbose messaging. // 显示详细信息
--acceptlicense, --accept-license
AcceptLicense - Accept license dialogs automatically. Reserved for future use. // 自动接受许可对话框,预留选项
-y, --yes, --confirm
Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license // 追加命令设置,代表同意(不用询问我啦)
-f, --force
Force - force the behavior. Do not use force during normal operation -
it subverts some of the smart behavior for commands. // 个人觉得应该是不允许程序自己执行中断操作
--noop, --whatif, --what-if
NoOp / WhatIf - Don't actually do anything. // 后续什么都不做
-r, --limitoutput, --limit-output
LimitOutput - Limit the output to essential information // 限制输出基本信息
--timeout, --execution-timeout=VALUE
CommandExecutionTimeout (in seconds) - The time to allow a command to
finish before timing out. Overrides the default execution timeout in the
configuration of 2700 seconds. // 设置请求超时时间 value
-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. // 如果不适用官方的设置,这个设置项必须要加上
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output
FailOnStandardError - Fail on standard error output (stderr), typically
received when running external commands during install providers. This
overrides the feature failOnStandardError. // 失败
--use-system-powershell
UseSystemPowerShell - Execute PowerShell using an external process
instead of the built-in PowerShell host. Should only be used when
internal host is failing. Available in 0.9.10+. // 使用管理者身份的powershell
-s, --source=VALUE
Source - Source location for install. Can include special 'webpi'.
Defaults to sources. // 资源位置,可以类比这种写法:choco install IISExpress --source webpi
-l, --lo, --localonly, --local-only
LocalOnly - Only search against local machine items. // 仅仅搜索本地
--pre, --prerelease
Prerelease - Include Prereleases? Defaults to false. // 是否包含Pre版本,默认不包含
-i, --includeprograms, --include-programs
IncludePrograms - Used in conjunction with LocalOnly, filters out apps
chocolatey has listed as packages and includes those in the list.
Defaults to false. // 与LocalOnly 一起使用,用于过滤搜索到的应用,是否本地搜索设置,默认false
-a, --all, --allversions, --all-versions
AllVersions - include results from all versions. // 所有版本
--version=VALUE
Version - Specific version of a package to return. // 指定版本
-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. // 指定密码
--cert=VALUE
Client certificate - PFX pathname for an x509 authenticated feeds.
Defaults to empty. Available in 0.9.10+. // 客户端证书---x509身份验证源路径名称,默认是空
--cp, --certpassword=VALUE
Certificate Password - the client certificate's password to the source.
Defaults to empty. Available in 0.9.10+. // 客户端证书密码,默认空
--page=VALUE
Page - the 'page' of results to return. Defaults to return all results.
Available in 0.9.10+. // 返回结果,默认返回所有结果
--page-size=VALUE
Page Size - the amount of package results to return per page. Defaults
to 25. Available in 0.9.10+. // 一个页面返回结果数量,默认25个
-e, --exact
Exact - Only return packages with this exact name. Available in 0.9.10+. // 精确要返回的结果,只返回包含这个名字的
--by-id-only
ByIdOnly - Only return packages where the id contains the search filter. // 只返回这个id包含的内容
Available in 0.9.10+.
--id-starts-with
IdStartsWith - Only return packages where the id starts with the search
filter. Available in 0.9.10+. // 只返回以id开头的
--order-by-popularity
OrderByPopularity - Sort by package results by popularity. Available in // 排序
0.9.10+.
--approved-only
ApprovedOnly - Only return approved packages - this option will filter
out results not from the [community repository](https://chocolatey.org/packages). Available in 0.9.10+. // 返回经过过滤的内容
--download-cache, --download-cache-only
DownloadCacheAvailable - Only return packages that have a download cache
available - this option will filter out results not from the community
repository. Available in 0.9.10+. // 只返回包的下载缓存
--not-broken
NotBroken - Only return packages that are not failing testing - this
option only filters out failing results from the [community feed](https://chocolatey.org/packages). It will
not filter against other sources. Available in 0.9.10+. // 只返回可用的包
--detail, --detailed
Detailed - Alias for verbose. Available in 0.9.10+. // 详细别名
其他命令:
除了上面的三个命令之外,还有另外的几个命令:
pin命令、
config命令、
download命令等。有需要的就去官方的网站吧,官网还是最好的学习资源。
资料:
官方文档地址:https://chocolatey.org/docs
记录:
下面我记录我自己需要的命令:choco install nodejs.install --version 5.7.0 下载版本号是5.7.0的nodejs。