Windows上的巧克力味Chocolatey详解

Chocolatey是什么?很简单,Chocolatey就是Windows系统的yum或apt-get。

一、Chocolatey介绍

Chocolatey是一款专为Windows系统开发的、基于NuGet的包管理器工具,类似于Node.js的npm,MacOS的brew,Ubuntu的apt-get,它简称为choco。Chocolatey的设计目标是成为一个去中心化的框架,便于开发者按需快速安装应用程序和工具。

Chocolatey的官网: https://chocolatey.org/

Chcocolatey当前最新版本为0.9.10.3版。

二、Chocolatey安装

要安装Chocolatey很容易,必须以管理员权限打开cmd.exe命令行提示,执行如下内容:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateyin

还有一种安装方法,使用PowerShell,同样必须以管理员权限打开PowerShell,执行如下命令:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

三、Chocolatey用法

1、命令

  • search - 搜索包 choco search something
  • list - 列出包 choco list -lo
  • install - 安装 choco install baretail
  • pin - 固定包的版本,防止包被升级 choco pin windirstat
  • upgrade - 安装包的升级 choco upgrade baretail
  • uninstall - 安装包的卸载 choco uninstall baretail
  • 安装Ruby Gem - choco install compass -source ruby
  • 安装Python Egg - choco install sphynx -source python
  • 安装IIS服务器特性 - choco install IIS -source windowsfeatures
  • 安装Webpi特性 - choco install IIS7.5Express -source webpi

2、常用的一些命令

1)列出本地已安装的包

choco list --local-only

2)列出Windows系统已安装的软件

choco list -li

或使用

choco list -lai

3)升级所有已安装的包

choco upgrade all -y

四、Chocolatey的文件

toolschocolateyInstall.ps1 
toolschocolateyInstallchoco.exe 
toolschocolateyInstallchoco.exe.ignore 
toolschocolateyInstallhelperschocolateyInstaller.psm1 
toolschocolateyInstallhelperschocolateyScriptRunner.ps1 
toolschocolateyInstallhelpersfunctionsGet-BinRoot.ps1 
toolschocolateyInstallhelpersfunctionsGet-CheckSumValid.ps1 
toolschocolateyInstallhelpersfunctionsGet-ChocolateyUnzip.ps1 
toolschocolateyInstallhelpersfunctionsGet-ChocolateyWebFile.ps1 
toolschocolateyInstallhelpersfunctionsGet-EnvironmentVariable.ps1 
toolschocolateyInstallhelpersfunctionsGet-EnvironmentVariableNames.ps1 
toolschocolateyInstallhelpersfunctionsGet-FtpFile.ps1 
toolschocolateyInstallhelpersfunctionsGet-ProcessorBits.ps1 
toolschocolateyInstallhelpersfunctionsGet-UACEnabled.ps1 
toolschocolateyInstallhelpersfunctionsGet-VirusCheckValid.ps1 
toolschocolateyInstallhelpersfunctionsGet-WebFile.ps1 
toolschocolateyInstallhelpersfunctionsGet-WebHeaders.ps1 
toolschocolateyInstallhelpersfunctionsInstall-BinFile.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyDesktopLink.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyEnvironmentVariable.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyExplorerMenuItem.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyFileAssociation.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyInstallPackage.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyPackage.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyPath.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyPinnedTaskBarItem.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyPowershellCommand.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyShortcut.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyVsixPackage.ps1 
toolschocolateyInstallhelpersfunctionsInstall-ChocolateyZipPackage.ps1 
toolschocolateyInstallhelpersfunctionsSet-EnvironmentVariable.ps1 
toolschocolateyInstallhelpersfunctionsStart-ChocolateyProcessAsAdmin.ps1 
toolschocolateyInstallhelpersfunctionsTest-ProcessAdminRights.ps1 
toolschocolateyInstallhelpersfunctionsUninstall-BinFile.ps1 
toolschocolateyInstallhelpersfunctionsUninstall-ChocolateyPackage.ps1 
toolschocolateyInstallhelpersfunctionsUnInstall-ChocolateyZipPackage.ps1 
toolschocolateyInstallhelpersfunctionsUpdate-SessionEnvironment.ps1 
toolschocolateyInstallhelpersfunctionsWrite-ChocolateyFailure.ps1 
toolschocolateyInstallhelpersfunctionsWrite-ChocolateySuccess.ps1 
toolschocolateyInstallhelpersfunctionsWrite-FileUpdateLog.ps1 
toolschocolateyInstallLICENSE.txt 
toolschocolateyInstall edirectschoco.exe 
toolschocolateyInstall edirectschoco.exe.ignore 
toolschocolateyInstall edirectschocolatey.exe 
toolschocolateyInstall edirectschocolatey.exe.ignore 
toolschocolateyInstall edirectscinst.exe 
toolschocolateyInstall edirectscinst.exe.ignore 
toolschocolateyInstall edirectsclist.exe 
toolschocolateyInstall edirectsclist.exe.ignore 
toolschocolateyInstall edirectscpack.exe 
toolschocolateyInstall edirectscpack.exe.ignore 
toolschocolateyInstall edirectscpush.exe 
toolschocolateyInstall edirectscpush.exe.ignore 
toolschocolateyInstall edirectscuninst.exe 
toolschocolateyInstall edirectscuninst.exe.ignore 
toolschocolateyInstall edirectscup.exe 
toolschocolateyInstall edirectscup.exe.ignore 
toolschocolateyInstall edirectscver.exe 
toolschocolateyInstall edirectscver.exe.ignore 
toolschocolateyInstall edirectsRefreshEnv.cmd 
toolschocolateyInstall ools7za.exe 
toolschocolateyInstall ools7za.exe.ignore 
toolschocolateyInstall ools7za.exe.manifest 
toolschocolateyInstall ools7zip.license.txt 
toolschocolateyInstall oolschecksum.exe 
toolschocolateyInstall oolschecksum.exe.ignore 
toolschocolateyInstall oolschecksum.license.txt 
toolschocolateyInstall oolsshimgen.exe 
toolschocolateyInstall oolsshimgen.exe.ignore 
toolschocolateyInstall oolsshimgen.license.txt 
toolschocolateysetup.psm1 
toolsinit.ps1

 

原文地址:https://www.cnblogs.com/simadi/p/7055449.html