perl in Windows: using the "Send To" folder and perl

Discussion in 'Perl Misc' started by Adam S, Sep 23, 2004.

  1. Adam S

    Adam S Guest

    Hi,

    with a few thousand lines worth of Perl programmnig in a Unix
    environment behind me I want to create an application in Windows where
    I can mark several files and then right-click and do a "Send To" to a
    perl application.

    When using the "Send To" right-click menu item, all the files I've
    marked are supplied on the command line to the executable i.e.

    myexecutable file1.txt file2.txt ... fileN.txt

    I create my executable by writing a .bat file which in turn supplies
    the input argument with a

    eval "perl myperlscript.pl @ARGS" statement.

    My first version of myperlscript.pl only printed all the file names
    supplied to to stdout just to check how many files I can do.

    That's where the problem arises, somewhere along the line it only
    manages about 5 files (the path names are rather long, about 50
    characters.

    Somewhere the command line gets very short, I don't exactly know
    where, if itäs the .bat command line that's too short or the perl
    command line.

    Other "proper" applications, such as gVim, don't seem to have a
    problem with 50 similar file names being supplied.

    If the solution is to create a perlscript.exe, how do I do that so I
    can get rid of the .bat file to launch the perl interpreter? In a Unix
    environment I would just add a #!/usr/bin/perl and the script itself
    would be an executable, but how do I do it in Windows without
    involving a .bat file? Or is there an entirely different solution
    where I can do a #! like addition to my script?

    Thankful for any help.

    Best Regards,
    Adam
     
    Adam S, Sep 23, 2004
    #1
    1. Advertising

  2. (Adam S) wrote in
    news::

    > with a few thousand lines worth of Perl programmnig in a Unix
    > environment behind me I want to create an application in Windows where
    > I can mark several files and then right-click and do a "Send To" to a
    > perl application.


    Well, this is not strictly a Perl question but ...

    > When using the "Send To" right-click menu item, all the files I've
    > marked are supplied on the command line to the executable i.e.
    >
    > myexecutable file1.txt file2.txt ... fileN.txt
    >
    > I create my executable by writing a .bat file which in turn supplies
    > the input argument with a
    >
    > eval "perl myperlscript.pl @ARGS" statement.
    >
    > My first version of myperlscript.pl only printed all the file names
    > supplied to to stdout just to check how many files I can do.
    >
    > That's where the problem arises, somewhere along the line it only
    > manages about 5 files (the path names are rather long, about 50
    > characters.
    >
    > Somewhere the command line gets very short, I don't exactly know
    > where, if itäs the .bat command line that's too short or the perl
    > command line.


    You do not mention which Windows command shell you are using. command.com
    has always been hampered by very short line lengths (numbers like 127 and
    255 come to mind). AFAIK, cmd.exe in XP is better but I don't know how much
    better.

    > Other "proper" applications, such as gVim, don't seem to have a
    > problem with 50 similar file names being supplied.
    >
    > If the solution is to create a perlscript.exe, how do I do that so I
    > can get rid of the .bat file to launch the perl interpreter? In a Unix
    > environment I would just add a #!/usr/bin/perl and the script itself
    > would be an executable, but how do I do it in Windows without
    > involving a .bat file? Or is there an entirely different solution
    > where I can do a #! like addition to my script?


    Untested: A solution that might work regardless of the version of Windows
    you are using is to create a shortcut to wperl.exe and specify the script
    name and command line parameters via that shortcut.

    Hope this helps.

    Sinan.
     
    A. Sinan Unur, Sep 23, 2004
    #2
    1. Advertising

  3. Adam S

    Ben Morrow Guest

    Quoth (Adam S):
    > Hi,
    >
    > with a few thousand lines worth of Perl programmnig in a Unix
    > environment behind me I want to create an application in Windows where
    > I can mark several files and then right-click and do a "Send To" to a
    > perl application.
    >
    > When using the "Send To" right-click menu item, all the files I've
    > marked are supplied on the command line to the executable i.e.
    >
    > myexecutable file1.txt file2.txt ... fileN.txt
    >
    > I create my executable by writing a .bat file which in turn supplies
    > the input argument with a
    >
    > eval "perl myperlscript.pl @ARGS" statement.
    >
    > My first version of myperlscript.pl only printed all the file names
    > supplied to to stdout just to check how many files I can do.
    >
    > That's where the problem arises, somewhere along the line it only
    > manages about 5 files (the path names are rather long, about 50
    > characters.
    >
    > Somewhere the command line gets very short, I don't exactly know
    > where, if itäs the .bat command line that's too short or the perl
    > command line.


    My guess would be it's command.com truncating the command line.

    > If the solution is to create a perlscript.exe, how do I do that so I
    > can get rid of the .bat file to launch the perl interpreter? In a Unix
    > environment I would just add a #!/usr/bin/perl and the script itself
    > would be an executable, but how do I do it in Windows without
    > involving a .bat file? Or is there an entirely different solution
    > where I can do a #! like addition to my script?


    You can use pp (install PAR.pm).

    Alternatively, have you tried putting a shortcut to
    c:\path\to\perl c:\path\to\script.pl
    in send to instead?

    Ben

    --
    Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
    From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
    (Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
    /Alcestis/) [ flame, and falls out of sight. ]
     
    Ben Morrow, Sep 23, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. THY
    Replies:
    3
    Views:
    2,932
    Alvin Bruney
    Oct 16, 2003
  2. William LaMartin

    _vti_cnf folder in the bin folder-- a problem?

    William LaMartin, Nov 10, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,698
    Oliver
    Nov 10, 2003
  3. Dan
    Replies:
    7
    Views:
    18,559
    catherine sea
    Oct 28, 2010
  4. Jon Maz
    Replies:
    12
    Views:
    4,773
    Vadim Chekan
    Jul 1, 2004
  5. Jochen Brenzlinger
    Replies:
    5
    Views:
    926
    Roedy Green
    Sep 2, 2011
Loading...

Share This Page