winget-cli
winget-cli copied to clipboard
possibility to add parameters for installation of package
Description of the new feature/enhancement
Hey there, I would like to add parameters to the installation of a package, for example like "sql-server-express /SECURITYMODE=SQL /SAPWD=localadministrator" ~~(I know that it's possible to change password afterwards)~~
some (a lot?) installation programms features installation using commandline with parameters for settings like folderpath, setting password, changing language etc
this request is inspired by chocolatey, in example choco install sql-server-express -ia "/SECURITYMODE=SQL /SAPWD=localadministrator" -y
@herryxyz you can pass override parameters using "--override".
We have an ask to make these parameters "additional" to existing parameters in manifests as well.
PS C:\Users\denelon> winget install -?
Windows Package Manager v1.0.12151
Copyright (c) Microsoft Corporation. All rights reserved.
Installs the selected package, either found by searching a configured source or directly from a manifest. By default, the query must case-insensitively match the id, name, or moniker of the package. Other fields can be used by passing their appropriate option.
usage: winget install [[-q] <query>] [<options>]
The following arguments are available:
-q,--query The query used to search for a package
The following options are available:
-m,--manifest The path to the manifest of the package
--id Filter results by id
--name Filter results by name
--moniker Filter results by moniker
-v,--version Use the specified version; default is the latest version
-s,--source Find package using the specified source
--scope Select install scope (user or machine)
-e,--exact Find package using exact match
-i,--interactive Request interactive installation; user input may be needed
-h,--silent Request silent installation
--locale Locale to use (BCP47 format)
-o,--log Log location (if supported)
--override Override arguments to be passed on to the installer
-l,--location Location to install to (if supported)
More help can be found at: https://aka.ms/winget-command-install
@denelon Needs author feedback or closed?
@vedantmgoyal2009 I think this is the "add switches" rather than "--override". I've been thinking about something like "--augment" to make the switches in addition to those in the manifest. That way users would still get silent and maybe scope in addition to what they add rather than having to use "--override" and know all the switches.
Do you mean what git does?
git <command> <more-cmd> -- <additional-blah-blah>
Imagine you were using winget to install Visual Studio and you wanted to add some workloads.
You wouldn't necessarily want to have to look up the arguments for silent and scope, but you just wanted to add additional arguments for the installer.
winget would call the installer and have the switches for silent and scope, or during the "upgrade" flow the upgrade argument. You could then just pass the workloads with the "--augment" (or whatever we call it).
I think this is an important feature for Winget to have. In the issue https://github.com/microsoft/winget-cli/issues/2553 I compared how Chocolatey and Winget work:
I think it's easier to explain what I mean by giving an example (VirtualBox). In Chocolatey if I want to install VirtualBox without adding a desktop icon, but enabling the extension pack, I would use
choco install virtualbox --params "/NoDesktopShortcut /ExtensionPack". It's also possible to usechoco info virtualboxto find out about the parameters of certain package. I am not very experienced with Winget, so I would like to know if it has a similar feature (if it doesn't I would like to know the reason and suggest it to be implemented). I triedwinget show virtualboxbut couldn't find any package parameter. In the docs the only similar package parameters I saw were--locale,-land-a. Thank you in advance.
@denelon - See above linked PR
@Trenly Can you share an example with the new argument? After that, I'll close the Issue :)
@denelon - By default the Firefox (Mozilla.Firefox) installer adds a desktop shortcut, a taskbar shortcut, and a start menu shortcut. Before this change, for a silent install with no taskbar shortcut, users would have to run winget install Mozilla.Firefox --override '/S /TaskbarShortcut=false' (note the /S is required as the silent install switch from the manifest).
With this change, users can now use winget install Mozilla.Firefox --custom /TaskbarShortcut=false and no longer need to manually add the silent switch from the manifest.
Before this change winget install Mozilla.Firefox -s --override /TaskbarShortcut=false would not result in a silent install. With this change, winget install Mozilla.Firefox -s --custom /TaskbarShortcut=false will result in a silent install