delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/03/09/17:50:26

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=d2znnfEGRFOPTgKR
jex7d/Yzf8MHR4yTVRg5RvvE1dP+167ZskipHgTKUW5i05Rc2/wdytPNRoMuuI6j
udXnXexGrxGgj/aQeKSNOLAPk0irPril9ZNHg4Sl68eFmnfdGbyj3llLy19KTuwG
BCWrrxeQ3INCOBs1tSBD5RJbdlw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=JPHEZKys5Y8oR3BKqgKftC
n3OdY=; b=GeTyIGQfnxGaP78jerlWkzjyouw8GbEXRgk+7k/aFAI6PrK5TU8O49
/xG9cl06+7a3L6GF1FDYrlDpIbHPdTxbBrCQUspGjNduUJPTvjEqANgldjEFixsj
FZroM24O0Qr5/nfPRhTClRHjTwlqDtEkTdU/Bqy90ooEdkMYXkpdY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtpback.ht-systems.ru
Date: Mon, 10 Mar 2014 01:46:06 +0400
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <1146131234.20140310014606@yandex.ru>
To: Peter Holsberg <pjh42 AT pobox DOT com>, cygwin AT cygwin DOT com
Subject: Re: Executing a perl script from Windows 7
In-Reply-To: <531CBF6C.6020305@pobox.com>
References: <531CAE25 DOT 2060705 AT pobox DOT com> <531CB088 DOT 7070608 AT gmail DOT com> <531CBF6C DOT 6020305 AT pobox DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

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 AT yandex DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019