2

Possible Duplicate:
Windows equivalent of whereis?

It's easy enough to write a simple script that works like the which(1) command from unix, which searches for a given command along the PATH. Unfortunately, the CreateProcess function is not so simple, so this type of script does not give accurate results: CreateProcess looks in a number of directories not in the PATH, looks for files with all of the extensions listed in PATHEXT, etc. Worse, who knows what might be added in future versions of Windows?

Anyway, my question is: is there a robust, accurate which(1) equivalent for Windows, which always tells you what file CreateProcess would find?

1
  • I don't see how this is an exact duplicate of "Windows equivalent of whereis", since the asker may not know what "whereis" is (as I don't, and I've used unix for decades). And now that I've looked it up, it's not obvious how to map usage of whereis to that of which.
    – LarsH
    Apr 21, 2011 at 15:31

1 Answer 1

2

I use gnuwin32 which :-)

The GnuWin32 port of Which searches for a matching file in the following sequence of directories:

* The current directory.
* The directories that are listed in the PATH environment variable

Not the answer you're looking for? Browse other questions tagged or ask your own question.