delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/09/14/10:57:53

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Lewis Hyatt <lhyatt AT princeton DOT edu>
Subject: Re: drag and drop to cygwin scripts ?
Date: Fri, 14 Sep 2007 10:57:29 -0400
Lines: 30
Message-ID: <fce7gf$14m$1@sea.gmane.org>
References: <884389 DOT 22573 DOT qm AT web55503 DOT mail DOT re4 DOT yahoo DOT com>
Mime-Version: 1.0
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
In-Reply-To: <884389.22573.qm@web55503.mail.re4.yahoo.com>
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

Keith Chiem wrote:
> Is it possible to write a script in cygwin, say bash or perl, create a shortcut to it in windows, and drag and drop a path or a url to it and have the script run and take it as an argument somehow ?
> 
> --k
> 
> 
> 

If you drag and drop files onto a batch script, Windows will run the 
batch script with the files as arguments. So you just need to write a 
batch script which will load bash and tell it to run your script with 
those arguments. As an example, you can edit your cygwin.bat, and change 
this line:

bash --login -i

to this:

bash -i -e /script/you/want/to/run.bash %*

And that will do what you want. Keep in mind that the file names will be 
in the Windows path format, so you will probably want to use a wrapper 
script that applies cygpath to them before passing them on to something 
else.

If you want the script to run inside an xterm or whatever, you can do 
that too.

-Lewis



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