4

For example perl C:\Projects\trunk\PcApps\BaseCamp\Test\smoketest.pl C:\Projects\trunk\PcApps\BaseCamp\Test\log.txt

Without the perl.

1

3 Answers 3

6

Assign the .pl extension to the perl interpreter. It depends on your Windows version how you do that.

Depending on the perl installer you are using it might also provide you with an option to do so automatically.

Sign up to request clarification or add additional context in comments.

1 Comment

You only need start when you want it in a separate shell.
2

You can put this at the top of your perl script's file:

@SETLOCAL ENABLEEXTENSIONS
@c:\strawberry-perl-port\perl\bin\perl.exe -x "%~f0" %*
@exit /b %ERRORLEVEL%

#!perl

....perl program goes here...

You'll also need to change the extension of your script so that it's .cmd instead of .pl. The above trick runs the strawberry perl interpreter, calling it with the -x switch followed by "%~f0". This is the path to the .cmd script. The .cmd script will then exit once your perl program is complete.

The bit below the #!perl line is your actual perl program, which the perl.exe knows to skip to when this line runs:

@c:\strawberry-perl-port\perl\bin\perl.exe -x "path\to\my\perl.cmd" %*

Comments

0

There are a few programs that can convert your .pl file to .exe format:

After conversion, you may still need perl installed on your system, but the exe file finds the perl interpreter by itself. (Disclaimer: I did not try any of these)

2 Comments

This is probably overkill if you're running them on a machine with Perl already installed. There's also PAR::Packer.
pl2bat would be a more reliable approach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.