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

还有一种安装方法,使用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的文件

tools\chocolateyInstall.ps1
tools\chocolateyInstall\choco.exe
tools\chocolateyInstall\choco.exe.ignore
tools\chocolateyInstall\helpers\chocolateyInstaller.psm1
tools\chocolateyInstall\helpers\chocolateyScriptRunner.ps1
tools\chocolateyInstall\helpers\functions\Get-BinRoot.ps1
tools\chocolateyInstall\helpers\functions\Get-CheckSumValid.ps1
tools\chocolateyInstall\helpers\functions\Get-ChocolateyUnzip.ps1
tools\chocolateyInstall\helpers\functions\Get-ChocolateyWebFile.ps1
tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariable.ps1
tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariableNames.ps1
tools\chocolateyInstall\helpers\functions\Get-FtpFile.ps1
tools\chocolateyInstall\helpers\functions\Get-ProcessorBits.ps1
tools\chocolateyInstall\helpers\functions\Get-UACEnabled.ps1
tools\chocolateyInstall\helpers\functions\Get-VirusCheckValid.ps1
tools\chocolateyInstall\helpers\functions\Get-WebFile.ps1
tools\chocolateyInstall\helpers\functions\Get-WebHeaders.ps1
tools\chocolateyInstall\helpers\functions\Install-BinFile.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyDesktopLink.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyEnvironmentVariable.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyExplorerMenuItem.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyFileAssociation.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyInstallPackage.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPackage.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPath.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPinnedTaskBarItem.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPowershellCommand.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyShortcut.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyVsixPackage.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyZipPackage.ps1
tools\chocolateyInstall\helpers\functions\Set-EnvironmentVariable.ps1
tools\chocolateyInstall\helpers\functions\Start-ChocolateyProcessAsAdmin.ps1
tools\chocolateyInstall\helpers\functions\Test-ProcessAdminRights.ps1
tools\chocolateyInstall\helpers\functions\Uninstall-BinFile.ps1
tools\chocolateyInstall\helpers\functions\Uninstall-ChocolateyPackage.ps1
tools\chocolateyInstall\helpers\functions\UnInstall-ChocolateyZipPackage.ps1
tools\chocolateyInstall\helpers\functions\Update-SessionEnvironment.ps1
tools\chocolateyInstall\helpers\functions\Write-ChocolateyFailure.ps1
tools\chocolateyInstall\helpers\functions\Write-ChocolateySuccess.ps1
tools\chocolateyInstall\helpers\functions\Write-FileUpdateLog.ps1
tools\chocolateyInstall\LICENSE.txt
tools\chocolateyInstall\redirects\choco.exe
tools\chocolateyInstall\redirects\choco.exe.ignore
tools\chocolateyInstall\redirects\chocolatey.exe
tools\chocolateyInstall\redirects\chocolatey.exe.ignore
tools\chocolateyInstall\redirects\cinst.exe
tools\chocolateyInstall\redirects\cinst.exe.ignore
tools\chocolateyInstall\redirects\clist.exe
tools\chocolateyInstall\redirects\clist.exe.ignore
tools\chocolateyInstall\redirects\cpack.exe
tools\chocolateyInstall\redirects\cpack.exe.ignore
tools\chocolateyInstall\redirects\cpush.exe
tools\chocolateyInstall\redirects\cpush.exe.ignore
tools\chocolateyInstall\redirects\cuninst.exe
tools\chocolateyInstall\redirects\cuninst.exe.ignore
tools\chocolateyInstall\redirects\cup.exe
tools\chocolateyInstall\redirects\cup.exe.ignore
tools\chocolateyInstall\redirects\cver.exe
tools\chocolateyInstall\redirects\cver.exe.ignore
tools\chocolateyInstall\redirects\RefreshEnv.cmd
tools\chocolateyInstall\tools\7za.exe
tools\chocolateyInstall\tools\7za.exe.ignore
tools\chocolateyInstall\tools\7za.exe.manifest
tools\chocolateyInstall\tools\7zip.license.txt
tools\chocolateyInstall\tools\checksum.exe
tools\chocolateyInstall\tools\checksum.exe.ignore
tools\chocolateyInstall\tools\checksum.license.txt
tools\chocolateyInstall\tools\shimgen.exe
tools\chocolateyInstall\tools\shimgen.exe.ignore
tools\chocolateyInstall\tools\shimgen.license.txt
tools\chocolateysetup.psm1
tools\init.ps1
 

### 使用Chocolatey安装Windows软件 #### 准备工作 为了确保能够顺利使用Chocolatey安装Windows软件,需先确认Chocolatey已成功安装并配置好环境变量。这可以通过打开命令提示符(CMD)或PowerShell输入`choco -v`验证版本号[^1]。 #### 安装指定软件 一旦Chocolatey准备就绪,在命令行界面中可以轻松地通过简单的命令来安装所需的Windows应用程序。例如要安装Google Chrome浏览器,只需运行如下命令: ```powershell choco install googlechrome -y ``` 这里的参数 `-y` 表示自动同意所有提示,默认接受许可协议而无需人工干预[^2]。 对于其他类型的软件同样适用此方法,只需要替换命令中的软件名称部分即可。比如安装VLC媒体播放器,则应执行: ```powershell choco install vlc -y ``` #### 更新已安装的软件 随着时间推移,保持系统的安全性非常重要。利用Chocolatey也可以方便地升级之前已经安装过的程序到最新版。通用的做法是在终端里键入下面这条指令来进行全局更新: ```powershell choco upgrade all -y ``` 该命令会遍历当前环境中由Chocolatey管理的所有应用,并逐一检查是否有可用的新版本发布;若有则实施更新操作[^3]。 #### 卸载不再需要的应用 当某些软件不再被需要时,可通过Chocolatey安全彻底地将其删除。假设想要卸载早前提到的Google Chrome,那么应当这样操作: ```powershell choco uninstall googlechrome -y ``` 以上就是关于如何借助Chocolatey这个强大的工具在Windows平台上高效管理和部署各类第三方应用程序的方法介绍[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值