Skip to content

winget upgrade <list(package_names)> #1855

Closed

Description

@Raffaello

Description of the new feature / enhancement

winget upgrade is expecting exactly one pacakge name to perform a specifc update.

It would be nice to change the syntax to accept a list/sequence/array of package names instead so multiple specific pacakges can be upgrade with 1 command ony instead of repeating for each single pacakge to be upgraded.

Proposed technical implementation details

multiple package to be installed with winget upgrade, for eg:

winget upgrade package1 package2 package3

Having a syntax that could be synthetized as :

winget upgrade [[-q] <query>] [<options>] <package1> [<package2> ... <packageN>] 

there is a conflict with the -v | --version option that can't be really used.
so eventually the [<options>] field could be paired with each <package> field, or better extrapolate the version from options:

winget upgrade [[-q] <query>] [<options>] [<version>]<package1> [<version2> <package2> ... <versionN> <packageN>] 

or simply change the version (-v) syntax to use column : symbol after the package to specify the version:
eg:
package1:1.0.0 or pacakge1:latest <- :latest is default so can be omitted => package1

winget upgrade [[-q] <query>] [<options>] <package1[:version]> [<package2[:version]> ... <packageN[:version]>] 

Activity

  1. added
    Issue-Feature
    on Jan 15, 2022
  2. ghost added
    Needs-Triage
    on Jan 15, 2022
  3. Raffaello commented on Jan 15, 2022

    @Raffaello
    Author

    another possibility is to do not touch upgrade command and create a sibling wrapper command upgrades (note the s), that is accepting a list of packages and pipeline them one at time to the upgrade command
    in this way it would like to call winget upgrade multiple time eventually.

  4. skelly37 commented on Feb 3, 2022

    @skelly37

    I like the idea, though I'd suggest to make such upgrades command actually upgrade everything (if no list of packages is provided). Something like apt dist-upgrade or pacman -Syu on Linux. Listing everything manually is painful.

    What about making 2 issues?

    1. make upgrade, install and uninstall accept more than one argument (because installing 50 packages one by one on a new machine is also painful)
    2. make upgrade actually update everything if no arguments are provided (or create a separate command)
  5. Raffaello commented on Feb 3, 2022

    @Raffaello
    Author

    I like the idea, though I'd suggest to make such upgrades command actually upgrade everything (if no list of packages is provided). Something like apt dist-upgrade or pacman -Syu on Linux. Listing everything manually is painful.

    What about making 2 issues?

    1. make upgrade, install and uninstall accept more than one argument (because installing 50 packages one by one on a new machine is also painful)
    2. make upgrade actually update everything if no arguments are provided (or create a separate command)
    1. the problem with install uninstall is that it might requires to click on the UAC or something else, accepting licenses. but would be interesting as well. (this might extends as well sometimes to the update so.... actually could be a problem... 😄 )

    2. upgrade can upgrade all already with --all option.

  6. skelly37 commented on Feb 3, 2022

    @skelly37

    I like the idea, though I'd suggest to make such upgrades command actually upgrade everything (if no list of packages is provided). Something like apt dist-upgrade or pacman -Syu on Linux. Listing everything manually is painful.
    What about making 2 issues?

    1. make upgrade, install and uninstall accept more than one argument (because installing 50 packages one by one on a new machine is also painful)
    2. make upgrade actually update everything if no arguments are provided (or create a separate command)
    1. the problem with install uninstall is that it might requires to click on the UAC or something else, accepting licenses. but would be interesting as well.  (this might extends as well sometimes to the update so.... actually could be a problem... smile )
    
    2. upgrade can upgrade all already with `--all` option.
    
    1. This can be solved with accepting licenses one after another, then it could work in the background, popping up the UAC when needed. And if it's not possible, the possibility to provide more than one query, then doing it the same way like now (i.e. accept licence, UAC and so on.. one after another) would be an improvement for me.
    2. Yeah, I've just noticed my mistake. Thanks
  7. Raffaello commented on Feb 3, 2022

    @Raffaello
    Author

    I like the idea, though I'd suggest to make such upgrades command actually upgrade everything (if no list of packages is provided). Something like apt dist-upgrade or pacman -Syu on Linux. Listing everything manually is painful.
    What about making 2 issues?

    1. make upgrade, install and uninstall accept more than one argument (because installing 50 packages one by one on a new machine is also painful)
    2. make upgrade actually update everything if no arguments are provided (or create a separate command)
    1. the problem with install uninstall is that it might requires to click on the UAC or something else, accepting licenses. but would be interesting as well.  (this might extends as well sometimes to the update so.... actually could be a problem... smile )
    
    2. upgrade can upgrade all already with `--all` option.
    
    1. This can be solved with accepting licenses one after another, then it could work in the background, popping up the UAC when needed. And if it's not possible, the possibility to provide more than one query, then doing it the same way like now (i.e. accept licence, UAC and so on.. one after another) would be an improvement for me.
    2. Yeah, I've just noticed my mistake. Thanks

    yes could have accept licenses like a --accept-license option to do automatically or something. and UAC just triggering the first time and keep using it (like giving the sudo permission), not sure if there might be any security implication doing this anyway.

  8. davvolun commented on Mar 8, 2022

    @davvolun

    I'd like to second this request. Specifically, I need to keep NodeJS LTS at a lower version because we haven't upgraded from 14 LTS to the latest 16 LTS yet, and won't be for some time (16 doesn't even enter Maintenance only mode until September, so we won't look at updating to it until then).

    I'd like to do winget upgrade --all --not --id 'OpenJS.NodeJS.LTS" or something to that effect, but at least doing winget upgrade PackageA PackageB PackageC is better than manually running them one at a time.

    A second option I could see is to lock my package. So I might run something like winget lock --id 'OpenJS.NodeJS.LTS' and then winget upgrade --all would skip over that particular package. Not sure if any other package managers have that kind of thing though.

    As a workaround, I'm wondering if query has support to do this, or if I can write a simple script to take the results from winget upgrade default usage and run upgrade one at a time -- is there a way to just get the Id column output from winget upgrade?

    I'm not really seeing a full description of the --query parameters. Can I do something like winget upgrade -q "PackageA|PackageB|PackageC" or possibly winget upgrade --all --query '^OpenJS.NodeJS.LTS (assuming ^ would mean negation in the query)?

  9. eidylon commented on Apr 13, 2022

    @eidylon

    Yes, yes, please. 👍🏼👍🏼 ... I was just coming to post this suggestion. upgrade --all is annoying right now, because there's numerous packages that fail/don't upgrade properly (e.g. Microsoft.EdgeWebView2Runtime and Microsoft.dotnet), so doing --all is annoying because it tries to upgrade them and I get UAC and other user prompts, and then still have them in the list anyway.

    So, to only deal with the installs that work, without doing multiple commands, I wanted to just do something like
    winget upgrade Dropbox.Dropbox Microsoft.dotnetRuntime.3-x64
    , and was very surprised that that did not work.

    Maybe the --query parameter would help for this? As davvolun mentioned, does -q support any kind of advanced pattern matching that could be used to pull a list of items that aren't all simply variants of the same substring? Based on the docs here, it doesn't look like it.

    image

    Maybe that can be expanded to support standard RegEx matching? Then like davvolun said, it could be used to specify options (or even fancier matches), such as
    winget upgrade -q (Dropbox.Dropbox)|(Microsoft.dotnetRuntime.3-x64)

  10. XeroxDev commented on May 2, 2022

    @XeroxDev

    I hope this will be added. Until then, I've created a small ps-function which can be added to the profile.

    function wgetup {
        $cmd = ""
        $args = $args | ?{$_ -ne ""}
        foreach ($arg in $args) {
            $cmd += "winget upgrade $arg; "
        }
        Invoke-Expression $cmd
    }

    Usage: wgetup package1 package2 package3

    It isn't fancy nor professional, but for private use, it does the job.

  11. pavangayakwad commented on May 24, 2022

    @pavangayakwad

    Team, please understand the convenience offered by these two commands in linux world and imitate the same with winget. Users will be okay with whatever approach you take to achieve it. But we need these features as soon as possible, you can't keep discussing this for months and years. Please!!

    1. It only installs what i want, same way we want winget to upgrade only the packages that we want to upgrade.

    apt install git npm

    1. Here is another scenario that saves me from accepting UAC popup 10 times or more and I get things done with a simple single line command.

    sudo apt upgrade -y

  12. skelly37 commented on May 24, 2022

    @skelly37

    Pavan (@pavangayakwad)

    2. Here is another scenario that saves me from accepting UAC popup 10 times or more and I get things done with a simple single line command.
    

    sudo apt upgrade -y

    This can be solved by packages like gsudo but remember that achieving the unix feeling ain't as easy as it may seem. It depends also on the app devs and whether they provide some other way to install their apps (instead of the GUI installers). But UAC prompts should disappear with sudo for Windows programs.

    Though I agree that lack of response for need no.1 is sad.

  13. brkerez commented on Aug 11, 2022

    @brkerez

    I just want to voice my support for this and add my insignificant chaotic pieces to the debate ;)

    I think multiple packages support for upgrade/install/uninstall is immensely useful, and coming from Chocolatey world, this missing feature is one of the main reasons I still didn't completely switch to winget

    I know that winget has many specifics, and I will not pretend I understand all the implications, but I think you can take plenty of inspiration from Chocolatey because they've been there

    • I think to make it so upgrade accept more packages is much better than introducing new special command upgrades
      • It's much more intuitive and flexible to use only one command
      • it's standard for all win/linux package managers (AFAIK). It would be unwise to go against the flow in this case, it would be simply confusing and winget-specific
      • I use lots of install/upgrade scripts that are constantly evolving. The potential need for changing command from upgrade to upgrades and back based on the number of packages to upgrade/install/... is an unpleasant thought. Even without scripts involved, the same thing applies to day-to-day ad-hoc upgrades etc
    • licenses - chocolatey has AFAIK 2 options
      • --accept-license parameter
      • you can persist your preference by choco feature enable -n allowGlobalConfirmation, and the license confirmation is away for good
    • this is more like nice-to-have, but you can prevent a package from upgrading by choco pin <package>. Such package is ignored when running choco upgrade all
    • regarding UAC - I think this issue is not something that should stand in the way of implementing multi-upgrade/install. UAC is simply there, and there is no easy solution, but you can always work around that, and winget will probably not resolve that in some new way so I think you shouldn't let it stand in the way. I think Chocolatey also does not care too much ;)
      • gsudo is great, I use it all the time
      • for bigger installs/upgrades it is better (at least for me) to run shell instance (whether is it conemu/win-terminal/...) in an elevated mode or use something like gsudo pwsh prior to running the upgrades, so the whole session is elevated and I only get one UAC prompt at the start of the session, do what I need and exit the session. So this is not winget-specific, it's damn Microsoft Windows, I hate UAC ;)
  14. Raffaello commented on Aug 11, 2022

    @Raffaello
    Author

    I just want to voice my support for this and add my insignificant chaotic pieces to the debate ;)

    I think multiple packages support for upgrade/install/uninstall is immensely useful, and coming from Chocolatey world, this missing feature is one of the main reasons I still didn't completely switch to winget

    I know that winget has many specifics, and I will not pretend I understand all the implications, but I think you can take plenty of inspiration from Chocolatey because they've been there

    • I think to make it so upgrade accept more packages is much better than introducing new special command upgrades

      • It's much more intuitive and flexible to use only one command
      • it's standard for all win/linux package managers (AFAIK). It would be unwise to go against the flow in this case, it would be simply confusing and winget-specific
      • I use lots of install/upgrade scripts that are constantly evolving. The potential need for changing command from upgrade to upgrades and back based on the number of packages to upgrade/install/... is an unpleasant thought. Even without scripts involved, the same thing applies to day-to-day ad-hoc upgrades etc
    • licenses - chocolatey has AFAIK 2 options

      • --accept-license parameter
      • you can persist your preference by choco feature enable -n allowGlobalConfirmation, and the license confirmation is away for good
    • this is more like nice-to-have, but you can prevent a package from upgrading by choco pin <package>. Such package is ignored when running choco upgrade all

    • regarding UAC - I think this issue is not something that should stand in the way of implementing multi-upgrade/install. UAC is simply there, and there is no easy solution, but you can always work around that, and winget will probably not resolve that in some new way so I think you shouldn't let it stand in the way. I think Chocolatey also does not care too much ;)

      • gsudo is great, I use it all the time
      • for bigger installs/upgrades it is better (at least for me) to run shell instance (whether is it conemu/win-terminal/...) in an elevated mode or use something like gsudo pwsh prior to running the upgrades, so the whole session is elevated and I only get one UAC prompt at the start of the session, do what I need and exit the session. So this is not winget-specific, it's damn Microsoft Windows, I hate UAC ;)

    Nice points but it looks like you are more oriented (and biased) to use unix systems (Linux, MacOS) rather the Microsoft based ones, and tools like chocolately and gsudo. Then there is no really need to use Winget (and Powershell) i think.

    So I am not sure anymore what are the points on your comment that could help improve Winget.


    Besides,
    to upgrade multiple pacakges without upgrading all (--all) it would be enough that there is an easy way to retrieve the list of IDs of the pacakges instead of the Name | Id | Version | Available | Source table.
    so it is very trivial how to upgrade multiple packages in a for loop.

    Said so, going a step further, it is still trivial to have a list of pacakges to upgrade and create a for loop to upgrade them.

    Because when you want to upgrade some packages you must know their names/ids and have a list of them anyway.
    So here there is just the simple trade-off of built-in an internal winget loop or doing it from the CLI with a script calling winget multiple times and each time with just 1 package to upgrade.

  15. 10 remaining items

  16. Raffaello commented on Feb 18, 2023

    @Raffaello
    Author

    Demitrius Nelon (@denelon) what is the point of pinning a pacakge when a pacakge can be upgraded by windows update service or some apps even auto updates like edge and so on? besides isn't a possible security risk pinning a pacakge?

  17. Masamune3210 commented on Feb 18, 2023

    @Masamune3210

    winget cant help it if the package or anther part of the system updates the package themselves, the pin is there to make sure winget doesn't do it, that's it.

    yes, but its a security risk to pin a package in apt or any other package manager as well, winget is no different here

  18. brkerez commented on Feb 20, 2023

    @brkerez

    Hey all, we've just added multiple packages to the winget install command.

    multi-install

    We already had winget import which is why that feature was relatively low in priority.

    Some of the arguments don't make sense when installing multiple packages (like "--override") and we've reworked how some of the arguments are handled to give improved behavior and output.

    We've also released the experimental support for winget pin in the latest preview release.

    Given winget pin it may be easier to achieve the desired result for this Issue with winget upgrade --all. I'm aware of several installers that don't give enough or the correct data for pinning to work properly, but we're continuing to improve the product.

    We've shared how we reason about the Roadmap so you can understand how we prioritize work.

    great news, greatly appreciated, thanks!

  19. denelon commented on Feb 22, 2023

    @denelon
    Collaborator

    Multi-upgrade is also now supported in the lastes preview:
    multi-upgrade

  20. github-account1111 commented on Jul 10, 2024

    @github-account1111

    Could you explain what I'm doing wrong Demitrius Nelon (@denelon)?

    > winget upgrade --id OpenJS.NodeJS --id Microsoft.VisualStudioCode
    Windows Package Manager v1.8.1791
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Argument provided more times than allowed: 'id'
    

    winget upgrade --id OpenJS.NodeJS works fine.

  21. Masamune3210 commented on Jul 12, 2024

    @Masamune3210

    you can't put more than one --id in the command

  22. github-account1111 commented on Aug 27, 2024

    @github-account1111

    Masamune3210 for some reason I didn't get notified despite being subscribed.

    you can't put more than one --id in the command

    You should be able to though. Otherwise, multi-user install and upgrade functionality is incomplete. --id is important and useful (otherwise it wouldn't exist). Why can the user only use it with a single package? That's arbitrary.

  23. Masamune3210 commented on Aug 27, 2024

    @Masamune3210

    I don't know, I just read the error message

  24. Masamune3210 commented on Aug 27, 2024

    @Masamune3210

    I know you are able to (or at least at one point we're able to) do install instead of upgrade and if the package was already installed, it would upgrade it

    Maybe that's the intended flow?

  25. github-account1111 commented on Jan 3, 2025

    @github-account1111

    Demitrius Nelon (@denelon) could you educate me? What's the expected workflow here? I guess I could do something like <list(package_ids)> | ForEach-Object { winget upgrade --id $_ } but it just seems arbitrary that a flag is limited to only when installing, uninstalling and upgrading single packages and not multiple. Is it for a similar situation as with --scope, --custom, --accept-package-agreements, --accept-source-agreements, etc. being limited to single-package installs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions