PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

Gisle Vanem gvanem at yahoo.no
Thu May 7 03:15:36 EDT 2015


Chris Angelico wrote:

> There's a specific search order. Back in the days of DOS, it was
> simply "com, then exe, then bat", but on modern Windowses, I think
> it's governed by an environment variable.

You probably mean '%PATHEXT'. Mine is:
  .COM;.EXE;.BAT;.BTM;.CMD;.JS;.JSE;.WSF;.WSH;.MSC;.tcl;.py;.pyw;.pl;.htm;.html

In my favourite shell 4NT, I simply can have:
   set .py=python

Instead of the Explorer associations that the Python-installer puts
in my registry. Revealed from my shell:
   c:\> assoc .py
    .py=py_auto_file
   c:\> ftype py_auto_file
    py_auto_file="F:\ProgramFiler\Python27\python.exe" "%1"

In ShellExecuteEx(), what program gets launched for "py_auto_file" in this
case, seems to be determined by the 'SHELLEXECUTEINFO:lpClass' member.
I fail to see that Python uses this structure anywhere.

-- 
--gv



More information about the Python-list mailing list