winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

possibility to add parameters for installation of package

Open herrxyz opened this issue 4 years ago • 6 comments

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

herrxyz avatar Aug 26 '21 08:08 herrxyz

@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 avatar Aug 26 '21 21:08 denelon

@denelon Needs author feedback or closed?

vedantmgoyal9 avatar Sep 19 '22 16:09 vedantmgoyal9

@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.

denelon avatar Sep 19 '22 16:09 denelon

Do you mean what git does?

git <command> <more-cmd> -- <additional-blah-blah>

vedantmgoyal9 avatar Sep 19 '22 17:09 vedantmgoyal9

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).

denelon avatar Sep 19 '22 17:09 denelon

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 use choco info virtualbox to 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 tried winget show virtualbox but couldn't find any package parameter. In the docs the only similar package parameters I saw were --locale, -l and -a. Thank you in advance.

ppvnf avatar Sep 26 '22 23:09 ppvnf

@denelon - See above linked PR

Trenly avatar Jan 13 '23 04:01 Trenly

@Trenly Can you share an example with the new argument? After that, I'll close the Issue :)

denelon avatar Jan 13 '23 19:01 denelon

@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

Trenly avatar Jan 13 '23 19:01 Trenly