[Distutils] small improvement of the script functionality under win32

Phillip J. Eby pje at telecommunity.com
Mon Apr 4 20:53:04 CEST 2005


At 11:26 AM 4/4/05 -0700, Trent Mick wrote:
>[Phillip J. Eby wrote]
> > At 08:14 AM 4/3/05 +0200, Vivian De Smedt wrote:
> > >Could you confirm me that the %* isn't working on win95/win98 ?
> >
> > test.bat:
> > @echo off
> > echo %*
> >
> > Running 'test test' Outputs an '*', not any arguments.  So no, it doesn't
> > work.
>
>Here is what the Perl world does with there perl2bat conversion:
>
>     @rem = '--*-Perl-*--
>     @echo off
>     if "%OS%" == "Windows_NT" goto WinNT
>     perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
>     goto endofperl
>     :WinNT
>     perl -x -S %0 %*
>     if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
>     if %errorlevel% == 9009 echo You do not have Perl in your PATH.
>     if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
>     goto endofperl
>     @rem ';


Hm.  You know, with 'python -x' you could render the above as something like:

@echo off
rem = """
pathtopython -x scriptfilenamehere %0 %1 ...
goto finished
"""

[program code goes here]

"""
:finished
rem """


Unfortunately, you have to embed the actual filename because Python doesn't 
have an equivalent to Perl's -S.  Anyway, this isn't really a workable 
solution; I think creating a separate .bat file is still the best way to go.



More information about the Distutils-SIG mailing list