Command referencewhere
where command (Windows / CMD)
What it does
Locate matching files, especially executables resolved through PATH. Searches for the where command cmd executable usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.
Locate matching files, especially executables resolved through PATH.
Syntax
where [/R dir] [/Q] [/F] [/T] pattern...
Common options
| Flag / option | Meaning |
|---|---|
| /R dir | Search recursively below a directory. |
| /Q | Return status without displaying matches. |
| /F | Quote each result. |
| /T | Show size and timestamp. |
| pattern | Use wildcards to select names. |
Practical examples
Locate Python
where python
Shows matching executables from current directory and PATH.
Find config
where /R C:\Projects app.config
Searches below Projects.
Availability check
where /Q git && echo Git found
Uses the exit status in a conditional chain.
Linux ↔ Windows equivalent
Closest match: which (Linux / bash / sh / zsh). Locate the executable selected from the current PATH.
Common mistakes
- Confusing CMD where with PowerShell's Where-Object alias behavior.
- Assuming the first displayed path is used under every process's PATH.
Related commands
- dirList files and subdirectories with names, dates, sizes, and attributes.
- Get-CommandDiscover commands, aliases, functions, scripts, and applications available to PowerShell.
- whichLocate the executable selected from the current PATH.
- lsList directory entries and inspect file metadata.
- cdChange the shell's current working directory.
- findWalk directory trees and select entries using tests and actions.
- Get-ChildItemEnumerate items and child items in filesystem, registry, and other providers.
- cdDisplay or change the current directory in Command Prompt.
FAQ
What does where do in Command Prompt?
Locate matching files, especially executables resolved through PATH.
How do I run where in CMD?
Open Command Prompt and follow `where [/R dir] [/Q] [/F] [/T] pattern...`; quote paths containing spaces.
What is a practical where example in CMD?
Try `where python` — Shows matching executables from current directory and PATH.
Can where be used in a batch file?
Yes. Check its exit code and escape CMD metacharacters when input is variable.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.