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

From: A. Sinan Unur (1usa_at_llenroc.ude.invalid)
Date: 09/23/04


Date: 23 Sep 2004 12:45:50 GMT

adam_at_vnl@postmaster.co.uk (Adam S) wrote in
news:c9164b54.0409230247.18ac7dc9@posting.google.com:

> 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.



Relevant Pages

  • Thanks for the comments Jan. 25, 2006
    ... "shadow" operating system which is running behind Windows. ... Perl can then collect data from that program and do ... that by sending longer strings etc. to the Windows clipboard and then having ... SendKeysuse a Ctrl V command to paste the information to the text editor ...
    (comp.lang.perl.misc)
  • Re: executing from command line
    ... if fact it's a way to run a command remotely. ... >> I have a perl script that i would like to run it on a windows server. ... >opening up a security hole on the remote machine when you do this. ...
    (comp.lang.perl.misc)
  • Re: How do I...
    ... file that contained the command worked. ... I copied the BAT file into my Startup folder. ... Windows XP is really Windows NT 5.1. ... > AUTOEXEC.BAT is not used to initialize the MS-DOS environment. ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: proper syntax for command
    ... plz suggest on how to correctly format the command so that perl can execute that command ... I'm guessing that the main problem is the Windows shell's awkward ... it seems to only escape certain special characters. ...
    (perl.beginners)
  • Re: 500 Cant connect to search.cpan.org:80 (Bad protocol tcp) at web.plline 24.
    ... :>I beg to differ... ... be interpreted as an internal Perl command or a shell one). ... : of Windows APIs capabilities. ...
    (comp.lang.perl.misc)