Accurate Windows equivalent of the Unix which(1) command
- by SamB
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?