A Guide On How To Winget

9 Feb 2022, 7:48 p.m.
05:16 minutes

In this tutorial, we will take a look at Microsofts new package manager. A package manager is a tool designed to help you quickly search for and install other tools that your operating system supports. Microsoft's offering is called Winget.

    Winget is the name of Microsofts new package manager. A package manager is a tool designed to help you quickly search for and install other tools that your operating system supports. Windows users have waited a long time for a native package manager offering from Microsoft. Until now the best offering has been chocolatey; however, after exploring some of the features I will show you in this tutorial I have made the switch.

    • Winget does not come installed by default.
    • There are several ways to install it
    • Microsoft Store
    • Release On Github
    • Being a Member of the Windows Insiders Program (Free but may take time to appear as an install option.)

    Winget Not Installed By Default

    Winget only supported on certain OS Versions. @todo: Enter OS that Winget Supports

    CMD Version

    • Because you will be using Winget to install the software you typically need to open up the console as an Administrator.

    In this tutorial, we will be installing from Github however you can just as easily install this from the Windows Store if you have it enabled. * It can take a few days for the option to install Winget to appear

    I will be installing this release * https://github.com/microsoft/winget-cli/releases/tag/v1.2.10271

    Installing Winget From Github

    After you click to download you can install by selecting open. This saves you having to save to disk, find the file and then having to click again to install.

    Click on Open To Install

    Windows will now install winget. We can verify this by seeing the version

    winget --version
    

    Winget Version

    The first time you actually use Winget for anything other than verifying its version you will see an agreement acceptance response like that below.

    Accepting The Agreement

    We can list packages currently installed on our machine.

    winget list
    

    Listing Packages Installed On The Machine

    We can query these packages

    winget list -q <term>
    

    Querying The List

    We can show only the first n number of results

    winget list -n 10
    

    Searching for new packages

    winget search <term>
    

    Searching Winget For The Term Git

    If you look at the last example you can see Winget searching for packages from two sources. We can list the sources that Winget knows about.

    winget source list
    

    Note you can install additional sources but that is out of scope for this tutorial. This is just a crash course to get you started.

    We can also inspect a source.

    Inspecint A Source

    Okay, let us go back to searching. This time we will limit our search to a source.

    Searching By Source

    We can also search by Tag

    winget search --tag github
    

    Searching By Tag

    We will now look at installing packages. We will look at a worked example using Microsoft Visual Studio Code.

    First, we will search.

    Searching For Microsoft Visual Studio Code

    The top result looks like what we want. We can use the show subcommand to find more information.

    Using The Show Command

    If you look at the arrow we can see the package has a moniker. Typing Microsoft.VisualStudioCode with the install command would work but it is a lot to type. Instead, we can reference the package using the moniker.

    Referencing By Moniker

    We can now install the package

    winget install vsscode
    

    Installing Visual Studio Code

    Great so our package is now installed.

    When installing you may see UI windows open like in the screenshot below.

    Installing the Github CLI

    We can prevent that happening, however.

    First I will show you how to uninstall a package and then we will install it a second time without the UI prompts.

    Uninstalling

    winget uninstall Github.cli
    

    Uninstall Github CLI

    Installing with the --silent flag.

    Installing Silentlly

    I have gone ahead and installed a few other programs and I like the collection of packages I have installed. What if I wanted to save this combination of packages for installation on another machine.

    winget export -o <file path>
    

    Exporting List Of Packages

    We can see that some Windows Packages do not have packages available in the Microsoft Store or in the Winget repository.

    Let us check the file we saved. Here it is where we specified on the desktop.

    Winget Output

    If we look inside we can see the file is in JSON and we can see a collection of packages I have installed.

    Winget Packages Output Contents

    I have removed some of the packages I installed but not all. Now I want to get the system up to sync.

    Checking Packages

    As Winget gets to packages that are either not installed or have upgrades it gets to work.

    Installing and updating missing packages

    Captcha: What's the standard TCP port of the following service?

    captcha

    0 comments