Windows下的包管理器Chocolatey的使用

1.配置安装路径(后续需要管理员权限执行命令)

  1. Create a machine level (user level will also work) environment variable named ChocolateyInstall and set it to the folder you want Chocolatey to install to prior to installation (this environment variable must be set globally or available to PowerShell- it is not enough to simply make it available to your current command prompt session).
  2. Don't use "C:Chocolatey" unless necessary.
  3. Create the folder manually.
  4. If you have already installed (and want to change the location after the fact):
  • Follow the above steps.
  • Install Chocolatey again.
  • Copy/Move over the items from the old lib/bin directory.
  • Delete your old install directory.

2.安装方法 https://chocolatey.org/docs/installation

# cmd.exe
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateyin"


# powershell.exe
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# powershell v3+
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

3. 代理设置

choco config set proxy http://localhost:8888

4.常用命令:https://chocolatey.org/docs/commands-reference

choco search 关键字

choco install 软件包名称

choco upgrade 软件包名称

choco uninstall 软件包名称

5.仓库地址:https://chocolatey.org/packages/

6.安装位置设置

 环境变量中增加 ChocolateyToolsLocation : 想安装的地点

原文地址:https://www.cnblogs.com/ys-wuhan/p/6395417.html