Open denelon opened 4 hours ago
Since the content update needs to be thorough enough to explain the complexity across multiple WinGet commands, it might be better to have an F.A.Q to cover this behavior in more detail. I'm open to suggestions here. Something like "why didn't the package I wanted get installed", or "why did the wrong package get installed". That way we can have those questions associated with different commands. There may be other better questions.
Brief description of your issue
Several folks have been confused about what happens when there is no exact match to a package.
The instructions at https://learn.microsoft.com/windows/package-manager/winget/install aren't clear enough.
The default query parameter "unzip" in this case is the search term used.
A case insensitive substring search is executed against each configured source with the intent of performing an install. In the case of the "msstore" source there is only one result returned. In the case of the "winget" source, no results are returned because the query parameter doesn't have any package where the substring has a case-insensitive match for the query string against any of the defined properties. Note that in this case a substring match is not sufficient to be treated as a "best match" result.
If only one result is returned as an effective match or the "best match" across all configured sources WinGet will install that package.
The behavior is different for the "Search" command. The search command will return all results from all configured sources including results that are not a candidate for a "best match". WinGet will perform the search across the "Name", "Id", "Moniker", and "Tags". In this case, the "msstore" source returns multiple results. The "winget" source also returns multiple results, and there is an indication of which field the match was found in.
In this case there is a single "best match" result from both the "winget" and the "msstore" source. Because there is more than one result, the user is prompted to disambiguate.
The results of
winget show <query>
can be used to understand what would happen if the commandwinget install <query>
is executed. If multiple packages are found, the user is asked to disambiguate. If only one best result is returned, then the output shows a subset of the manifest including information about the publisher and the package as well as the installer that would be selected for the devices running the command. Sometimes different architecture and locale will suggest different installers based on the metadata contained in the package manifest.