This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: example needed pls: `cygpath -c <HANDLE>'

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:


@="&Copy Cygwin Path"

@="c:\\cygwin\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboard\""

@="&Copy Cygwin path"

@="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.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]