Overview
Command Not Found is a shell integration utility that provides intelligent command suggestions when you type a command that doesn’t exist in your system. It works with PowerShell and Command Prompt to suggest package installations, similar to the “command-not-found” feature in Linux distributions.This utility integrates with Windows Package Manager (winget) to provide installation recommendations.
Activation
Key Features
Intelligent Command Suggestions
Package Detection
Identifies which package contains the missing commandUses winget package database
Installation Commands
Provides exact winget command to installCopy-paste ready installation
Multi-Shell Support
Works in PowerShell and Command PromptAutomatic integration on enable
Similar Commands
Suggests similar available commandsHelps with typos and close matches
How It Works
When you type a command that doesn’t exist:Shell Integration
Command Not Found integrates with Windows shells through:- PowerShell Profile: Adds suggestion handler to
$PROFILE - Command Prompt: Registers command processor extension
- Automatic Updates: Keeps suggestion database current
Configuration
Enabling/Disabling
Supported Shells
- PowerShell
- Command Prompt
- Windows Terminal
Full integration with PowerShell 5.1 and PowerShell 7+Suggestions appear automatically after “command not found” errors
Use Cases
Installing Development Tools
Quick Tool Installation
Quick Tool Installation
When you need a tool you don’t have installed:Common tools:
git→winget install Git.Gitpython→winget install Python.Python.3.12node→winget install OpenJS.NodeJSdocker→winget install Docker.DockerDesktop
Following Tutorials
Following Tutorials
When following online tutorials that assume tool availability:
- Tutorial says: “Run
kubectl get pods” - You type the command
- Command Not Found suggests:
winget install Kubernetes.kubectl - Install and continue tutorial
Cross-Platform Scripts
Cross-Platform Scripts
Running scripts written for Linux on Windows:
Typo Correction
Package Discovery
Learning New Tools
Exploration
Try commands mentioned in documentation to see if they’re available
Package Names
Learn the official winget package IDs for tools
Alternatives
Discover alternative tools when suggestions show multiple options
Dependencies
Identify missing dependencies for complex software
Technical Details
Architecture
Database Integration
Command Not Found integrates with Windows Package Manager:- Package Index: Local cache of winget package data
- Command Mapping: Database of commands to packages
- Fuzzy Matching: Suggests similar commands for typos
- Update Mechanism: Periodically refreshes package information
Module Interface
Minimal implementation for shell integration:src/modules/cmdNotFound/CmdNotFoundModuleInterface/dllmain.cpp
Shell Profile Modifications
When enabled, Command Not Found modifies shell profiles: PowerShell:$PROFILE (typically ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1)
Troubleshooting
Suggestions not appearing
Suggestions not appearing
Check:
- Command Not Found is enabled in PowerToys Settings
- Terminal session started after enabling utility
- PowerShell profile loaded correctly
Wrong package suggestions
Wrong package suggestions
Possible causes:
- Outdated package database
- Multiple packages provide same command
- Update winget:
winget upgrade - Check alternative packages:
winget search <command> - Refresh Command Not Found database (restart PowerToys)
Shell integration broken after update
Shell integration broken after update
Fix:
- Disable Command Not Found in PowerToys
- Restart PowerToys
- Re-enable Command Not Found
- Restart terminal sessions
Conflicts with other command handlers
Conflicts with other command handlers
If you have other “command not found” handlers:
- Check PowerShell profile for conflicts
- Ensure Command Not Found handler runs last
- Consider disabling other handlers
See Also
- PowerToys Run - Quick application launcher
- Command Palette - Command execution interface
- Windows Terminal - Modern terminal application