This page has moved. Update your links to: http://www.nedbatchelder.com/code/utilities/wh_py.html

[*]
Ned Batchelder
wh.py
» Home : Code : Shell Utils

I like the 'which' command on Unix; it finds the executable on the path that will be executed when you type any given command. I have cygwin, which provides a which.exe, but I don't like the way it Unix-izes all the paths, and it doesn't understand the way Windows actually finds executables. Visual Studio provides a where.exe, which does the same sort of thing, but it requires the full file name (foo.exe) rather than just the command (foo). If I knew it was a .exe rather than a .cmd, I probably wouldn't need help in the first place!

I wrote wh.py to do the job right: it understands the full semantics of mapping Windows commands onto files in the file system (including the PATH and PATHEXT environment variables), and it has the extra bonus of listing all of the files that qualify, in search order, so you can see that files are being occluded by each other.

Download: wh.py