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/