Running a script as if it were a Windows executable?

Discussion in 'Perl Misc' started by Alek Trishan, Mar 9, 2014.

  1. Alek Trishan

    Alek Trishan Guest

    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.
     
    Alek Trishan, Mar 9, 2014
    #1
    1. Advertisements

  2. Alek Trishan

    John Bokma Guest

    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.
     
    John Bokma, Mar 9, 2014
    #2
    1. Advertisements

  3. Alek Trishan

    Alek Trishan Guest

    Brilliant!!! Thanks so much. :)
     
    Alek Trishan, Mar 9, 2014
    #3
  4. Alek Trishan

    Scott Bryce Guest

    Windows still supports batch files, does it not?
     
    Scott Bryce, Mar 10, 2014
    #4
  5. Alek Trishan

    Alek Trishan Guest

    Yes, it does.

    However, associating .pl with perl.exe means that I do not need a batch
    file as a workaround.
     
    Alek Trishan, Mar 10, 2014
    #5
  6. 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)
     
    Brian Helterline, Mar 12, 2014
    #6
  7. Στις 10/3/2014 19:00, ο/η Alek Trishan έγÏαψε:


    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 !
     
    George Mpouras, Mar 12, 2014
    #7
  8. Hi!

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

    Cheers,
    Tomasz

    Użytkownik Alek Trishan napisał:
     
    Tomasz Konojacki, Mar 19, 2014
    #8
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.