Accurate Windows equivalent of the Unix which(1) command
Posted
by SamB
on Super User
See other posts from Super User
or by SamB
Published on 2010-05-29T16:25:10Z
Indexed on
2010/05/29
16:34 UTC
Read the original article
Hit count: 348
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?
© Super User or respective owner