WHERE.exe – Windows CMD Command

Locate and display files in a directory tree.

The WHERE command is roughly equivalent to the UNIX ‘which’ command. By default, the search is done in the current directory and in the PATH.

By default, WHERE searches the current directory and the paths specified in the PATH environment variable.

The WHERE command is particularly useful to reveal multiple versions of the same comand/script on the system PATH such as a Resource Kit utility – Robocopy or ForFiles.

To run the WHERE command from PowerShell it is necessary to give the full path C:\Windows\System32\WHERE.exe otherwise the Where-Object cmdlet will take precedence.

Optional search paths (in pattern) should not be used in conjunction with /r Dir.


Find all copies of robocopy.exe in the current system path:

C:\Windows\System32\WHERE robocopy.exe

Find all files named ‘Zappa’ on the remote computer ‘Server64’ searching the subdirectories of Share1:

WHERE /r \\Server64\Share1 Zappa.*

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *