winget update: Sort upgradable packages alphabetically by Name or ID
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:
- Set a default sort order (alphabetical by Name) for all list-based outputs.
- Add a
--sortargument to allow users to specifynameorid.
Proposed technical implementation details
- Default Behavior: Update the output logic for the
listandupgradecommands to sort the results collection alphabetically byNamebefore rendering the table to the console. - New Argument: Introduce a
--sort(or-s) parameter.- Example:
winget upgrade --sort nameorwinget list --sort id.
- Example:
- Settings Integration: Allow users to define a preferred default sort order in
settings.json(e.g.,"visual": { "defaultSortOrder": "name" }).
- 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)
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