delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/01/09:06:23

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <3F018740.B28F53DC@dessent.net>
Date: Tue, 01 Jul 2003 06:06:08 -0700
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
X-Accept-Language: en,en-US
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: example needed pls: `cygpath -c <HANDLE>'
References: <3EFE120B DOT 58A0C79E AT dessent DOT net> <Pine DOT GSO DOT 4 DOT 44 DOT 0306282234360 DOT 22307-100000 AT slinky DOT cs DOT nyu DOT edu> <20030701040434 DOT GE7604 AT ny-kenton2a-710 DOT buf DOT adelphia DOT net>

Soren Andersen wrote:
> 
> On Sat, Jun 28, 2003 at 10:45:26PM -0400, Igor Pechtchanski wrote:
> > Umm, guys, aren't we getting carried away here?  I mean, perl is a great
> > tool, but wouldn't something simpler, like
> 
> > c:\cygwin\bin\bash -c "echo -n `/bin/cygpath -u '%1'` > /dev/clipboard"
> 
> > suffice?
> 
> If that command string could somehow be made to be the action that takes
> place when the user "right/context/alternate-clicks" on a filename in
> Win Explorer, then yes, it would address the need. Do you know how?

The right-click context menu part is easy, it's just some registry 
entries for two classes, one corresponding to a directory the other 
to "anyfile".

This will work fine since it's invoking bash, which is of course linked
against Cygwin1.dll, so it will have access to /dev/clipboard.  It's no
different that opening up a shell prompt and running the command.

Save this as a text file ending in .txt and then open it:

-----
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\CygPath]
@="&Copy Cygwin Path"

[HKEY_CLASSES_ROOT\Directory\shell\CygPath\Command]
@="c:\\cygwin\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboard\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPath]
@="&Copy Cygwin path"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPath\command]
@="c:\\cygwin\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboard\""
-----

Replace your cygwin path as appropriate.  Use "%1" instead of "%l" to 
get the short-filename version.  As written above, you'll get values 
such as "/cygdrive/c/Program Files/Microsoft Visual Studio" copied to 
the clipboard, the space might be problematic.  With "%1" you get 
something like "/cygdrive/c/PROGRA~1/MIAF9D~1".

There's also the mildly annoying thing of a quick console window opening
and then closing, but I think someone posted a link to a another program
you can use to start something without that.

Brian

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