python .bat wrapper

Michal Wallace sabren at manifestation.com
Wed Feb 16 03:18:25 EST 2000


hey all....

I dunno if there's already something like this, but I
kinda missed perl's pl2bat... It added a little cruft
to a copy of your perl file to let dos run it as a batch.

Here's how to do it for python.. the only side-effect is
defining a global variable (but by convention, REM would
be a constant anyway, so it's no problem to just redeclare
it later..)

----------------------------
@echo off
REM = """
REM python -x skipped that first line...
REM make sure to change the next line to
REM whatever this file is called:

python -x test.bat
goto end
"""

# python code goes in here
print "hello, world!"


"""
:end """
----------------------------

cheers,

-Michal
http://www.sabren.com/






More information about the Python-list mailing list