What is whereis command in Windows ?


👤 Diwas Poudel    🕒 12 Mar 2023    📁 TECH

In Linux, the whereis command is a powerful command that may be used to determine the location of executable programs, source or binary files, man pages, and configuration files. It can be simply used as :

whereis 

Replace with your desired files or man pages.

However, if you attempt to use the Whereis command in Windows, you will receive an error message stating that the command 'whereis' is not recognized as an internal or external command, operable program, or batch file. mostly due to the fact that Windows lacks this command. Windows is mainly GUI based and you can find them easily but if you want a command version of whereis in Windows then you are in right place.

Ourtechroom will assist you in locating the Windows equivalent of the Whereis command. They are very useful in Windows for locating program executables and configuration files.

The equivalent of the Whereis command in Windows

Let us look few of the equivalents of the Whereis command in windows.

1 Using gcm command in Powershell

PowerShell is a task automation system that consists of a command-line shell, a scripting language, and a configuration management framework.

You can use the below command which is equivalent to whereis command.

gcm 

gcm stands for Get-Command.

For demonstration, I am going to the find installation location of python.exe. So I use the below command.

gcm python.exe

This command will display ApplicationName, Version, Source, and version. Here, the installation location can be found under Source Column.

2 Using Get-Command in Powershell 

Get-Command is also useful command and you can use it as below.

Get-Command 

Example:

Get-Command Python.exe 

PowerShell's Get-Command Python.exe gets Python.exe's location and properties.

PowerShell searches the system PATH environment variable for the Python.exe executable file and gives the path, version number, module name, and command type.

If PowerShell cannot locate Python.exe, the command will return an error indicating that the command cannot be found.

gcm command and get-command
fig. gcm command and get-command

If you only want to get the Source of the Python installation then type below:

(Get-Command Python.exe).Source 
get only source from get-command
fig. get only the source path of the application from get-command

Also, the below command does the same:

(Get-Command python.exe).Path 

Replace Python.exe will your desired application or config file.

3 Using Where Command in Powershell and Command Line

Where is in fact a standalone application that can be used in both PowerShell and Command-Line. They are not built commands in the Command prompt.

The syntax for Where command looks like this:

where [/R path] [/Q] [/F] [/T] pattern [...]

where

  • /R path indicates the recursive directory or folder.
  • /Q only outputs the exit code.
  • /F shows only the file's full name.
  • /T only shows file change time.the 
  • pattern defines the file(s) to search.

Open Powershell or the command line and type the below command.

where.exe where python

Replace Python with the desired application or config file.

where command
fig. Use of Where command

If you know it is under C: drive and then you can recursively search for the file and get its location. For this type below command.

where /r c:\ python.exe

4 Using Where Command in Powershell and Command Line for multiple executable files

By separating file names with spaces, the where command can find multiple files. Here we will look how to find notepad.exe and calc.exe at the same time.

where notepad.exe calc.exe

5 Using Environment Variable

If the path of the application is enlisted in Environment Variables then you can use the below command. 

$env:path.Split(';') | gci -Filter  

Replace with desired application and files.

Here I am going to find out the installation path of the python application shown below.

$env:path.Split(';') | gci -Filter Python 

6 Using Filter Command

This will perform a recursive search over the contents of the C drive for any files whose names begin with FFmpeg, regardless of the extension of those files. If they are located, then you will see all paths displayed.

dir -path c:\ -filter ffmpeg.* -r

FAQ:

Is there a graphical user interface (GUI) tool in Windows that provides similar functionality to the where command?

Windows File Explorer search bar works like where. Search for files by name or pattern and select the location. Open File Explorer and type your search word in the top right box.

What is the where command's policy on file name suffixes like.exe and.dll?

Where looks for files using their full names, including the extension. For instance, if you typed notepad.exe, it would only look for the file with that name and not for any others that might be called notepad or notepad.dll.

Conclusion:

In this way, you can find out What are Whereis commands in Windows. And what is its nearly equivalent command in Windows?