Skip to content

Windows WHERE command

The WHERE command in Windows is a powerful tool used to search for files and directories within the system. It allows users to quickly locate the location of a specific file or folder by specifying search criteria such as file name, extension, or location. This command provides a convenient way to find files without having to manually search through directories. Additionally, it can also be used to search for executable files within the system path. The WHERE command in Windows is a valuable tool for efficient file management and organization.

WHERE Syntax:

Terminal window
where [/r dir] [/q] [/f] [/t] command...

Options:

OptionDescription
/rRecursively searches for the command in the specified directory and its subdirectories.
/qQuiet mode; does not display the headers.
/fDisplays the matched file in quotation marks.
/tPerforms the search with timeout.

Parameters:

ParameterDescription
commandSpecifies the command or program to search for.

WHERE Usage:

Find the Location of a Specific Program

Terminal window
where notepad

Searches and displays the location of the program “notepad”.

Search for a File Using Wildcard

Terminal window
where *.txt

Locates and lists all files with the “.txt” extension in the current directory.

Locate Multiple Programs

Terminal window
where notepad calc

Finds and shows the locations of both “notepad” and “calc” programs on the system.

Search for a Program in a Specified Path

Terminal window
where /R "C:\Windows\System32" calc.exe

Recursively searches for the program “calc.exe” in the specified directory “C:\Windows\System32”.

How do I use where in Windows?

To use the where command in Windows, execute the following command:

Terminal window
where filename

What is the purpose of the where command in Windows?

The where command in Windows is used to locate and display the path of a file or program within the system.

Terminal window
where notepad.exe

How can I search for a file with a specific extension using the where command?

To search for a file with a specific extension using the where command, use the following syntax:

Terminal window
where *.txt

Can I use wildcards with the where command in Windows?

Yes, you can use wildcards to search for files or programs with partial names using the where command.

Terminal window
where myprog*

How do I search for a file in specific directories using the where command?

To search for a file in specific directories using the where command, specify the directory paths along with the file name.

Terminal window
where /R C:\Windows notepad.exe

Is it possible to search for executables in the system PATH with the where command?

Yes, you can search for executables that are within the system PATH using the where command.

Terminal window
where /R %PATH% filename

How can I list all directories in the system PATH using the where command?

To list all directories in the system PATH using the where command, you can use the following command:

Terminal window
where /T

Applications of the WHERE Command

  1. Locating the path of an executable file.
  2. Finding the location of a specific command or program.
  3. Checking for the existence of a program in the system’s PATH.