Contents

Getting along with winget - advanced package installation

In my previous post I went trough my experiences with using the basic Winget commands. And mentioned that anyone who needs more control over the installation options will quickly note that when Winget uses the default installation options when installing packages. In this post I would like to share with you how I managed to solve this and get the control I need during the installation process.

Winget Advanced installation, the override command

The winget install documentation shows that an --override option is available, with an input “A string that will be passed directly to the installer”. Simply said it should allow to override the default installation options with custom ones, similar to the way a regular installer GUI allows to the user to change settings during the installation process. A.k.a. a custom installation and exactly what I need!

Unfortunately getting the the required input options for this command turned out to be lots of interwebs searches, Inno Setup documentation digging combined with trial and error. So the best approach I discovered so far is to run the installer with /? to get the installer help. As shown for the Git installer in the following image.

/posts/2022/getting-along-with-winget-advanced-installation/img7.png
Git installer with /? command line parameter result

And simply going trough the available parameters and identifying the most interesting ones (marked in the above screenshot).

  • /SILENT Instructs the installer to be silent <- Enables installations that do not require settings to be specified via the installer GUI
  • /SAVEINF Instructs the installer to save installation settings to the specified file
  • /LOADINF Instructs the installer to load the settings from the specified file

Saving and loading the custom installation options made sense so time to run with these parameters. First the save command combined with the Git installer.

This resulted in the following .inf file.

/posts/2022/getting-along-with-winget-advanced-installation/img8.png
Content of GitInstallParams.inf

Info
P.S. I went with thew .inf file extension because of the parameters being called /SAFEINF and /LOADINF. But as I understand any file extension should work here.

Since the .inf file looked promising it was time to combine all the parameters into a single command line and running it, Combined command line:

And as shown in the following screenshots running this command results in a successful installation!

/posts/2022/getting-along-with-winget-advanced-installation/img9.png
Installation in progress
/posts/2022/getting-along-with-winget-advanced-installation/img10.png
Installation successful

To top it all off a quick check of the git config which seems to confirm a successful installation with the intended installation configuration.

/posts/2022/getting-along-with-winget-advanced-installation/img11.png
Verying Git installation config using ‘git config –list’

Success! I and hopefully whoever reads this post is now able to use Winget and still achieve custom installation configuration.

Winget limitations

It should come as no surprise there are also downsides to both Winget in general and the explained approach with --override command. This chapter contains a short list of the ones I encountered.

  • As of writing this post Winget only supports .zip installer in the preview build
  • The winget upgrade --all command does not respect the configuration set with the --override (this behavior seems to differ per application)
  • The bulk commands winget export and winget import don’t offer any support for the --override input, meaning that bulk installation can only be done with default installation options
  • Winget lacks a auto update feature to automatically update all or a selected set of packages. Thankfully someone from the community stepped in and created one Winget-AutoUpdate

Wrapping up

And this is it for the the advanced installation of packages using Winget. I really love the simplicity, accessibility and the fact that Winget comes pre-installed on recent Windows machines. And it is because of this focus on basic simplicity installing packages using advanced commands feels a bit cumbersome. Compared to the other packge management tools Winget is still relatively new and being actively developed so who knows what upgrades this tool will get.

Thanks for reading this post and if you liked it don’t be shy and have a look at my other posts .