in reply to setting environment-variables

Another option would be to store the perl script in an environment variable and call it later:

REM MYVAR.BAT SET MYVAR=perl -we "print 'foobar'" CALL %MYVAR% PAUSE