Chocolatey 配置與安裝

Chocolatey 是 Windows 安裝軟體無人值守的好幫手,在 https://community.chocolatey.org/packages 搜尋你想要的軟體執行安裝語法即可,在 Chocolatey 上的軟體則都是正版,下載路徑來源也都是來是各軟體原廠,所以可以安心服用

以下操作需要以系統管理員身分執行

設定安裝路徑

Chocolatey 安裝完之後,預設的安裝路徑是 C:\ProgramData\chocolatey ,而且會增加一個環境變數 ChocolateyInstall,在安裝 Chocolatey 之前先手動加入 ChocolateyInstall 環境變數

Environment Variables 
user variables for Yao 
Variable 
DataGrip 
JetBrains Rider 
OneDrive 
OneDriveConsumer 
System variables 
Variable 
ASPNETCORE ENVIRONM. 
Chocolateylnstall 
CMDER ROOT 
ComSpec 
ConEmuDir 
CUSTOM_ENVIRONMENT 
Value 
cxprogram 2020. 
Files\JetBrainsUetBrains Rider 2019.34\bin• 
Files Software\Foxit Reader\plug ins\ 
ENOneDrive 
E:10neDrive 
Delete 
Value 
ASP DEV 
N m 32\cmd exe 
CUSTOM DEV 
EdiL. 
OK

或者在 cmd.exe | powershell 輸入以下命令

setx ChocolateyInstall D:\Chocolatey /M

setx | Microsoft Docs

 

完成之後重啟 cmd.exe | powershell

日後,安裝攜式軟體(綠色),套件名稱帶有 Portable,將會放在 D:\Chocolatey 目錄,如下圖

 

接下來,官方提供兩種安裝方式

安裝 

  • cmd.exe

@"%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'))"

 

  • powershell

透過 powershell 安裝前,須先透過 Get-ExecutionPolicy 得知目前系統的指令檔執行限制

Get-ExecutionPolicy

如果顯示的是 Restricted,則需要執行下列指令 變更 Windows PowerShell 執行原則的使用者喜好設定

Set-ExecutionPolicy AllSigned

or

Set-ExecutionPolicy Bypass -Scope Process

 

設定完畢執行原則後,接著輸入下列指令安裝 Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

 

安裝完成後,系統環境變數會加入 D:\Chocolatey\bin 路徑到 Path

在 Windows Terminal 輸入 choco,得到 Chocolatey v.0.10.15 代表已經配置好設定

 

移除

他沒有指令,只需要將資料夾移和環境變數除即可

指令

  • list - 列出遠端或本地包
  • search - 搜尋遠端或本地包
  • info - 檢索包資訊
  • install - 從各種來源安裝套件
  • pin - 抑制包的升級
  • outdated - 檢索過時的包
  • upgrade - 從各種來源升級包
  • uninstall - 解除安裝軟體包
  • pack - 將nuspec打包到已編譯的nupkg
  • push - 推播編譯的nupkg
  • new - 從模板生成包所需的檔案
  • sources - 檢視和組態預設源
  • source - 檢視和組態預設源
  • config - 檢索並組態設定檔設定
  • featute - 檢視和組態choco功能
  • features - 檢視和組態choco功能
  • setapikey - 檢索或儲存特定源的apikey
  • apikey - 檢索或儲存特定源的apikey
  • unpackself - 讓chocolatey自動設定
  • support - 提供支援資訊
  • download - 下載包 - 可選擇內化所有遠端資源
  • synchronize - 與系統安裝的軟體同步 - 生成缺少的包
  • sync - 與系統安裝的軟體同步 - 生成缺少的軟體包
  • optimize - 最佳化安裝,減少空間使用

 參考

https://docs.chocolatey.org/en-us/choco/commands/

 

安裝軟體

要使用不擾人安裝就帶入-y 參數

choco install -y nodejs

 

以下分享我的安裝清單,複製後另存成 install.bat

工具清單

:: Microsoft .NET 5.0 Runtime 5.0.5
choco install --yes dotnet-5.0-runtime
:: Microsoft .NET Core Runtime 3.1.14
choco install --yes dotnetcore-runtime
:: net framework 4.8 
choco install --yes dotnetfx
:: net framework 3.5 
choco install --yes dotnet3.5
:: software
choco install --yes firefox microsoft-edge vivaldi.install brave googlechrome notepadplusplus.install adobereader foxitreader teamviewer.install vscode dropbox googledrive microsoft-teams microsoft-windows-terminal line slack telegram wox everything powertoys carnac 7zip snagit Camtasia forticlientvpn

 

開發環境清單

:: devart
::dbForge Studio for Sql Server Professional (Trial) 6.0.383.20210412
choco install --yes dbforge-sql-studio
::dbForge Documenter for SQL Server (Trial) 1.4.75.20200221
choco install --yes dbforge-sql-doc
:: dbForge Studio for MySQL Professional (Trial) 8.2.23.20191219
choco install --yes dbforge-mysql-studio-pro
:: jetbrains
choco install --yes jetbrains-rider
choco install --yes dotcover
choco install --yes dotmemory
choco install --yes dottrace
choco install --yes dotpeek
::choco install --yes resharper
choco install --yes datagrip
choco install --yes pycharm
choco install --yes intellijidea-ultimate
choco install --yes webstorm
choco install --yes phpstorm
choco install --yes goland
::Microsoft .NET Framework 4.0.2 Developer Pack 4.0.506
choco install --yes netfx-4.0.1-devpack
choco install --yes netfx-4.0.2-devpack
choco install --yes netfx-4.0.3-devpack
:: Microsoft .NET Framework 4.5.1 Developer Pack 4.5.50932
choco install --yes netfx-4.5.1-devpack
:: NET Framework 4.5.2 Developer Pack 4.5.5165101.20180721
choco install --yes netfx-4.5.2-devpack
:: Microsoft .NET Framework 4.6 Developer Pack 4.6.81
choco install --yes netfx-4.6-devpack
:: Microsoft .NET Framework 4.6.1 Developer Pack 4.6.01055.00
choco install --yes netfx-4.6.1-devpack
::Microsoft .NET Framework 4.6.2 Developer Pack 4.6.01590.20190930
choco install --yes netfx-4.6.2-devpack
:: Microsoft .NET Framework 4.7 Developer Pack 4.7.2053.0
choco install --yes netfx-4.7-devpack
::Microsoft .NET Framework 4.7.1 Developer Pack 4.7.2558.20190225
choco install --yes netfx-4.7.1-devpack
:: Microsoft .NET Framework 4.7.2 Developer Pack 4.7.2.20190225
choco install --yes netfx-4.7.2-devpack
:: Microsoft .NET Framework 4.8 Developer Pack 4.8.0.20190930
choco install --yes netfx-4.8-devpack
:: net core 3
choco install --yes dotnetcore-sdk 
:: net 5
choco install --yes dotnet-sdk
:: net framework 4.8 
choco install --yes dotnetfx
::AdoptOpenJDK jdk16 hotspot 16.0.0.36 16.0.0.3600
choco install --yes adoptopenjdk
:: git
choco install --yes git
:: python
choco install --yes python
:: SQL Server Management Studio 18.8 15.0.18369.0
choco install --yes sql-server-management-studio
:: Database .NET 32.2.7774.1
choco install --yes databasenet
:: DBeaver - Community Edition 21.0.3
choco install --yes dbeaver
:: DB Browser for SQLite 3.12.0.20201129
choco install --yes sqlitebrowser
:: SQL Workbench/J 124.0.0
choco install --yes sql-workbench
:: KeyStore Explorer (Portable) 5.4.4
choco install --yes keystore-explorer.portable
:: OpenSSL – The Open Source SSL and TLS toolkit 1.1.1.20181020
choco install --yes openssl.light
:: Postman for Windows 8.2.3
choco install --yes postman
:: ILSpy
choco install --yes ilspy
:: dnspy
choco install --yes dnspy
:: Linqpad
choco install --yes linqpad5
choco install --yes linqpad6
:: ozcode
choco install --yes ozcode
:: HTML Help Workshop 1.32.1
choco install --yes html-help-workshop
:: Sandcastle Help File Builder and Tools (Install) 2021.3.29.0
choco install --yes sandcastle
:: NSwagStudio 13.10.9
choco install --yes nswagstudio
:: Typora
choco install --yes Typora
:: Winaero Tweaker (Install) 0.19.1.0
choco install --yes winaero-tweaker.install
:: Microsoft Message Analyzer 1.4.0.20160625
::choco install --yes microsoft-message-analyzer 檔案不存在了

:: PsKill 1.16
choco uninstall --yes pskill
:: Sysinternals 2021.4.21
choco install --yes sysinternals
:: ZoomIt 4.52.0.20200926
choco install --yes zoomit

 

更新所有軟體

choco upgrade --yes all

移除軟體

choco uninstall --yes pskill

GUI

除了透過指令碼之外,還可以使用 GUI 來管理相關的軟體,日後有更新,也可以直接一鍵更新

https://community.chocolatey.org/packages/ChocolateyGUI

如下圖:

若有謬誤,煩請告知,新手發帖請多包涵


Microsoft MVP Award 2010~2017 C# 第四季
Microsoft MVP Award 2018~2021 .NET

Image result for microsoft+mvp+logo