newbie question

Tim Roberts timr at probo.com
Fri Mar 3 02:07:43 EST 2006


Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:

>On 1 Mar 2006 12:47:26 -0800, "D" <duncanm255 at hotmail.com> declaimed the
>following in comp.lang.python:
>
>> Yep, that should work.  Just keep in mind that if python.exe is not in
>> your path, you will need to either specify the entire path to it
>> (i.e. 'C:\python24\python C:\path\to\script\myscript.py'), or cd into
>> its directory first (i.e. if you want to just run 'python
>> C:\path\to\script\myscript.py').
>> 
>	Actually, on XP at least, some combination of commands enables
>things such that one can run without the "python" or the ".py" (but I
>think it garbages I/O redirection and maybe command line arguments --
>though this one worked)

That's the PATHEXT environment variable.

  C:\tmp>set PATHEXT
  PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PY;.PYW;.tcl

If you give a lone file name without an extension, it will try all of those
extensions, in that order, to find an executable.  Just add .PY to the end.

There is a bug in NT's CMD.EXE that screws up redirection of stdin, but
command line arguments and stdout work just fine.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list