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%\chocolatey\bin"


# 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 : 想安裝的地點


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM