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

winget update: Sort upgradable packages alphabetically by Name or ID

Open JeetKarena opened this issue 10 months ago • 2 comments

Relevant area(s)

WinGet CLI

Description of the new feature / enhancement

Currently, when running winget upgrade or winget list, the results are returned in an unsorted manner (likely based on the order they are found in the database or the local manifest index).

As shown in the example below, packages appear in a jumbled order, making it difficult for users to scan for specific applications when many updates are available:

Portmaster                  Safing.Portmaster           2.0.24  2.1.7     winget
VeraCrypt 1.26.20           IDRIX.VeraCrypt             1.26.20 1.26.24   winget
Node.js                     OpenJS.NodeJS.LTS           24.12.0 24.13.0   winget
Postman x64 11.80.0         Postman.Postman             11.80.0 11.80.4   winget
...
Zed                         ZedIndustries.Zed           0.218.7 0.219.4   winget

This request is to either:

  1. Set a default sort order (alphabetical by Name) for all list-based outputs.
  2. Add a --sort argument to allow users to specify name or id.

Proposed technical implementation details

  • Default Behavior: Update the output logic for the list and upgrade commands to sort the results collection alphabetically by Name before rendering the table to the console.
  • New Argument: Introduce a --sort (or -s) parameter.
    • Example: winget upgrade --sort name or winget list --sort id.
  • Settings Integration: Allow users to define a preferred default sort order in settings.json (e.g., "visual": { "defaultSortOrder": "name" }).

JeetKarena avatar Jan 17 '26 06:01 JeetKarena

  • Duplicate of #4238

As a workaround, you may do winget list | sort in PowerShell, but that isn't all that user-friendly. Instead, if you want to use the output for any programmatic use, you may consider using the WinGet PowerShell Module. Once installed, you can run

Get-WinGetPackage | Where IsUpdateAvailable | Sort-Object Name

(Get-WinGetPackage is the equivalent of winget list and Get-WinGetPackage | Where IsUpdateAvailable gets you the winget upgrade output)

mdanish-kh avatar Jan 17 '26 09:01 mdanish-kh

Hello @@JeetKarena,

We've identified this as a duplicate of another issue or PR that already exists. This specific instance is being closed in favor of the linked issue. Please add your 👍 to the other issue to raise its priority. Thanks for your contribution!

Template: msftbot/duplicate/closed