DEV Community

Cover image for Keep your Windows computer up-to-date with just one command
Duncan Lew
Duncan Lew

Posted on • Originally published at duncanlew.Medium

Keep your Windows computer up-to-date with just one command

Winget to the rescue to install and update all your programs

We all know that it’s important to keep all applications on your computer up-to-date. There are many reasons for updating your applications on a regular basis. Old software can contain security vulnerabilities, which can give hackers easy access to your computer. Developers often push out software updates to patch these security issues. Furthermore, there can be many app usability and efficiency issues that can be fixed with a simple software update. Just by downloading the latest version when available, you can reap all the benefits of better security and more improved applications. Who doesn’t want to always ensure that their application is running bug-free?

With Windows, there are many ways to keep your applications up to date. You can open up your installed applications and check manually if there are any updates available. You can also configure the application to automatically check for updates and install them automatically if available. What we’re going to focus on in this article, is how to manage all these updates with a package manager.

What’s a package manager?

A package manager gives you access to an organized list of all software packages installed on your computer and therefore allows you to upgrade them all with a single command. You save a ton of time and effort by letting a package manager manage your installed software. The alternative would be to open all the installed applications one by one and check if every one of them has any updates available.

The package manager for Windows

Winget, the package manager for Windows
Windows users have always been envying the native built-in package manager, Aptitude, in Linux since the dawn of time. Windows hasn’t had a native package manager until May 2020, when Microsoft launched its own Windows Package Manager called winget. Before the launch of winget, Windows users have had to look for alternative package managers. The alternative package managers are still viable options if you’d rather use them. Two package managers for Windows, which are still in active development, are Chocolatey and Scoop. Both of them provide command-line tools to install, update and configure your applications very easily. The biggest difference between Chocolatey, Scoop, and the Windows-native winget, would be the technical implementation of the package manager itself, the number of packages available in its repository and the ease of use. We will be focusing on the Windows-native winget, since this will be pre-installed on Windows machines in most instances.

Contested origins of winget

AppGet vs winget
When Microsoft announced that it was developing a native package manager for Windows, everyone was taken by surprise. The developer of the alternative package manager AppGet, Kevin Beigi, was even more taken off guard by this announcement. Microsoft actually reached out to this developer for interest in the inner workings of AppGet and how it can be integrated into Windows itself to make the everyday life of Windows users more enjoyable. However, at a certain point, Microsoft has gone quiet and surprisingly launched their own package manager winget. Microsoft basically Sherlocked AppGet. Kevin Beigi has provided a detailed blogpost on how the whole interaction went up to the point of him deciding to discontinue AppGet. AppGet used to be a thriving third-party package manager for Windows, but it has since been discontinued due to the release of winget by Microsoft. In the end, Microsoft finally gives credit to Kevin Beigi after a backlash from the community but doesn’t apologize for the way it handled the introduction of its own package manager.

Now that we know what a package manager is and have been introduced to a little history on winget, we can check out how we can use winget.


1. Download winget

The package manager for Windows, winget, is bundled with Windows 11 by default. If you’re using Windows 10, or for some reason winget isn’t installed yet, you can get it from the Microsoft Store. This command-line tool for managing your applications is called App Installer.
App Installer in the Microsoft Store
To verify that you have winget installed on your computer, you can open up the preferred command-line application of your choice. We recommend Windows Terminal, which you can also get from the Microsoft Store. Once your terminal application has been started, type the following command:

winget
Enter fullscreen mode Exit fullscreen mode

If winget was installed correctly, the output of the winget command should look like this:
Output for the winget command

2. Run winget

Before you run any winget commands, you will have to start up a terminal application first. Make sure, to always start your terminal application in admin mode. Installing and upgrading applications with winget, requires you to have admin access. Otherwise, every application that gets updated via winget, will ask you for permission to continue with a pop-up. This destroys the purpose of automating the upgrade process.

After starting up your terminal application in admin mode, you can check which applications are installed and which ones have updates available by running the following command:

winget list
Enter fullscreen mode Exit fullscreen mode

If there are updates available for a specific application, the column Available will be shown with the latest version that is available. As you can see from the Source column in the list output, there are applications that are managed by winget and some that are not. The beauty of winget, is that it can update all applications regardless of whether they are installed with or without winget. What more can we ask for?! 😎

Now, we have come to the magic command that upgrades all of our applications. Enter the following command in your terminal:

winget upgrade --all
Enter fullscreen mode Exit fullscreen mode

Winget will scan your system for the available apps that can be updated and update them immediately. The output looks as follows:
Upgrade output with winget

Congratulations, you have just upgraded all your applications to their newest versions! 🎉 Ideally, this is something that you’d want to do on a daily or weekly basis to make sure that you’re always running the latest version of all programs.

3. Find software to install

Winget isn’t just meant for updating your applications. It is also capable of installing applications. To get some inspiration on which software you can install, you can check out third-party web apps for browsing all the available apps for winget like winstall and winget.run. Many popular apps like Spotify, WhatsApp and Mozilla Firefox can be installed with winget. The commonly used apps meant for developers like GitHub Desktop, Docker and Windows Terminal can also be installed with winget.

If you’d like to install Spotify for example, you can type the following command in your terminal:

winget install -e --id Spotify.Spotify
Enter fullscreen mode Exit fullscreen mode

The web apps for browsing winget applications can also generate these commands for you for easy copy and paste. An example for Spotify can be seen with this link:
Example of installation instructions for Spotify on winget.run

4. Bulk install with winget

Setting up a new Windows machine can be a very laborious task. Downloading all the applications and installing them one by one can be quite tedious. This is where winget will shine combined with one of the third-party web apps. You can bulk install all the applications that you use, with just one command!

In winstall, you can select all the apps that you need and it will create a winget command allowing you to install them all in one go. This is an example for installing Microsoft Teams, Spotify and Mozilla Firefox:
Example generated script for installing applications using winget.

Copy the generated script from winstall to your clipboard and then paste it into your terminal and run it. Automating the setup for your new machine has just become a piece of cake!

5. Discover more options for winget

Installing and updating applications with winget is just one part of the story. Winget contains many other commands and options that you can use to explore the package manager. You could also search for applications with winget search, show info about a certain application or validate a manifest file you’re interested in. You can also configure the behavior of winget in its settings. If you’re feeling adventurous and would like to explore more stuff on winget, check out its documentation and settings.

Conclusion

It is very important to keep your applications up-to-date to keep hackers at bay. Security issues in apps can easily be fixed by just a simple update. Performance improvements and new features introduced by developers are also very good reasons to upgrade your system. However, going through all the applications to check for updates can be a tiresome task.

That’s why we’ve covered the native package manager for Windows called winget. It automates updating of all your applications with just a single command. Do remember to start your terminal application in admin mode for a seamless update progress without constant pop-ups asking you for permission to install the latest version of a program.

In addition to upgrading all your apps, winget can also install specific apps or a list of apps with just a single command. Microsoft has done a great job introducing this useful command-line tool and I hope that you can also benefit from this!

If the content was helpful, feel free to support me here:
Buy Me A Coffee

Top comments (0)