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
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.
And simply going trough the available parameters and identifying the most interesting ones (marked in the above screenshot).
/SILENTInstructs the installer to be silent <- Enables installations that do not require settings to be specified via the installer GUI
/SAVEINFInstructs the installer to save installation settings to the specified file
/LOADINFInstructs 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.
/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!
To top it all off a quick check of the git config which seems to confirm a successful installation with the intended installation configuration.
Success! I and hopefully whoever reads this post is now able to use Winget and still achieve custom installation configuration.
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
winget upgrade --allcommand does not respect the configuration set with the
--override(this behavior seems to differ per application)
- The bulk commands
winget importdon’t offer any support for the
--overrideinput, 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
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 .