Skip to main content

Command referencewhere

where command (Windows / CMD)

WindowsCMDfilebeginner

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 / optionMeaning
/R dirSearch recursively below a directory.
/QReturn status without displaying matches.
/FQuote each result.
/TShow size and timestamp.
patternUse 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.

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.