Coder Social home page Coder Social logo

Comments (8)

Trenly avatar Trenly commented on June 14, 2024 1

The --custom WinGet switch will only override the custom switch.

Actually, it doesn't! --custom will only append the value

2024-05-17 10:07:01.168 [CLI ] WinGet invoked with arguments: 'install' '-m' 'C:\Users\WDAGUtilityAccount\Desktop\SandboxTest\3.12.3' '--verbose-logs' '--ignore-local-archive-malware-scan' '--dependency-source' 'winget' '--custom' '/quiet'
|
| Truncated for readability
|
2024-05-17 10:07:04.732 [CLI ] Starting: 'C:\Users\WDAGUtilityAccount\AppData\Local\Temp\WinGet\Python.Python.3.12.3.12.3\python-3.12.3-amd64.exe' with arguments '/passive /norestart /log "C:\Users\WDAGUtilityAccount\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Python.Python.3.12.3.12.3-2024-05-17-10-07-04.731.log" InstallAllUsers=0 PrependPath=1 /quiet'

from winget-pkgs.

SpecterShell avatar SpecterShell commented on June 14, 2024

The scope is controlled by the InstallAllUsers switch from the installer, which would be overrode by your own installer switches by using the --override switch from WinGet.

- Architecture: x86
Scope: machine
InstallerUrl: https://www.python.org/ftp/python/3.11.9/python-3.11.9.exe
InstallerSha256: AF19E5E2F03E715A822181F2CB7D4EFEF4EDA13FA4A2DB6DA12E998E46F5CBF9
InstallerSwitches:
InstallLocation: DefaultAllUsersTargetDir=<INSTALLPATH>
Custom: InstallAllUsers=1 PrependPath=1

It is recommended to use the --silent switch from WinGet for silent (without progress) installation.

from winget-pkgs.

github-account1111 avatar github-account1111 commented on June 14, 2024

\quiet was just for a minimum reproducible example. The full command is as follows:

/quiet AssociateFiles=0 CompileAll=0 PrependPath=1 Shortcuts=1 Include_doc=0 Include_debug=0 Include_dev=0 Include_exe=0 Include_launcher=0 Include_lib=1 Include_pip=1 Include_symbols=0 Include_tcltk=0 Include_test=0 Include_tools=0'

--silent alone simply isn't enough. What is the reason it is recommended?

Also, am I understanding correctly that simply using the --override switch negates the --scope switch entirely, even though I am not using any overrides that conflict with scope?

from winget-pkgs.

SpecterShell avatar SpecterShell commented on June 14, 2024

Sorry, I thought you were looking for a way to install it silently.

Take the x86 installer as an example. The --scope switch chooses which entry to use between the following two entries, the user one and the machine one:

Installers:
- Architecture: x86
Scope: user
InstallerUrl: https://www.python.org/ftp/python/3.11.9/python-3.11.9.exe
InstallerSha256: AF19E5E2F03E715A822181F2CB7D4EFEF4EDA13FA4A2DB6DA12E998E46F5CBF9
InstallerSwitches:
InstallLocation: DefaultJustForMeTargetDir=<INSTALLPATH>
Custom: InstallAllUsers=0 PrependPath=1
ProductCode: '{b047d2a0-fe22-4d51-ae4c-4fc15fb14b31}'
AppsAndFeaturesEntries:
- DisplayName: Python 3.11.9 (32-bit)
DisplayVersion: 3.11.9150.0
ProductCode: '{b047d2a0-fe22-4d51-ae4c-4fc15fb14b31}'
UpgradeCode: '{C2007350-35A9-53B8-9AC1-4EB4C04802E2}'
- Architecture: x86
Scope: machine
InstallerUrl: https://www.python.org/ftp/python/3.11.9/python-3.11.9.exe
InstallerSha256: AF19E5E2F03E715A822181F2CB7D4EFEF4EDA13FA4A2DB6DA12E998E46F5CBF9
InstallerSwitches:
InstallLocation: DefaultAllUsersTargetDir=<INSTALLPATH>
Custom: InstallAllUsers=1 PrependPath=1
ProductCode: '{b047d2a0-fe22-4d51-ae4c-4fc15fb14b31}'
AppsAndFeaturesEntries:
- DisplayName: Python 3.11.9 (32-bit)
DisplayVersion: 3.11.9150.0
ProductCode: '{b047d2a0-fe22-4d51-ae4c-4fc15fb14b31}'
UpgradeCode: '{C2007350-35A9-53B8-9AC1-4EB4C04802E2}'
ElevationRequirement: elevatesSelf

If one would like to install it in machine scope by specifying --scope machine, WinGet will choose the second one and apply the installer switches described in this entry, including the one InstallAllUsers=1 which asks the installer to install machine-wide. And if the --override WinGet switch is used, all these installer switches will be discarded.

from winget-pkgs.

github-account1111 avatar github-account1111 commented on June 14, 2024

No I should be sorry, I wasn't clear in explaining my intent in the initial example.

Thanks very much for the explanation, this makes much more sense now. Is there a technical reason winget discards Custom switches when --overrides is used? Can't they be appended? At the very least, a dialog before proceeding with the install informing the user that the --scope machine part of the install command will be discarded would be helpful.

from winget-pkgs.

SpecterShell avatar SpecterShell commented on June 14, 2024

No I should be sorry, I wasn't clear in explaining my intent in the initial example.

Thanks very much for the explanation, this makes much more sense now. Is there a technical reason winget discards Custom switches when --overrides is used? Can't they be appended? At the very least, a dialog before proceeding with the install informing the user that the --scope machine part of the install command will be discarded would be helpful.

It not only discards the Custom switch, but also all other switches, including the InstallLocation switch above, the pre-defined Silent switch (/quiet /norestart in this case), the pre-defined SilentWithProgress switch (/passive /norestart) and the pre-defined Log switch (/log "<LOGPATH>"). All of them will be overrode by --override.

The --custom WinGet switch will only override the custom switch. Since this switch has already been used for forcing the scope for the installer and will be overrode by --custom, you need to manually include InstallAllUsers=1 in your switches.

So the final command line would be like

winget install --id Python.Python.3.11 --scope machine --silent --custom 'InstallAllUsers=1 AssociateFiles=0 CompileAll=0 PrependPath=1 Shortcuts=1 Include_doc=0 Include_debug=0 Include_dev=0 Include_exe=0 Include_launcher=0 Include_lib=1 Include_pip=1 Include_symbols=0 Include_tcltk=0 Include_test=0 Include_tools=0' 

from winget-pkgs.

Trenly avatar Trenly commented on June 14, 2024

@github-account1111 - try using --custom instead of --override to add parameters to the install without erasing any of the ones defined in the manifest

from winget-pkgs.

microsoft-github-policy-service avatar microsoft-github-policy-service commented on June 14, 2024

Hello @github-account1111,

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any recent activity. It will be closed if no further activity occurs within 3 days of this comment.

Template: msftbot/noRecentActivity

from winget-pkgs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.