From: Thomas Heller [mailto:firstname.lastname@example.org]
Bruce's preamble can be simplyfied to this one:
@runpython c:\aaa\Python%0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 # start of python code print "Hello" # or whatever # EOF - you don't have to supply the 'endofpython' footer from above.
The simplest possible version I've found is
@python -x %~f0 %* & goto :eof # start of python code import sys print "Hello", ', '.join(sys.argv[1:])
This works on Windows 2000 CMD.EXE. Probably also on NT and XP, but I don't have these to test. It's not likely to work on Windows 9x/ME, as the %~f0 and %* constructs aren't supported there. %* can be replaced by %1 %2 %3 %4 %5 %6 %7 %8 %9 as usual, but %~f0 (the full pathname of the current batch file) isn't in COMMAND.COM to my knowledge...
Annoyingly, JP Software's 4NT doesn't correctly support %~f0, failing to include the .bat file extension unless it is typed in on the command line. I've reported this as a bug to JP software.
The advantage of this version is that it *doesn't* need you to hard-code the full pathname of the BAT file.
An alternative construct is %~dp0MYBATCHFILE.BAT. The %~dp0 construct gives the name of the directory containing the batch file. Again, this isn't 9x/ME compatible, to my knowledge. But it does work on all versions of NT/2000 and also in 4NT, FWIW.
Hope this helps, Paul.