This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Executing a perl script from Windows 7

Peter Holsberg wrote:

I have a perl script that I would like to execute simply by double-clicking on its name from a Windows filemanager window.
I tried using this:

as the first line in the script but when I double-click the script, Windows opens it in a text editor. (I suppose I have .pl associated with that editor!)
Sorry for late reply, you probably already have this solved.
But if you wanted to do it through Explorer...

A simple way... but it won't open in your text editor anymore,

Open Explorer and goto a directory with a .pl extension in it.

hover over it so it is selected (but you don't want to open it).
(I say "over", as I have "single-click to open", like links, and hover

then at the top of the Explorer window below the
optional address and command bars, you should see a line
that has things like:
Organize   Open â    Print   E-mail   Burn   New folder

Click on the triangle by open it should give you a choice menu.

Goto Choose default program... (bottom line).

For you, it looks like you have cygwin in cygwin64, so
in there you can *Browse*, for perl.exe, or just type in
its path (on your system looks like it should be):

If you always want to open .pl files with perl, check the
box to "always open this type of file with this program.

then .. OK.

If your program doesn't call any other programs, you are done.

If it does -- you need to make sure your cygwin paths,
especially "C:\cygwin64\bin" are in your PATH var in Windows,
at least your User ENV vars...

(Control Panel ->
  System ->
   System Properties, Advanced tab, @ bottom under Environment vars);

Best to try it under user vars first (if you really mess up, you can
signing as another user and correct it, but if you mess up the system
path, your system may not even boot correctly, if at all).

Either append or prepend your cygwin64 bin path to it
and use ";" (semi-colon) as a separator (no spaces).

Personal hint -
  When I have lots of stuff in a path, I find it easier to
  go into the edit box, use Control-A (select all), and
  ontrol-C to copy the text and open a text editor (gvim).

  There I use the command (: is the colon prompt in vi)

  to get ^M -- press control-V, control-M...
  That will put each path on a separate line.

  When I'm done, I do the opposite: (% means 'all lines')

Sometimes you need to delete an extra ';' off the end...after
you do the above because vim will often insert an extra
'end of line' at the end of the file.

I.e. the end of the path should probably not end with a ';', but
it probably won't hurt if it is there (I'd have to test to see).

Except for the PATH part, the "opening" part is done in explorer...
Once you have cygwin in your PATH, you can add other programs
the same way like mapping ".sh" -> C:\cygwin64\bin\bash.exe"

.sh -> C:\cygwin64\bin\bash  for example.

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]