Running a script as if it were a Windows executable?

A

Alek Trishan

I have a perl script that I can run by opening a command window and typing
perl.exe myscript.pl

I would like to create an "executable" file (but not a desktop shortcut)
that, when clicked on, would execute that command.

Can anyone help?

Thanks.
 
J

John Bokma

Alek Trishan said:
I have a perl script that I can run by opening a command window and typing
perl.exe myscript.pl

I would like to create an "executable" file (but not a desktop
shortcut) that, when clicked on, would execute that command.

Can anyone help?

PAR::packer has the pp tool which packs perl (the exe) and your script
and modules into a single exe file. This file you can also copy to a
different computer and run. Since it includes perl the resulting exe is
quite large (over 1 MB).

No idea if there's something better, but I've used pp for years and most
of the time it just works.
 
A

Alek Trishan

Very easy. You just need to associate the file type *.pl with your Perl
interpreter. Normally the Setup process for your Perl system will do
that automatically.
But if the association is broken, then right-click on a *.pl file,
select "Open With" and re-create the association to the Perl
interpreter.

Brilliant!!! Thanks so much. :)
 
S

Scott Bryce

I have a perl script that I can run by opening a command window and
typing perl.exe myscript.pl

I would like to create an "executable" file (but not a desktop
shortcut) that, when clicked on, would execute that command.

Windows still supports batch files, does it not?
 
A

Alek Trishan

Windows still supports batch files, does it not?

Yes, it does.

However, associating .pl with perl.exe means that I do not need a batch
file as a workaround.
 
B

Brian Helterline

And if your script doesn't require the cmd window, you can associate it
with wperl.exe (same version of perl but doesn't show the cmd window).
I believe ActivePerl associates .plw files with this by default.
Handy for scripts that just run in the background or scripts that
use Tk (or similar)
 
G

George Mpouras

Στις 10/3/2014 19:00, ο/η Alek Trishan έγÏαψε:
Yes, it does.

However, associating .pl with perl.exe means that I do not need a batch
file as a workaround.



In case you did not know, if you add the .PL to your %PATHEXT% system
environment e.g.

echo %PATHEXT%

.COM;.EXE;.BAT;.CMD;.VBS;.PL


you can run your "program.pl" by simple issuing program without the
extension !
 
T

Tomasz Konojacki

Hi!

There is simple tool included with both ActivePerl and Strawberry Perl,
it's called pl2bat.

Cheers,
Tomasz

Użytkownik Alek Trishan napisał:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top