May 21st, 2024

WinGet.CommandNotFound

Christopher Nguyen
Product Manager II, Windows Terminal

We are pleased to announce the release of WinGet.CommandNotFound! This PowerShell module is a feedback provider plugin for PowerShell that leverages the Windows Package Manager to provide suggestions for packages to install when a native command cannot be found. The command-line predictor feature in PowerShell enables this module to display WinGet packages as predictive suggestions.

This module was originally incubated as a utility in PowerToys. Thanks to the help of the PowerShell and PowerToys community, we got lots of positive feedback to turn this PowerToys utility into a real PowerShell module! 🙂

Image of Microsoft WinGet CommandNotFound

Requirements

The Microsoft.WinGet.CommandNotFound module is built on the IFeedbackProvider interface, which is available with PowerShell 7.4.0-preview.2 or above. To display prediction suggestions, you need PSReadLine 2.2.6 or above.

You will also need Microsoft.WinGet.Client version 1.8.1133 or higher to receive suggestions.

If PSFeedbackProvider and PSCommandNotFoundSuggestion are not yet enabled, then you can run the following commands in PowerShell:

Enable-ExperimentalFeature PSFeedbackProvider
Enable-ExperimentalFeature PSCommandNotFoundSuggestion

You will only need to run these commands once and they will enable PSFeedbackProvider and PSCommandNotFoundSuggestion in your next session.

Installation

To install the WinGet CommandNotFound module, enter the following in PowerShell 7.4+:

Install-PSResource -Name Microsoft.WinGet.CommandNotFound

Setup

To load this module whenever a PowerShell session loads, you will need to add the following to your PowerShell profile:

Import-Module Microsoft.WinGet.CommandNotFound

You can enter code $profile or notepad $profile in PowerShell to open up your PowerShell profile in Visual Studio Code or Notepad respectively.

Thank you!

We would like to give a huge thanks to everyone that helped us incubate this feature in PowerToys and the PowerShell team for helping us push this to the PowerShell Gallery.

This module is also open-source so if you find any bugs or have an idea for a feature suggestion, then please visit https://github.com/microsoft/winget-command-not-found

Author

Christopher Nguyen
Product Manager II, Windows Terminal

0 comments

Discussion are closed.