chocolatey windows 的包管理工具。

类似于 brew apt-get


使用 windows cmd.exe 管理员模式


@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"


powershell 执行命令:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))
  • 日志
Microsoft Windows [版本 10.0.17134.345]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Windows\system32>@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\binbin.hou\AppData\Local\Temp\chocolatey\chocInstall\ to C:\Users\binbin.hou\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
警告: Not setting tab completion: Profile file does not exist at
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder


search - 搜索包 choco search something list - 列出包 choco list -lo install - 安装 choco install baretail pin - 固定包的版本,防止包被升级 choco pin windirstat upgrade - 安装包的升级 choco upgrade baretail uninstall - 安装包的卸载 choco uninstall baretail

安装Ruby Gem - choco install compass -source ruby 安装Python Egg - choco install sphynx -source python 安装IIS服务器特性 - choco install IIS -source windowsfeatures 安装Webpi特性 - choco install IIS7.5Express -source webpi

安装 docker


C:\Windows\system32> choco search docker
Chocolatey v0.10.11
docker 18.06.1 [Approved] Downloads cached for licensed users
docker-compose 1.22.0 [Approved] Downloads cached for licensed users
docker-for-windows [Approved] Downloads cached for licensed users

安装 docker

choco install docker-for-windows -y



choco  install docker-for-windows -y --install-directory=D:\choco\docker
choco  install docker-for-windows -y -ia "INSTALLDIR=""D:\choco\docker"""
choco install docker-for-windows -ia "INSTALLDIR=""D:\choco\docker"""

ps: 用【管理员】运行命令行


选择 yes




Hardware assisted virtualization and data execution protection must be enabled in the BIOS.


如何在Windows 10上运行Docker和Kubernetes?

使用chocolatey中的命令choco install时如何改变安装软件的路径?