EDIT: I should have added, if you can't use the WHERE command from the command prompt, check your PATH variable. (Just use the "path" command.) Make sure C:\Windows\System32 is in your path. That's where "where.exe" is located.
WHERE is the command you're looking for! WHERE is like a cross between the UNIX shell built-in "which" and the "locate" command, in that it works for both command executables and regular files.
It's also somewhat more complex than either of those two, although, in general a simple
It's different from the "locate" command in that it's not looking through the entire filesystem. Instead, the default behavior is to look for files in two locations:
- The current directory.
- All of the directories in the PATH variable.
So, any command that you can run directly from a command prompt without specifying the directory, will be found by the WHERE command. (Because any command like that is already in the PATH variable list.)
If you want to search only in the command path variable, you can use:
WHERE "$path:<search text>"
If, on the other hand, you want to find all copies of a file in a directory tree, you can use:
WHERE /R <Top Level Directory> <search text>
Finally, WHERE will find commands and any files with an extension from the PATHEXT variable without including the extension. All other files have to be specified either exactly or with wildcards.
Take for example the files "dxdiag.exe" and "dxdiagn.dll"
WHERE /R C:\Windows dxdiag
succeeds in returning all versions of "dxdiag.exe" because ".exe" is one of the extensions in the PATHEXT variable. (Note: "WHERE dxdiag" would have worked as well, because C:\Windows\System32 is in the PATH variable.)
WHERE /R C:\Windows dxdiagn
one the other hand, fails to return a result, because ".dll" is not in PATHEXT.
In this case, using:
WHERE /R C:\Windows dxdiagn*
successfully returns all versions of dxdiagn.dll.
For more information, use "WHERE /?". Hope this helps!