在Windows中手动安装应用程序可能很耗时,并且需要执行多个步骤,包括搜索应用程序或程序的最新版本,下载安装程序文件,签署协议,按“下一步”进入后续步骤以及手动进行取消选中不需要的广告,工具栏或捆绑包。有些甚至要求用户在安装过程中关闭所有其他正在运行的应用程序。
在本文中,我们将向您展示如何使用Windows软件包管理器通过命令提示符安装应用程序和程序。

巧克力包装经理
Windows软件包管理器是一组工具,使用户可以自动安装,配置和更新应用程序和程序。
巧克力是一种安全且简单的方法Windows程序包管理器。使用少量代码,您可以安装应用程序和程序,以及管理和跟踪更新。
它是免费的开放源代码,供个人和企业使用。对于需要高级功能的用户,Chocolatey提供了高级升级。
安装Chocolatey


@”%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'))“ && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin”
在安装过程中,您会在命令窗口中看到很多文本。
<!-In_content_1全部:[300x250] / dfp:[640x360]->
使用Chocolatey Windows软件包管理器安装应用程序
要安装应用程序,请先在桌面上打开文本文档以列出您要使用的应用程序要安装。接下来,从Web浏览器中,导航到Chocolately的应用程序目录社区维护的软件包 。
对于要安装的每个应用程序,在文本文件中键入以下命令:
choco install [程序包名称] -fy
对于[程序包名称],请使用应用目录中显示的名称。例如,如果要安装Mozilla Firefox,请使用以下代码:
choco install firefox

该命令的-fy部分是一个指示,指示Chocolatey选择是,在安装过程中弹出任何提示时。这有助于使过程自动化并使其尽可能简单。
每个要安装的应用程序都应在文本文件的单独一行上。除了应用程序的名称,每一行都应该相同。

列出所有要包含的应用后,对于上面的示例,您可以使用一行代码使用以下代码同时全部安装它们:
choco install firefox -fy.install install firefox -fy.adobereader -fy.install 7zip.install -fy.install notepadplusplus -fy.install skype – fy
保存并关闭文本图块。它应该具有.txt扩展名。如果没有,则需要通过以下步骤从文件资源管理器中启用文件扩展名:
启用文件扩展名




使用一行安装所有内容
还可以安装所有应用程序和Chocolatey Windows软件包管理器同时使用一个.bat文件。
@”%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') )“ && SET“ PATH =%PATH%;%ALLUSERSPROFILE%\ chocolatey \ bin”
choco install firefox -fy
choco install install firefox -fy
choco install adobereader -fy
choco install 7zip.install -fystrong>
choco install notepadplusplus -fy
choco install skype – fy
上述命令包括自动换行,使其更易于阅读。但是,当您运行命令时,它应该是一行,如下所示:
@”%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'))“ && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin” choco install firefox -fy.choco install install firefox -fy.choco install adobereader -fy.choco install 7zip.install -fy.choco install notepadplusplus -fy.choco install skype - fy
保存文件,以便在需要安装所有文件时可以再次使用它您同时喜欢的应用程序和Chocolatey。
使用Chocolatey在命令提示符下安装您的应用程序和程序。它有一个庞大的Windows软件包数据库,这些数据库都经过 严格的审查程序 。
这是一个自动化工具,可以处理获取和安装用于Windows的程序和应用程序的繁琐且耗时的步骤您。用户只需选择要安装的内容,Chocolatey便会下载最新版本,而无需您进行任何输入。
请考虑要升级计算机上所有程序和应用程序的情况,以确保您使用的是最新,最安全的版本。要手动执行此操作,您必须:
或者,使用Chocolatey Windows软件包管理器打开命令行,键入:
choco upgrade all -y
Done。