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
WHERE <file>
will work.
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". Note the following command and its output:
WHERE /R C:\Windows dxdiag
C:\Windows\System32\dxdiag.exe
C:\Windows\SysWOW64\dxdiag.exe
C:\Windows\WinSxS\amd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7\dxdiag.exe
C:\Windows\WinSxS\x86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91\dxdiag.exe
It 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
on the other hand, fails to return any result, because ".dll" is not in PATHEXT.
In this case, look at the result that adding a wildcard gives us:
WHERE /R C:\Windows dxdiagn*
C:\Windows\System32\dxdiagn.dll
C:\Windows\System32\en-US\dxdiagn.dll.mui
C:\Windows\SysWOW64\dxdiagn.dll
C:\Windows\SysWOW64\en-US\dxdiagn.dll.mui
C:\Windows\WinSxS\amd64_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_daccd04369b09c70\dxdiagn.dll.mui
C:\Windows\WinSxS\amd64_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_7c8d3f96e7882ec7\dxdiagn.dll
C:\Windows\WinSxS\x86_microsoft-windows-d..iagnostic.resources_31bf3856ad364e35_6.2.9200.16384_en-us_7eae34bfb1532b3a\dxdiagn.dll.mui
C:\Windows\WinSxS\x86_microsoft-windows-d..x-directxdiagnostic_31bf3856ad364e35_6.2.9200.16384_none_206ea4132f2abd91\dxdiagn.dll
It successfully returns all versions of dxdiagn.dll.
For more information, use "WHERE /?". Hope this helps!
where
worked for me on Windows 7 Enterprise