# Windows 安装 Installing Chocolatey

**URL:** <https://www.isharkfly.com/t/windows-installing-chocolatey/10619>\
**Category:** DevOps\
**Created:** [January 2, 2018, 8:59pm UTC](https://www.isharkfly.com/t/windows-installing-chocolatey/10619 "2018-01-02T20:59:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [January 2, 2018, 8:59pm UTC](https://www.isharkfly.com/t/windows-installing-chocolatey/10619/1 "2018-01-02T20:59:03Z")

</div>

在 Windows 的管理员 cmd 界面中运行下面的命令：

```auto
@powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
```

界面输出：

[code]C:\WINDOWS\system32\>@“SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command “iex ((New-Object System.Net.WebClient).DownloadString(‘[https://chocolatey.org/install.ps1](https://chocolatey.org/install.ps1)’))” && SET “PATH=PATH;ALLUSERSPROFILE\chocolatey\bin”

Mode LastWriteTime Length Name

* * *

d----- 1/2/2018 3:52 PM chocInstall  
Getting latest version of the Chocolatey package for download.  
Getting Chocolatey from [https://chocolatey.org/api/v2/package/chocolatey/0.10.8](https://chocolatey.org/api/v2/package/chocolatey/0.10.8).  
Downloading 7-Zip commandline tool prior to extraction.  
Extracting C:\Users\YuCheng\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\YuCheng\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…  
WARNING: Not setting tab completion: Profile file does not exist at  
‘C:\Users\YuCheng\Documents\WindowsPowerShell\Microsoft.PowerShell\_profile.ps1’.  
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

C:\WINDOWS\system32\>[/code]

安装已经完成：

 ![](https://com-ossez-www-discourse.s3.dualstack.us-east-2.amazonaws.com/discourse-uploads/original/2X/d/d3953740825c0ecb262c978188fc80c9ff0b5501.jpeg)
