http://qs321.pair.com?node_id=140481


in reply to win32 perl script when you don't know where perl is

On Win32, "both" (that is, IndigoPerl and ActiveState Perl) Perl distributions install themselves in the path during the setup, and both come with the perl2bat.bat batch file, that (tries to) convert(s) any Perl program to a batch file.

The bootstrap code looks like this :

@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. goto endofperl @rem '; #!perl #line 14 eval 'exec perl -x -S "$0" ${1+"$@"}' if 0; # In case running under some shell require 5; ... Perl program begins ...

You could either simply use this, as any installed Perl is supposedly also in the path, or you could start from there with something crude like :

set DRIVES=c d e f g h echo Scanning for perl.exe for %%d in %DRIVES% dir %%d:\ /s /b perl.exe |find /i "Perl.exe"
and then let the user choose the version of Perl she wants to use. Note that people (or at least I) can have multiple versions of Perl installed, but most versions of Perl should be at least Perl 5 - so if your install script is self-reliant, you should be in the green.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web