Command Not Found is a PowerShell 7 module that detects an error thrown by a command and suggests a relevant WinGet package to install, if available. It is a helpful tool, as it makes it easier to find and install the packages you need.
Command Not Found utility detects command-line errors in PowerShell
The Command Not Found utility can detect command line errors and it can be installed through PowerToys. Hence, you need to install PowerToys first. You will find this utility on the Command Not Found page under the Advanced category in PowerToys.
To install this module, your system should have the following components:
- PowerShell 7.4 or greater
- WinGet Client PowerShell module
You can install the above-mentioned components directly from PowerToys. Open PowerToys and go to the Command Not Found page. Now, expand the Command Not Found tab and click on the Install button to install these two components. After that, install the Command Not Found module. Now, restart PowerToys again.
If you get any error while installing the above-mentioned components and module, close PowerToys completely and launch it as an administrator. After following the above process, you will find the PowerShell 7 (x64) app on your system.
How it works
The PowerShell 7 Module detects the command line errors and suggests a relevant WinGet package to install (if available). For example, if you type the command code and hit Enter, it will suggest commands to install the required WinGet packages (see the above screenshot).
This utility is a part of Microsoft PowerToys. Therefore, POwerToys should be running in the background. If the PowerShell 7 does not work, launch PowerToys as an administrator.
Uninstalling the Module
To uninstall the Command Not Found module, open the respective page in PowerToys and click Uninstall.
You can read complete details on the Microsoft official website.