Subject: Re: Cygwin/Windows GUI Integration Question, Thank You, Offer & Residual Question
From: LDR <[email-masked]>
To: [email-masked]
Date: Fri, 20 Aug 2004 19:07:57 -0400

Thanks, Igor, without the key words "Cygwin bash here", my
searches were fruitless.

I decided on the following directions (modified to my environment):

I'm running Windows XP professional. (I note my version of
regedt32 is 5.1, and Finney's was 5.0.)

(*Anybody know why "3.", below, didn't quite work and "7." was
necessary? How can I fix "3." to simplify?*)

I'm running Windows XP professional

     *> (Adapted From Greg Finney)
                      ***********

     1.  Copy one of your "Cygwin.bat" startup files to
         'Cygwin_Bash_from_Explorer.bat'. Edit it so that it
         contains the following logic outline.
        
         (I actually have four, of these:
        
         * plain 'bash'
         * 'rxvt'
         * start X Windows & then an 'xterm'
         * 'xterm' alone
        
         I use these for iconic invocation of the resulting
         Cygwin windows.
        
         I decided to start with plain 'bash'. KISS, at least to start.)

         Cygwin_Bash_from_Explorer.bat
         =============================
         @echo off
         C:
         chdir C:\_root
         echo cd '%1 %2 %3 %4 %5 %6 %7 %8 %9' > home/Lee/.Explorer_Dir
         bin\bash.exe --login -i

     2.  profile -- add the line

         . .Explorer_Dir

         to the end of your .profile or .bash_profile in your
         Cygwin home directory
        
         (I only use profile in /etc.) Didn't know I could use
         the more *uxy '.profile'!? I knew that NTFS allowed the file
         name; but I didn't know that Cygwin had made the shift back
         to the GNU/UNIX mothership.)

     3.  Registry Script -- Lee_Cygwin_Bash_from_Explorer.reg

         Create a registry script for an explorer right-click
         option to open a Cygwin window. Enter the following
         lines into a file (adapted from Microsoft Windows XP
         Inside Out), save with a .reg extension. You may need
         to modify the path to cygwin_cmd_here.bat for your
         system.

         Lee_Cygwin_Bash_from_Explorer.reg
         =================================
         Windows Registry Editor Version 5.00
         [HKEY_CLASSES_ROOT\Folder\shell\Cmd Here]
         @="Cygwin &Prompt Here"
         [HKEY_CLASSES_ROOT\Folder\shell\Cmd Here\command]
         @="cmd.exe /k c:\root\Cygwin_Bash_from_Explorer.bat %L"

     4.  Execute Registry Script -- Lee_Cygwin_Bash_from_Explorer.reg

         Double click on the file created in step #3 to add those
         keys to the registry

     5.  'Cygwin Prompt Here'
    
         You should now be done:

         Choosing 'Cygwin Prompt Here'
        
         when right clicking on a folder should launch the batch
         script, creating a command to cd to the folder directory
         that will be executed when your bash login process
         sources your .profile or .bash_profile

     6.  For  some reason the value:
        
         cmd.exe /k c:\root\Cygwin_Bash_from_Explorer.bat %L
        
         was not put into the node:
        
         HKEY_CLASSES_ROOT\Folder\shell\Cmd Here\command
        
         and I had to edit it by hand with MS 'regedt32.exe'.
        
Anybody know why "3." didn't quite work and "6." was necessary?

If there's interest, I'll write all this up as "Integrating
Cygwin and Windoze", and include some comments on, and useful
scripts and macros.

Igor Pechtchanski wrote:

 >On Fri, 20 Aug 2004, LDR wrote:
 >
 >>* How and where to add a node to Windows Registry (XP)
 >>  - that creates a pull-down (right-click or "Tools") menu
 >>  - from a Windows Explorer folder
 >>  - that opens a Cygwin shell window to (makes it the
 >>    working directory), either,
 >>  - the current Explorer directory and/or,
 >>  - the highlighted Explorer directory?
 >
 >
 >Try googling for "cygwin bash here".
 >
 >>* I presume, based on past comments on this list, that the
 >>  changes to the registry should only be made with
 >>  'regedt32.exe'?
 >
 >
 >Or "regtool", or by importing a ".reg" file. :-)
 >
 > Igor
 >P.S. Standard MS disclaimer: Always back up your registry before 
editing it!
 >

--
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/