delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/29/16:47:26

X-Spam-Check-By: sourceware.org
Date: Wed, 29 Aug 2007 13:47:03 -0700
From: Gary Johnson <garyjohn AT spk DOT agilent DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: How do I make scripts my PC executable
Message-ID: <20070829204703.GC16267@suncomp1.spk.agilent.com>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <12391292 DOT post AT talk DOT nabble DOT com> <003101c7ea5f$231bb6c0$2e08a8c0 AT CAM DOT ARTIMI DOT COM>
MIME-Version: 1.0
In-Reply-To: <003101c7ea5f$231bb6c0$2e08a8c0@CAM.ARTIMI.COM>
User-Agent: Mutt/1.5.16 (2007-06-09)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 2007-08-29, Dave Korn wrote:
> On 29 August 2007 17:59, zip184 wrote:
> 
> > I have some scripts I'd like to run without starting cygwin and typing in
> > their paths.  Is there a way to make windows recognize that a file is a
> > bash/python script and run them like as if I ran them in cygwin?  I'd like
> > to just be able to doubleclick them in windows explorer.  Is this possible?
> > (I'm using bash and python scripts)
> 
>   Windoze doesn't understand about shebangs (the #! line at the start of the
> script), and bases all its decisions on the filename extension.  So, if you
> name your scripts according to the pattern '*.sh', and make sure to chmod a+x
> them, you can double-click in explorer.
> 
>   The first time you do that, windows will complain it doesn't know what to do
> with a sh file, and offer you the choice of looking up on the web or selecting
> from a list which program you want to open .sh files with; choose the
> select-from-a-list option, when the list appears click the browse button, find
> your way to cygwin\bin\bash.exe and select that.  Make sure "Always use this
> program" is ticked, enter a nice descriptive name such as "Bash script" in the
> description box, OK it and away you go!

That won't run the script in the same environment that it would get 
when run from a Cygwin login shell, though, will it?  I would think 
the program might have to be a .bat file that contains something 
like this (untested):

   C:\cygwin\bin\bash.exe --login -c %1

Regards,
Gary

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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