This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iki
Recipients Christophe Simonis, ajaksu2, andybuckley, brian.curtin, christian.heimes, edemaine, eric.araujo, iki, meatballhat, tarek,
Date 2010-07-09.16:35:28
SpamBayes Score 3.95603e-05
Marked as misclassified No
Message-id <>

Sorry for not reacting, it completely vaporized out of my head. I'll do the patch this weekend.

Agree, only which/which_files belong to public API.

Regarding PATHEXT:

1. When a new process is created, the value is taken from registry variable PATHEXT in the 'HKCU\Environment' key, or the 'HKLM\System\CurrentControlSet\Control\Session Manager\Environment' key (in this order). The first key is for custom user values, and PATHEXT is not set by default there. The second key is a system-wide setting and defaults to:
A. ".COM;.EXE;.BAT;.CMD" in Windows NT, and possibly also W2K (although it is already 5.0 version)
B. ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH" in Wine [01], XP and WS 2003 [02]
C. ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" in Vista and W7 and possibly also WS 2008.

2. When the PATHEXT is missing, or is set to be empty in registry, or  is set to be empty in the shell via "set PATHEXT=", then:
A. CMD.EXE, START.EXE and standard exec do use the default value, which is probably hardcoded somewhere (not taken from registry) ... tested on XP only
B. Wine [11] uses a hardcoded ".BAT;.COM;.CMD;.EXE" (I can't say I do see the reasons for this particular order)
C. GnuWin32 which utility [12] uses a hardcoded ".COM;.EXE;.BAT;.CMD"

So, in the corner case when the PATHEXT is set empty for whatever reason, we have basically the following options:

1. Find some magical way how to get the default value from windows. Any brave soul to fight this?

2. Stick with basic NT setting ".COM;.EXE;.BAT;.CMD", and document that it doesn't always match the execution behaviour in this case, eg. that .JS file would get executed on XP, but won't be found by which()

3. Resemble CMD.EXE/START.EXE and standard windows exec behavior, and hardcode the values for different windows versions from NT to W7, and for Wine. This is quite simple to do, as windows versions are well documented in platform.release()(we don't actually have to call this function, just check into which of the 3 intervals the current windows version fits). To do so, I only need someone to verify the correct default PATHEXT for W2K and WS 2008, as I do not have access to these.

My .02$ for 3, as this is what user expects.

What do you think?


(the manual is same for XP and WS 2003 so maybe they just used copy/paste without checking.


see / ... / which-2.20-src.diff line 388
Date User Action Args
2010-07-09 16:35:32ikisetrecipients: + iki, edemaine, christian.heimes, ajaksu2, tarek, eric.araujo, Christophe Simonis, andybuckley,, brian.curtin, meatballhat
2010-07-09 16:35:31ikisetmessageid: <>
2010-07-09 16:35:30ikilinkissue444582 messages
2010-07-09 16:35:28ikicreate