Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Sat, 28 Jun 2003 22:45:26 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Brian Dessent cc: Soren A , Subject: Re: example needed pls: `cygpath -c ' In-Reply-To: <3EFE120B.58A0C79E@dessent.net> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,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/