After much Googling, I found all versions of where.exe available as below
For Windows 2000
Pick ‘Windows 2003 32bit sp2 SE’ at dllexedown.com (URL below)
For Windows XP-7
Pick matching download at this same URL, below:
where /? tells you all you need to know.
The downloaded where.exe can go anywhere in
%path%. If you download it to
path, like this:
N:\some_folder\>path %cd%;%path% Enter
start /max cmd /k to ‘spawn’ a window with new
Grab the ‘/max’ window with the mouse and its height shrinks to normal! But if instead one does this: hold down ALT, tap spacebar, release ALT, tap ‘m’, tap an arrow one or more times:[ENT]: then the newly spawned ‘/max’ window will stay ‘maxxed.’
%path% (display by echo %path%) applies only to the CMD window where the specified path %cd%;%path% command is executed — and to any more CMD windows which one ‘spawns’ from that same CMD window after setting the new %path%. I like to ‘spawn’ another CMD window like this:
start /max cmd /k
because the resulting large window does a good job at displaying such console applications (freeware) as the VDE Editor (similar to WordStar) or Nano. Before I spawn a new CMD, I first set CMD font to e.g. Lucida Console or (Win 7) Consolas 22, Buffer size to 999 and tick Quick Edit Mode.
@echo off setlocal enabledelayedexpansion set var_a=%1 call :sub %var_a% if exist %var_b% goto exit for %%i in ( .com .exe .cmd .bat) do ( call :sub %var_a%%%i if exist !var_b! goto exit ) echo INFO: could not find files for the given pattern(s) 1>&2 set "var_a=" set "var_b=" exit /b 1 :sub set var_b=%~$PATH:1 goto :EOF :exit echo %var_b% set "var_a=" set "var_b=" exit /b 0
With this simple code, you can create your custom function of “where” you are looking for executable files (.com .exe .bat) in the directories listed in the
PATH environment variable.
- Create a file called whereis.bat
- Insert the code above and save the file.
(You can save this file in the Windows
PATHto run the command from anywhere)
To use the command:
where.exe used to be included with Windows Resource Kits, but has been removed after inclusion to Windows Server 2003 (the OS). It’s also part of Visual Studio SDK.
I liked the “whereis.bat” solution Claus suggested.
I just had one problem with it on one occasion, when the file you’re looking for has spaces in it. Eg:
whereis.bat "my test.bat"
INFO: could not find files for the given pattern(s)
To solve this, I added quotation marks around %var_b% on this line within the batch-file:
if exist "%var_b%" goto exit
Then I get the output I was hoping for: