Skip to main content

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

1

Enable in PowerToys

Open PowerToys Settings and enable Command Not Found
2

Shell Integration

The utility automatically integrates with your shells (PowerShell, CMD)
3

Use Naturally

Type commands in your terminal - suggestions appear automatically for unknown commands

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

1

Open PowerToys Settings

Launch PowerToys Settings application
2

Navigate to Command Not Found

Find Command Not Found in the utilities list
3

Toggle State

Enable or disable the utility with the toggle switch
Changes to shell integration may require restarting your terminal sessions.

Supported Shells

Full integration with PowerShell 5.1 and PowerShell 7+Suggestions appear automatically after “command not found” errors

Use Cases

Installing Development Tools

When you need a tool you don’t have installed:
Common tools:
  • git → winget install Git.Git
  • python → winget install Python.Python.3.12
  • node → winget install OpenJS.NodeJS
  • docker → winget install Docker.DockerDesktop
When following online tutorials that assume tool availability:
  1. Tutorial says: “Run kubectl get pods”
  2. You type the command
  3. Command Not Found suggests: winget install Kubernetes.kubectl
  4. Install and continue tutorial
Running scripts written for Linux on Windows:

Typo Correction

Package Discovery

1

Try Command

Type a command you think should exist
2

Get Suggestion

Command Not Found suggests package
3

Install & Use

Install the package and run your command

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:
Source reference: src/modules/cmdNotFound/CmdNotFoundModuleInterface/dllmain.cpp

Shell Profile Modifications

When enabled, Command Not Found modifies shell profiles: PowerShell:
Location: $PROFILE (typically ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1)

Troubleshooting

Check:
  • Command Not Found is enabled in PowerToys Settings
  • Terminal session started after enabling utility
  • PowerShell profile loaded correctly
Verify profile:
Possible causes:
  • Outdated package database
  • Multiple packages provide same command
Solutions:
  1. Update winget: winget upgrade
  2. Check alternative packages: winget search <command>
  3. Refresh Command Not Found database (restart PowerToys)
Fix:
  1. Disable Command Not Found in PowerToys
  2. Restart PowerToys
  3. Re-enable Command Not Found
  4. Restart terminal sessions
This resets shell integration hooks
If you have other “command not found” handlers:
  1. Check PowerShell profile for conflicts
  2. Ensure Command Not Found handler runs last
  3. Consider disabling other handlers
Profile inspection:

See Also