简单问题,关于windows下的perl脚本文件的格式!up有分。
疯癫行者 2004-02-22 12:04:38 有下列脚本,windows下的,是一个.bat文件。
问题是:windows的批处理文件包含了perl脚本,其中批处理部分调用了如下代码:
ActivePerl\Perl\bin\perl -x -S "%0"
%0是指但前的.bat文件,意思是说让perl执行这个批处理脚本文件,但是perl如何才能知道哪些是windows的批处理,哪些是要执行的perl脚本呢?
"......"代表省略的代码。
希望各位高手能给个确定的答案!不确定的可不要写上来呀!up有分。
@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
ActivePerl\Perl\bin\perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
ActivePerl\Perl\bin\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 ';
#!ActivePerl/Perl/bin/perl -w
#line 15
#
......
# The path we will be replacing
my $replace = q[C:\p4view\Apps\Gecko\MSI\data\ActivePerl\Perl];
# The ActivePerl version we are installing
my $APVersion = Win32::BuildNumber();
......