179 words
1 minutes
Automating software installation with the winget CLI

References:

https://github.com/microsoft/winget-cli

At some point, your old machine has to be replaced with a new one. With that comes the tedious task of setting up your new machine with all the software you need. This can be a time-consuming task, especially if you have a lot of software to install. Luckily, Microsoft has created a package manager for Windows called winget that can help you automate this process. Winget comes pre-installed on Windows 11 and later, but you can also install it on older versions of Windows.

On your old machine, you can spin up a terminal and run the following command to export a list of all the software you have installed:

winget export -o .\winget.json

I keep this exported .json file in git, where I update it every time I install new software (which doesn’t happen very often). This way I always have an up-to-date list of all the software I want to install on a new machine.

On the new machine, we spin up a terminal as admin, and run the following command to start installing the software:

winget import -i .\winget.json --accept-package-agreements
Automating software installation with the winget CLI
https://fuwari.vercel.app/posts/productivity/winget/
Author
cognitive;overload
Published at
2025-03-11
License
CC BY