Install chocolatey.1.1.0.nupkg on windows

The Internet has been very unstable these days,I feel like I can't program anymore.Just yesterday, a new operating system was installed,A whole bunch of software is waiting to be installed.So it was a good thing,Have to toss around to succeed.

首先是,The official has explained how to installchoco,

https://chocolatey.org/install

根据官方的说法,先要执行
Set-ExecutionPolicy AllSigned

或者
Set-ExecutionPolicy Bypass -Scope Process 

Then execute the following command,

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

 But because the network is not,Tried several times without success,在powershellThe output in is shown in the image below,

> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0 to C:\Users\user\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.

 于是到官网下载,

https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.

After downloading, put the file here according to the above information,

 C:\Users\user\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.1.1.0.nupkg

Note that here I am changing the file to chocolatey.zip(There seems to be no problem if you don't change it), 然后在PowershellI ran the long command in front of it again,就成功安装了chocolatey.

安装 A long list of messages is given in the process,Leave it as a note below,

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0 to C:\Users\User\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\USer\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\User\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local 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 'C:\Users\User\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

安装完成后,The path to the executable is here,

C:\ProgramData\chocolatey\bin 

You can check to see if it has been added to the system 环境变量中了 ,如果没有的话,Maybe something went wrong during installation,It needs to be set manually.

本文结束.


thank
Similar articles