windows bat file question

Peter Hansen peter at engcorp.com
Thu Mar 3 08:13:03 EST 2005


Tim Roberts wrote:
> Tom Willis <tom.willis at gmail.com> wrote:
>>rem = """-*-Python-*- script
>>@echo off
>>rem -------------------- DOS section --------------------
>>rem You could set PYTHONPATH or TK environment variables here
>>python %*
> 
> This should make it work:
>   python %0.bat %*

Only, among other issues, if you type the full path to the
batch file, or if it's in the current directory.  This
approach fails if you put the batch file in a directory
somewhere along your path.

There are only a couple of useful ways to do this sort of
thing under Windows operating systems, and the easiest by
far is to abandon any support for Windows 98 and just use
the PATHEXT support in Windows NT/XP and friends.

-Peter



More information about the Python-list mailing list