Friday, July 10, 2020

The Quickest Way to Install Windows Software: The Command Prompt

Installing apps on Windows is a time-consuming process. The user has to go through a series of steps to patch the software—search for the recent version of an app, download the installer file, manually install the app (next, next several times), and uncheck unwanted bundleware or ads.

Solution: Chocolatey (Package Manager)
A package manager is a collection of tools to automate the entire process of installing, configuring, and updating apps. The package consists of software binaries, configuration files, and metadata. The metadata, in turn, has all the details of an app (name, description, version number, and more) and the list of dependencies to make it work properly.
Although there are many package managers for Windows, none of them has the simplicity and security of Chocolatey. With few bits of code, you can deploy the app in every system and also track or manage updates of that software over time.
Here are some reasons why we prefer Chocolatey:
  • It has the largest online database of Windows packages. As of now, there are 11,166 community-maintained packages. You can even install packages from NuGet and MyGet.
  • Package submissions go through a rigorous moderation review process, including package validation, verification, virus scanning with VirusTotal, and more. For an organization, the use of the community package repository is optional.
  • Chocolatey works with over 20+ installer technologies for Windows. It knows how to set up an app, registry, manage files and configuration, or any combination.
  • Chocolatey can even work with installed apps. It can take over existing application files in the Programs directory and also handle uninstalls. However, it depends on the packaging and software installer used.

Installing Chocolatey in Windows 10

Chocolatey installation is quick and intuitive. You don’t need a thorough knowledge of the Command Prompt or PowerShell. However, you must fulfill the basic system requirements and have the patience to install a few scripts. 
SystemRequirements
  • Windows 7+/Windows Server 2003+ and above
  • PowerShell v2+ and above
  • .NET framework 4+ (the installation will try to install .NET 4.0 if you don’t have it installed)
  • Free space for Chocolatey CLI and another 1GB+ or more for installing packages

PowerShell Method

Press Win + X and select Windows PowerShell (Admin). At first, you must ensure Get-ExecutionPolicy is not restricted.
Type in Get-ExecutionPolicy, if it returns Restricted then that means you cannot install any script. To bypass it, type in Set-ExecutionPolicy AllSigned and “Y” to confirm the change.
bypass execution policy in PowerShell
Copy-and-paste the command
Advertisement
Set-ExecutionPolicy Bypass -Scope Process -Force; iex 
((New-Object 
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Press Enter.
install chocolatey through PowerShell
Within a few moments, Chocolatey will get installed and create a new folder in Program Data. All the packages go to \chocolatey\lib (though there may be an exceptions for .MSI installers).
You can also set up a custom installation path for packages like Python, Ruby, or Node.
Advertisement
chocolatey installation folder
Once Chocolatey gets installed, restart the PowerShell and type in choco /? to see the list of commands.
invoke choco help to get the list of commands

Command Prompt Method

If you use the command prompt, press Win + X and choose Command Prompt (Admin). Then, copy-and-paste the command
Advertisement
@"%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"
Press Enter.
install chocolatey through command prompt
Chocolatey will get installed on your system in a few seconds. Restart the prompt and type in choco /? to see the list of commands.

Chocolatey Packages

Chocolatey packages are modified .nupkg files. It is a compiled zip file carrying the package metadata (including version information, dependencies, and distribution rights). If you delete the metadata specific to chocolatey, the package file is similar to NuGet.
The interesting part of Chocolatey is the community repository of packages known as the community package repository. Every package submitted to the database undergoes a rigorous moderation process before it goes live.
On the left side, you’ll see the links to the package maintainer, validation check button in colors green, red, and yellow, and instructions to install the app. Under the Install section, you’ll see the command instructions to install Google Chrome.
chocolatey package in detail
In the same section, there are instructions to upgrade and uninstall the app. The Version History menu lists all the versions, including their changelog. And there is a section on Virus Scan Results, in case you’re not confident of installing a particular app.
details of a particular package

How to Install Software Using Command Prompt or PowerShell

You probably have a list of frequently used apps you install on Windows. Instead of having to visit a website and using an installer, launch PowerShell and type in the syntax
choco install [app name]
“choco” is the short name of Chocolatey. Whenever you install, upgrade, or uninstall any app, you must prefix it with “choco.” The second prefix is the actual command. Since we’re installing the app, we’ll use the prefix “install.” The third prefix is the software name.
Navigate to the chocolatey package site and search for the app. Notice the command line instruction to install that app.
installing app through chocolatey
For example, to install Gimp, type in
choco install gimp
This will download and install the app to your system, without requiring any action on your part. You’ll see the progress information in the console itself. In a few cases, your app might show windows, but that’s perfectly normal.
Chocolatey will take care of all the installation steps automatically. Once your app gets installed, you’ll find it in the Start menu.
installing gimp through chocolatey

Search Your Package

You can even search for a particular package with syntax
choco search [app name]
For example, if you wish to install 7-zip, type in
choco search 7-zip
When you press Enter, chocolatey will search for every app with the word “zip” in its database. If it’s there, you’ll find it in the results. Searching for a particular app requires a bit of practice. Use the repository package website whenever you need any help.
use the chocolatey search for a particular package

Upgrading a Package

To upgrade an app, type in
choco upgrade [app name]

List of Outdated Packages

It’s also possible to see the list of all outdated apps. To make this work, you must install apps through Chocolatey. Type in
choco outdated

outdated chocolatey packages

Uninstall a Package

If you don’t find an app useful, you can uninstall it through Chocolatey. Type in
choco uninstall [app name]
In most cases, the commands mentioned above are all you will ever need. But chocolatey has many more functions. Visit the command references page for more details.

Install Your Next App With the Command Prompt

Many people still find it a hassle to update their apps. Chocolatey lets you install a dozen or more apps with just a few keystrokes. You can easily manage your apps without any security concerns or bundleware.
Modern OS’es provide you automated installer packages and commands that install many bits of software at once. But have you ever thought what is happening behind the scene when you run that installer? 

No comments:

Post a Comment

Ways to Check Who Is Tracking You Online

  How much do you love online content? So much you pay for everything you can? Or do you, like the overwhelming majority of internet users, ...