Mail Archives: cygwin/2003/06/28/18:09:36
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
--
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 -