This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Executing a perl script from Windows 7
- From: Andrey Repin <anrdaemon at yandex dot ru>
- To: Peter Holsberg <pjh42 at pobox dot com>, cygwin at cygwin dot com
- Date: Mon, 10 Mar 2014 01:46:06 +0400
- Subject: Re: Executing a perl script from Windows 7
- Authentication-results: sourceware.org; auth=none
- References: <531CAE25 dot 2060705 at pobox dot com> <531CB088 dot 7070608 at gmail dot com> <531CBF6C dot 6020305 at pobox dot com>
- Reply-to: cygwin at cygwin dot com
Greetings, Peter Holsberg!
>>> I have a perl script that I would like to execute simply by
>>> double-clicking on its name from a Windows filemanager window. (That
>>> is, I do not want to use the command line at all, nor do I want to use
>>> an icon.)
>>>
>>> Eg, myscript.pl
>>>
>>> I tried using this
>>>
>>> #!C:\cygwin64\bin\perl.exe
>>
>> Windows does not pay attention to file contents (like the first line in
>> your example), only the file name. If you don't want a file
>> association, you can opt to simply create a shortcut to your script that
>> begins with the python executable and that lists the script as a parameter.
> A file association to what, .pl to perl.exe?
To a shell script like
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
#!/bin/sh
test -z "$1" && exit 1
env "$( cygpath -au "$1")" "${@:2}"
---->8-------->8-------->8-------->8-------->8-------->8-------->8----
Then just link all extensions you want to exec through cygwin to this file
type.
I.e.
> ftype unixshell.script
unixshell.script="C:\Programs\Cygwin\bin\env.exe" /bin/cygwrap.sh "%1" %*
> assoc .sh
.sh=unixshell.script
> Well, a shortcut would be a desktop icon, wouldn't it?
Depends. There's a way to make it through "Send to" menu. Then you could even
run scripts without extension.
> Why did you mention python?
It's irrelevant.
--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 10.03.2014, <01:41>
Sorry for my terrible english...
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple