If you work with Linux or Mac you are more than used to installing and managing applications from the operating system terminal. In Windows it is less frequent, but there are times when such a tool can be really useful, especially when it comes to automating . For this reason, today I would like to tell you about Chocolatey, a package manager for Windows, supported by PowerShell and the Nuget infrastructure.
INSTALL CHOCOLATEY
To start installing packages from the terminal with this manager, the first thing you should do is open the console as administrator and launch the following command:
one |
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin |
With this you will install Chocolatey and add it to the environment variables so you can use it from anywhere. Note that if you did not launch this command as administrator it will only be available to the user who launched the installation.
You can also install it from PowerShell with the following command:
one |
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
|
In this case keep in mind that you must have previously launched Set-ExecutionPolicy Unrestricted to be able to execute the previous line.
Once the manager is installed, you can now install and automate the installation of different tools from the command line. On the official page you have a search engine to locate those you need to know what the name of the package is.
As you can see, the way to install them is very simple, you simply must use the choco command, followed by install and the name of the package.
one |
choco install package_name
|
For example, to install Skype you could do it from the following command.
When this action is launched there is a script to execute, but it is always possible to view it on the screen to check the actions that will be carried out.
Keep in mind that if you do not launch the commands as administrator, you could get errors from the installation, as reported in a console without elevated privileges.
Once the installation is accepted, it will begin to download the necessary packages and will log in chocolatey.log all the steps followed during the process.
To remove packages installed by the manager, you can do it through the uninstall action.
If you want to know how many packages you have installed using Chocolatey, just launch the list command in local mode only.
You already know how to start working with this simple package manager for Windows. How many installations can you automate?
Cheers!