Add windows shell contextual menu "Open mintty here"

3,218 views
Skip to first unread message

Olivier Jaquemet

unread,
Feb 17, 2010, 8:59:04 AM2/17/10
to mintty
Hello All,

I would like to add a contextual menu to the Windows Explorer, to open
mintty in the current directory.
Similar to what has already been done here with a simple bash shell :
http://dam.mellis.org/2004/06/open_cygwin_bash_shell_here/

Unfortunately I could not find the documentation regarding mintty
parameters and I have no idea how to specify a directory in which
mintty should start the shell (note that it would be nice to keep the
single dash "-" argument to keep profile/shell preferences while just
overriding the current directory).

Thanks for your help !

Olivier

PS: If there are a documentation regarding mintty parameters, it would
be nice to add it in the google code main page and enable a "usage"
when executing the windows command : ("mintty.exe /help", "mintty -h"
or "mintty --help")

Forrest Humphrey

unread,
Feb 17, 2010, 9:38:18 AM2/17/10
to mintty-...@googlegroups.com
Hi Olivier,

I wonder if the the cygwin package "chere" would come close to meeting your needs.

$ chere -i -t mintty -s bash 

This will add a context menu item "Bash Prompt Here" when right-clicking on a directory. I haven't found a way to activate mintty from an already-open directory, but using chere as described has been sufficient for me.

Regards,
Forrest Humphrey



--
You received this message because you are subscribed to the Google Groups "mintty" group.
To post to this group, send email to mintty-...@googlegroups.com.
To unsubscribe from this group, send email to mintty-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mintty-discuss?hl=en.


Olivier Jaquemet

unread,
Feb 17, 2010, 10:56:45 AM2/17/10
to mintty
Hi Forrest,

Thank you for this suggestion !

I could not get "chere" to work properly on my system (even when using
administrator account) but it gave me the answer to what I was looking
for :
Using the "-p" argument on 'chere' prints the registry keys that would
have been installed by chere/regtool :
--------
$ chere -i -ap -t mintty -e "Open mintty here"
[...]
regtool -e set /HKCR/Directory/Shell/cygwin_bash/command/ "C:\cygwin
\bin\mintty.exe -e /bin/xhere /bin/bash.exe \"%L\""
[...]
--------
As you can see, 'chere' install and uses 'xhere' when invoking the
terminal to launch (in my case mintty).


Thus, here is the registry file to install a contextual menu to open
mintty with the specified directory :
-----------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\mintty]
@="Open mintty Here"

[HKEY_CLASSES_ROOT\Directory\shell\mintty\command]
@="c:\\cygwin\\bin\\mintty.exe -e /bin/xhere /bin/bash.exe \"%L\""

[HKEY_CLASSES_ROOT\Drive\shell\mintty]
@="Open mintty Here"

[HKEY_CLASSES_ROOT\Drive\shell\mintty\command]
@="c:\\cygwin\\bin\\mintty.exe -e /bin/xhere /bin/bash.exe \"%L\""
-----------

Regards,
Olivier

On Feb 17, 3:38 pm, Forrest Humphrey <forrest.humph...@gmail.com>
wrote:


> Hi Olivier,
>
> I wonder if the the cygwin package "chere" would come close to meeting your
> needs.
>
> $ chere -i -t mintty -s bash
>
> This will add a context menu item "Bash Prompt Here" when right-clicking on
> a directory. I haven't found a way to activate mintty from an already-open
> directory, but using chere as described has been sufficient for me.
>
> Regards,
> Forrest Humphrey
>
> On Wed, Feb 17, 2010 at 7:59 AM, Olivier Jaquemet <
>

> olivier.jaque...@gmail.com> wrote:
> > Hello All,
>
> > I would like to add a contextual menu to the Windows Explorer, to open
> > mintty in the current directory.
> > Similar to what has already been done here with a simple bash shell :
> >http://dam.mellis.org/2004/06/open_cygwin_bash_shell_here/
>
> > Unfortunately I could not find the documentation regarding mintty
> > parameters and I have no idea how to specify a directory in which
> > mintty should start the shell (note that it would be nice to keep the
> > single dash "-" argument to keep profile/shell preferences while just
> > overriding the current directory).
>
> > Thanks for your help !
>
> > Olivier
>
> > PS: If there are a documentation regarding mintty parameters, it would
> > be nice to add it in the google code main page and enable a "usage"
> > when executing the windows command : ("mintty.exe /help",  "mintty -h"
> > or "mintty --help")
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mintty" group.
> > To post to this group, send email to mintty-...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > mintty-discus...@googlegroups.com<mintty-discuss%2Bunsu...@googlegroups.com>

Andy Koppe

unread,
Feb 17, 2010, 3:25:15 PM2/17/10
to mintty
Olivier Jaquemet:

> I would like to add a contextual menu to the Windows Explorer, to open
> mintty in the current directory.
> Similar to what has already been done here with a simple bash shell :http://dam.mellis.org/2004/06/open_cygwin_bash_shell_here/

Forrest already pointed you at 'chere'. (The TIPS section of the
mintty manual mentions it too.)

> Unfortunately I could not find the documentation regarding mintty
> parameters

'man mintty', if you've installed mintty via Cygwin's setup.exe.
Otherwise, there's a PDF version of the manual at
http://mintty.googlecode.com/files/mintty-0.5.7.pdf. (I've now added a
paragraph to the homepage to point these out.)

> I have no idea how to specify a directory in which
> mintty should start the shell
> (note that it would be nice to keep the
> single dash "-" argument to keep profile/shell preferences while just
> overriding the current directory).

The default /etc/profile overrides the working directory anyway, but
have a look at it to see how 'chere' works around that.

> PS: If there are a documentation regarding mintty parameters, it would
> be nice to add it in the google code main page and enable a "usage"
> when executing the windows command : ("mintty.exe /help",  "mintty -h"
> or "mintty --help")

-H and --help are both supported (and incidentally the --help output
does appear in the screenshot on the homepage). Unfortunately I just
found that this doesn't work when mintty is invoked from a console
rather than a pty-based terminal such as mintty itself. Issue 163.

Andy

Olivier Jaquemet

unread,
Feb 18, 2010, 3:25:17 AM2/18/10
to mintty
Thank you Andy.
The man pdf is a nice addition to the home page.
Stupid me... mintty is a "Windows" application in my mind and I had
not thought about checking the man page !

To all users : check my reply to Forrest in this thread if you want
more information on how to use chere (or rather "workaround it" when
it does not work...).

Regards,
Olivier

las...@gmail.com

unread,
Jan 25, 2013, 8:42:10 PM1/25/13
to mintty-...@googlegroups.com
If you can stand a cmd window flapping by, the following line opens minty at the specified directory.

cmd /k pushd "[windows-style directory]" & start c:\cygwin\bin\mintty.exe & exit

The regedit command entry would look like this:

cmd /k pushd "%V" & start c:\cygwin\bin\mintty.exe & exit

Thiago Albuquerque

unread,
Jan 30, 2013, 12:36:42 PM1/30/13
to mintty-...@googlegroups.com
There's a cygwin package for this called 'chere'.

$ chere -h
/usr/bin/chere version 1.2

Usage:
/usr/bin/chere -<iuxlrhv> [-lracnmpf12] [-t <term>] [-s <shell>]
        [-d <display> ] [-o <options>] [-e <menutext>]

Adds the stated terminal/shell combination to the folder context menu
This allows you to right click a folder in Windows Explorer and open
a Cygwin shell in that folder.

[...]

  t <term> - Use terminal term. Supported terminals are:
        cmd rxvt mintty xterm urxvt

  s <shell> - Use the named shell. Supported shells are:
        ash bash cmd dash mksh pdksh posh tcsh zsh passwd

[...]

--
You received this message because you are subscribed to the Google Groups "mintty" group.
To post to this group, send email to mintty-...@googlegroups.com.
To unsubscribe from this group, send email to mintty-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/mintty-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages