C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawrry\perl\bin; #### @echo off setlocal ENABLEDELAYEDEXPANSION set PLPERL=strawberry set PLROOT=%SystemDrive%\!PLPERL! set PLUSER=%USERPROFILE%\perl set PLSTOR=%ProgramFiles%\!PLPERL! REM set PLSTOR=%SystemDrive% REM REM Help REM if {%1}=={/?} goto HELP if {%1}=={--help} goto HELP REM REM Check args REM if not {%2}=={} goto ERROR REM ------------------------------------------------------- perl -v 2>nul>nul if ERRORLEVEL 9009 goto ERROR_INSTALL :NORMAL if {%1}=={} ( dir /al !PLROOT!* 2>nul | find "JUNCTION" > nul if ERRORLEVEL 1 goto INSTALL for /f "tokens=5,*" %%i in ('dir /al !PLROOT!* ^| find "JUNCTION"') do @echo !PLROOT! %%j for /f "tokens=5,*" %%i in ('dir /al !PLUSER!* ^| find "JUNCTION"') do @echo !PLUSER! %%j echo. perl -e "print \"$] \@ $^^X\n\"" echo. echo Available: for /f "tokens=1,* delims=_" %%i in ('dir /b "!PLSTOR!\!PLPERL!_*"') do @if exist "!PLSTOR!\!PLPERL!_%%j\perl\bin\perl.exe" echo %%j ) else ( if exist "!PLSTOR!\!PLPERL!_%1\perl\bin\perl.exe" ( if exist !PLROOT! rmdir !PLROOT! mklink /j !PLROOT! "!PLSTOR!\!PLPERL!_%1" if not exist %userprofile%\perl5\%1 ( mkdir %userprofile%\perl5\%1 ) rmdir !PLUSER! mklink /j !PLUSER! !userprofile!\perl5\%1 echo. perl -e "print \"$] \@ $^^X\n\"" ) else goto ERROR ) goto END :INSTALL echo Installing... pause if not exist %PLROOT% goto ERROR_NOTFOUND for /f %%i in ('perl -MConfig -e "print \"$Config{version}-$Config{archname}\""') do set PERLJUNCDIR=%%i if not exist "%PLSTOR%" mkdir "%PLSTOR%" move %PLROOT% "%PLSTOR%\%PLPERL%_%PERLJUNCDIR%" call :NORMAL %PERLJUNCDIR% goto END REM ------------------------------------------------------- :ERROR echo %0: Parameter format not correct goto END :ERROR_INSTALL echo %0: Perl not installed goto END :ERROR_NOTFOUND echo %0: Perl not found goto END :HELP echo. echo %0 manages different versions of Perl. echo. echo USAGE: echo. echo %0 ^ echo. echo Where ^ is one of the following: echo. for /f "tokens=1,* delims=_" %%i in ('dir /b "!PLSTOR!\!PLPERL!_*"') do @if exist "!PLSTOR!\!PLPERL!_%%j\perl\bin\perl.exe" echo %%j echo. :END