On Sat, 28 Jun 2003, Brian Dessent wrote: > Soren A wrote: > > > * yeah, am using AS Perl, that's because this is a piece of > > a WSH script. > > * what I'd like to end up with is a way to context|alternate-click > > on any filename in MSWindows Explorer and place the filename as > > *cygwin*, not the OS, will see it, on the clipboard. Anyone > > already had a pass at this wheel? > > I was playing around with this because it seems like a handy idea. > I use Cywin perl, but the differences shouldn't be very great. Anyway, > I came up with the following oneliner that does what you mention above > (passed %1 as a Windows filename, it copies the Cygwin version to the > clipboard) > > c:\cygwin\bin\perl.exe -MWin32::Clipboard -e "my $f=quotemeta('%1'); chomp (my > $c=qx!cygpath -u $f!); Win32::Clipboard($c);" > > If you install the following registry entries, you get a context menu > for files and directories that runs this when selected. You should be > able to save this as a .REG file and click on it to import the entries, > you'd have to change the path to perl though. > > [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\CygPath] > @="&Copy Cygwin Path" > > [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\CygPath\Command] > @="c:\\cygwin\\bin\\perl.exe -MWin32::Clipboard -e \"my $f=quotemeta('%1'); chomp > (my $c=qx!cygpath -u $f!); Win32::Clipboard($c);\"" > > [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPath] > @="&Copy Cygwin path" > > [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPath\command] > @="c:\\cygwin\\bin\\perl.exe -MWin32::Clipboard -e \"my $f=quotemeta('%1'); chomp > (my $c=qx!cygpath -u $f!); Win32::Clipboard($c);\"" > > Brian
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? Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/