在Windows(Windows)中手动安装应用程序可能很耗时,并且有几个步骤,包括搜索应用程序或程序的最新版本、下载安装程序文件、签署协议、按下一步(Next)进入后续步骤,以及手动取消选中广告,您不想要的工具栏或捆绑包。有些甚至要求用户在安装过程中关闭所有其他正在运行的应用程序。
在本文中,我们将向您展示如何使用Windows包管理器通过命令提示符安装应用程序和程序。
巧克力包管理器(Chocolatey Package Manager)(Chocolatey Package Manager)
Windows包管理器是一组工具,使用户能够自动安装、配置和更新应用和程序。
Chocolatey是一个安全且简单的Windows包管理器。使用一些代码,您可以安装应用程序和程序以及管理和跟踪更新。
它是免费和开源的,供个人和企业使用。对于需要高级功能的用户,Chocolatey提供高级升级。
安装巧克力(Install Chocolatey)
- 在Windows 开始(Windows Start)菜单中,搜索命令提示符(Command Prompt)(Command Prompt)并单击以管理员身份运行(Run as administrator)(Run as administrator)。
- 在命令提示符中键入以下代码,然后按 Enter(Enter)。
@”%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”
在安装过程中,您会在命令窗口中看到大量文本滚动。
使用 Chocolatey Windows 包管理器安装应用程序(Install Apps Using the Chocolatey Windows Package Manager)
要安装应用程序,首先在您的桌面上打开一个文本文档以列出您要安装的应用程序。接下来,从 Web 浏览器导航到 Chocolately 的应用程序目录Community Maintained Packages。
对于您要安装的每个应用程序,在您的文本文件中键入以下命令:
choco install [包名] -fy(choco install [name of package] -fy)
对于 [name of package],使用 app 目录中显示的名称。例如,如果要安装Mozilla Firefox,请使用以下代码:
巧克力安装火狐(choco install firefox)
该命令的-fy部分是一个名称,它告诉Chocolatey在安装过程中弹出任何提示时选择“是”。(yes )这有助于自动化流程并使其尽可能简单。
您要安装的每个应用程序都应位于文本文件的单独行上。除了应用程序的名称外,每一行都应该相同。
列出您想要包含的所有应用程序后,您可以使用一行代码同时安装它们,上面的示例使用以下代码:
choco install firefox -fy.install install firefox -fy.adobereader -fy.install 7zip.install -fy.install notepadplusplus -fy.install skype – fy
保存您的文本磁贴并关闭它。它应该有一个 .txt 扩展名。如果没有,您需要按照以下步骤从文件资源管理器中启用(File Explorer)文件(File)扩展名:
启用文件扩展名(Enable File Extensions)
- 通过单击屏幕底部的文件图标打开文件资源管理器。(File Explorer)
- 您还可以通过在Windows搜索栏中键入文件资源管理器来打开(open )文件资源管理器。(File Explorer)(File Explorer)
- 单击顶部的查看选项卡并勾选(View t)文件扩展名(File name extensions)旁边的复选框以启用它。
- 一旦您可以使用.txt扩展名保存文本文件,请将其重命名为.bat扩展名。右键单击新的 .bat 文件并选择Run as Administrator。
- 此操作将触发Chocolatey启动并安装您的所有应用程序。保存您的 .bat 文件以供将来参考或使用。
使用一条线安装所有东西(Install Everything Using One Line)
也可以使用一个 .bat 文件同时 安装所有应用程序和Chocolatey Windows包管理器。(Chocolatey Windows)
- 打开你创建的 .bat 文件,在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”
choco 安装 firefox -fy(choco install firefox -fy)
choco install install firefox -fy
choco 安装 adobereader -fy(choco install adobereader -fy)
巧克力安装 7zip.install -fy(choco install 7zip.install -fy)
choco 安装 notepadplusplus -fy(choco install notepadplusplus -fy)
choco 安装 skype – 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(Use Chocolatey)通过命令提示符安装您的应用程序和程序。它拥有一个庞大的Windows软件包数据库,这些软件包经过了严格的审查过程( rigorous review process)。
它是一种自动化工具,可以为您处理获取和安装程序和应用程序的平凡而耗时的步骤。用户只需选择他们想要安装的内容,Chocolatey就会下载最新版本,而无需您的任何输入。
考虑您要升级计算机上的所有程序和应用程序以确保您使用的是最新和最安全的版本的情况。要手动执行此操作,您必须:
- 查找最新版本
- 选择正确的下载
- 监督安装过程,这样您就不会下载任何您不想要的东西,例如默认包含并要求您取消选中它们的工具栏
- 为每个程序执行此过程
或者,使用Chocolatey Windows包管理器打开命令行,输入:
choco 全部升级 -y(choco upgrade all -y)
完毕。
How to Use a Windows Package Manager to Install Windows Programs
Installing apps manually in Windows can be time-consuming and has several steps, including searching for the most recent verѕion of the app or program, downloading the installer fіle, signing agreements, pressing Next to get to a subseqυent step, and manually unchecking ads, toolbars or bundles уou don’t want. Some even require users to close all other running apps during installatіon.
In this article, we will show you how to use a Windows package manager to install apps and programs using the command prompt.
Windows package managers are a collection of tools that enable users to automate the installation, configuration, and updating of apps and programs.
Chocolatey is a secure and simple Windows package manager. Using a few bits of code, you can install apps and programs as well as manage and track updates.
It is free and open-source for personal and business use. For users who need advanced functionality, Chocolatey offers premium upgrades.
Install Chocolatey
- The command prompt will pop up in a window like the image below.
- Type the following code into the command prompt and hit Enter.
@”%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”
During the installation process, you will see a lot of text scrolling by in the command window.
Install Apps Using the Chocolatey Windows Package Manager
To install apps, start by opening a text document on your desktop to make a list of the apps you want to install. Next, from a web browser, navigate to Chocolately’s app directory, the Community Maintained Packages.
For each app you want to install, type the following command on your text file:
choco install [name of package] -fy
For [name of package] use the name as it appears in the app directory. For example, if you want to install Mozilla Firefox, use the following code:
choco install firefox
The -fy part of the command is a designation that tells Chocolatey to choose yes when any prompt pops up during installation. This helps to automate the process and make it as simple as possible.
Every app you want to install should be on a separate line on your text file. Each line should be the same except for the name of the app.
After listing all the apps you want to include, you can use a single line to install them all at the same time using the following code for the example above:
choco install firefox -fy.install install firefox -fy.adobereader -fy.install 7zip.install -fy.install notepadplusplus -fy.install skype – fy
Save your text tile and close it. It should have a .txt extension. If it doesn’t, you will need to enable File name extensions from File Explorer by following the steps below:
Enable File Extensions
- Open File Explorer by clicking on the file icon at the bottom of your screen.
- Click on the View tab at the top and tick off the checkbox next to File name extensions to enable it.
- Once you can save your text file with .txt extension, rename it with a .bat extension. Right-click on your new .bat file and choose Run as Administrator.
- This action will trigger Chocolatey to start and install all your apps. Save your .bat file for future reference or use.
Install Everything Using One Line
It is also possible to install all your apps and the Chocolatey Windows package manager at the same time with one .bat file.
- Open the .bat file you created and add it after the Chocolatey installation command as follows:
@”%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
The above command includes word wrap to make it easier to read. However, when you run the command, it should be one line as you can see below:
@”%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
Save your file so you can use it again when you need it to install all your favorite apps and Chocolatey at the same time.
Use Chocolatey to install your apps and programs with the command prompt. It has a massive database of Windows packages that go through a rigorous review process.
It is an automated tool that handles the mundane and time-consuming steps of getting and installing programs and apps for you. Users simply choose what they want to install, and Chocolatey will download the latest version without needing any input from you.
Consider the situation where you want to upgrade all the programs and apps on your computer to make sure you are using the latest and most secure versions. To do this manually, you must:
- Find the most recent version
- Select the correct download
- Oversee the installation process so you don’t download anything you don’t want such as toolbars that are included by default and require you to uncheck them
- Go through this process for every program
Or, use the Chocolatey Windows package manager to open a command line, type:
choco upgrade all -y
Done.