DEV Community 👩‍💻👨‍💻

Cover image for First steps with WinGet
Emanuele Bartolesi
Emanuele Bartolesi

Posted on

First steps with WinGet

At Microsoft Build 2021, Microsoft released the version 1.0 of Winget. This tool is a part of the new Windows Package Manager for Windows 10 and Windows 11.
You can use Winget from the command-line to discover new apps, install, update and remove them.

Installation

If you are running Windows 11 or Windows 10 version 1809 or later, you don't need to install anything. It's shipped with the operative system as update and it's a part of Windows 11 default installation.

In the other cases, you can download it directly from this link: ms-appinstaller:?source=https://aka.ms/getwinget

Search an application with Winget

To search for applications you can open your favorite terminal application (I use Windows Terminal and I love it) and type the command below:

winget search spotify
Enter fullscreen mode Exit fullscreen mode

In this case, obiously, winget are searching for spotify.

Image description

Install an application

With the command below you can install an application

winget install vscode
Enter fullscreen mode Exit fullscreen mode

you can also you the silent mode with the following command

winget install vscode -silent (or -h)
Enter fullscreen mode Exit fullscreen mode

You don't see an external UI for the installation, but a progress bar appears directly in the console.
This is useful for automated installations of your machine (after a reset, for example).

(I will talk about automation in a paragraph below)

List installed apps

It's very easy, you can have a list of all installed application on your machine:

winget list
Enter fullscreen mode Exit fullscreen mode

There is a column that specifies if the installation comes from winget or a "normal" installation.
Another column at the end of the table, indicates if the application has updates

Image description

Update applications

Keep the applications up-to-date is important for having the latest features released from the developers but it's more important for the security of your machine.

winget upgrade
Enter fullscreen mode Exit fullscreen mode

if you want to update all the application directly you can use the following command:

winget upgrade all
Enter fullscreen mode Exit fullscreen mode

You can also update a single application

winget upgrade id vs-code
Enter fullscreen mode Exit fullscreen mode

Image description

Export and import applications

This is my favorite features of winget. You can export all the installed application of an existing machine to another machine.
This is very useful if you want to have a kind of backup of your applications list and restore that backup in the another machine.

winget export -o .\my-applications.json
Enter fullscreen mode Exit fullscreen mode

You can set the path of the json file in a OneDrive directly, for instance. In this case you can access the latest version of the export everytime from another machine.

If you want to import the same list in an other machine:

winget import -i .\my-applications.json
Enter fullscreen mode Exit fullscreen mode

Conclusion

In the past, as you know, I really loved Cholately or Boxstarter, but since a few months I am using only winget to have the same goals.

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.