Home

Jim Michaels

which for windows and dos

finds the would-be-executed-path of the executable in order of PATH environment variable. This one takes into account the various types of executables listed in one part of the registry of windows (windows version) or makes use of a fixed list. command-line tool.

license

which is under GPL3 License.

documentation

which - given full or base filename, tells which executeable in the PATH would be executed.
usage: which [/?] [[-]-?] [/h[elp]] [[-]-h[elp]] [[-]-v[er[sion]]] [/v[er[sion]]]
usage: which filename [filename ...]

This program finds where the executable (filename) is in the PATH which it would be executed in if you were to execute it. Extension not necessary.
In other words, it tells you the path of which of many executables would be running.
For example, I have many compilers installed, each of which has their own version of make.exe, and at different times one of them is in the path first.  this
uld tell you which one.
no arguments, or /? or -? or --? or --help or --h or -h or -help or gives this help.
/v or or /ver or /version or -v or --v or -ver or --version gives you the version number.
Example: which mode
Example: which mode.com l50.exe attrib autoexec
Example: which kernel32
Example: which kernel32.dll user32
Example: which kernel32.dll wmp.ocx
This executeable works with Windows, and differs from the DOS version in that it supports     more extensions, and attempts a read from the registry.
Both of these will give you nearly the same result unless there is no .com file but there     is a .exe, .bat, .pif, .cmd, .dll file or a .ocx file and you are o
T/2000/XP/Vista/7/8.
If no extension is specified, these file extensions are searched for in the following     order: .com, .exe, .bat, .pif, .cmd, .dll, .ocx.
The program takes the list from the windows nt registry and expands on it by making a     list out of it and adding .dll, and .ocx - if you are on windows 98, th
cmd extension is not included and the entries are hard-coded.
Copyright 2006-2009,2011 Jim Michaels. Under GPL3 license.

usage is very simple, really,

C:\prj\which\which-1.7\dos>which df l50
c:\djc\bin\df.exe
c:\u\l50.exe

C:\>

C:\prj\which\which-1.7\dos>which kernel32.dll
kernel32.dll not found in (
c:\djc\bin
c:\djc\libexec\gcc\djgpp\4.41
c:\djc\libexec\gcc\djgpp\4.41\INSTAL~1
c:\djc\gnu\emacs\bin
c:\djc\gnu\emacs\lib-src
c:\MIE7D8~1\mingw64\bin
c:\MI7C9A~1\mingw32\bin
C:\gnuwin32\GETGNU~1\bin
C:\gnuwin32\GETGNU~1\gnuwin32\sbin
C:\gnuwin32\GETGNU~1\gnuwin32\bin
C:\Perl\site\bin
C:\Perl\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\system32\WBEM
C:\PROGRA~1\PHP\
C:\PROGRA~1\PHP
c:\u
c:\x
c:\PROGRA~1\7-zip
c:\bin
C:\PROGRA~1\Csound\bin
C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\
C:\PROGRA~1\CMAKE2~1.8\bin
C:\PROGRA~1\COMMON~1\HP\DIGITA~1\bin
C:\PROGRA~1\HP\DIGITA~1\bin\
C:\PROGRA~1\HP\DIGITA~1\bin\Qt\QT43~1.3
C:\PROGRA~1\WinMerge
C:\PROGRA~1\OPENAX~1\bin
C:\PROGRA~1\NOTEPA~1\
c:\tsepro
)

C:\prj\which\which-1.7\dos>which which
.\which.exe

C:\prj\which\which-1.7\dos>cd  ..\win

C:\prj\which\which-1.7\win>which kernel32
C:\WINDOWS\system32\kernel32.dll

C:\prj\which\which-1.7\win>which user32
C:\WINDOWS\system32\user32.dll

C:\prj\which\which-1.7\win>which wmp
C:\WINDOWS\system32\wmp.dll

C:\prj\which\which-1.7\win>which wmp.ocx
C:\WINDOWS\system32\wmp.ocx

C:\prj\which\which-1.7\win>which gw
.\gw.cmd

C:\prj\which\which-1.7\win>which l50
c:\u\l50.exe

C:\prj\which\which-1.7\win>which fg
fg not found in (
c:\djc\bin
c:\djc\libexec\gcc\djgpp\4.41
c:\djc\libexec\gcc\djgpp\4.41\install-tools
c:\djc\gnu\emacs\bin
c:\djc\gnu\emacs\lib-src
c:\mingw-w64-bin_i686-mingw_20101003_sezero\mingw64\bin
c:\mingw-w32-bin_i686-mingw_20101003_sezero\mingw32\bin
C:\gnuwin32\GetGnuWin32\bin
C:\gnuwin32\GetGnuWin32\gnuwin32\sbin
C:\gnuwin32\GetGnuWin32\gnuwin32\bin
C:\Perl\site\bin
C:\Perl\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\system32\WBEM
C:\Program Files\PHP\
C:\Program Files\PHP
c:\u
c:\x
c:\program files\7-zip
c:\bin
C:\Program Files\Csound\bin
C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\
C:\Program Files\CMake 2.8\bin
C:\Program Files\Common Files\HP\Digital Imaging\bin
C:\Program Files\HP\Digital Imaging\bin\
C:\Program Files\HP\Digital Imaging\bin\Qt\Qt 4.3.3
C:\Program Files\WinMerge
C:\Program Files\OpenAxiom\bin
C:\Program Files\Notepad++\
c:\tsepro
)

C:\prj\which\which-1.7\win>which df
c:\djc\bin\df.exe