chere(1)

NAME
chere - manage Shell Here context menu items

SYNOPSIS
chere -<iuxlrhv> [-lracnmpf12] [-t term] [-s shell] [-d display] [-o options] [-e menutext]

DESCRIPTION
chere adds the term / shell combination to the folder context menu. This allows you to right click a folder in Windows Explorer and open shell in that folder.

Where possible, a login shell will be started. i.e. login scripts ( /etc/profile, ~/profile, ~/.bash_profile, ~/.bash_login, /etc/csh.login, /etc/zprofile, $ZDOTDIR/.zprofile /etc/zlogin $ZDOTDIR/.zlogin ) are run as appropriate for the shell. This does not apply to cmd, which does not have any login scripts.

The title of the window is not set. It will default to whatever the terminal sets it to. This can usually be controlled from the shell by passing an escape sequence to the shell.

OPTIONS

-i  Install

-u  Uninstall

-x  Refresh eXisting context menu items

-l  List currently installed Shell Here

-r  Read all chere registry entries to stdout

-a  Operation affects all users

-c  Operation affects current user only

-n  Be Nice and provide Control Panel uninstall option (Default)

-m  Minimal, no Control Panel uninstall

-p  Print regtool commands to stdout rather than running them

-f  Force write (overwrite existing, ignore missing files)

-1  Start shell using registry one-liners. This doesn't work with ash, tcsh or network shares.

-2  Start via bash script. Relies on windows to change directory, and login scripts avoiding doing a cd $HOME

-d display
    Specifies the display to use if xterm or urxvt is specified as the shell. Defaults to :0. If set to env, then the environment variable DISPLAY is read when the context menu item is selected.

-o options
    Add options to the terminal startup command. If more than one option is specified, they should all be contained within a single set of quotes.

-e menutext
    Use menutext as the context menu text.

-h  Help

-v  Version

Supported terminals: cmd rxvt mintty xterm urxvt

Supported shells: ash bash cmd dash fish mksh pdksh posh tcsh zsh passwd

USAGE

A command ( -iuxlrhv ) must be specified before chere does anything. All other options modify how these commands work.

The -i (install) and -u (uninstall) commands are mutually exclusive. The -l and -r commands may be specified in addition to -i , -u or -x , in which case the read/list is done after the install/uninstall/refresh.

The context menu may be (un)installed for all users -a , or just yourself -c. To (un)install for all users, you will require appropriate access rights. i.e. you need to have Administrator rights.

If the -i flag is passed without specifying a shell, the login shell specified for the current user is added. If term is not specified, cmd is used.

If the -u flag is passed without specifying a shell, all installed context menus will be uninstalled. If -a or -c is also specified, only the context menus for the specified users are uninstalled. Otherwise the context menus are removed for all users and the current user.

It is not possible to uninstall a context menu for a user who is not the current user.

When passwd is specified as the shell, chere tries to determine your preferred shell at runtime from either the users /etc/passwd entry, the loginShell Active Directory attribute, or the comment field of the local Security Account Manage (SAM). See cygwin documentation for more details. The passwd option is most useful on multi-user systems.

By default, registry entries are added so that the context menus can be removed using the Add Remove Programs utility in the Windows Control Panel. The -m option prevents this. Note that this uninstall option invokes chere. When installing for the current user, chere will attempt to set an uninstall entry. If the user does not have appropriate rights to add keys to the HKLM hive, then the uninstall will not be present. Using -m will avoid the error message.

The -1 and -2 options select how shell is started. The original method ( -1 ) of registry one-liners is succint, but does not work on network shares or with ash and tcsh. Nor will it cope with paths containing apostrophes. It also results in an extra sh process when the passwd shell is used. These issues should not be present when invoked via xhere ( -2 ). xhere requires your login script to check the environment variable CHERE_INVOKING , and avoid changing to your HOME directory if it is present. The login script should unset the variable after it sees it, so that subsequent child logins are unaffected. When using -e you can specify a keyboard shortcut for the context menu by prefixing the appropriate letter in the text with an ampersand (&). Freshening ( -x ) updates all currently installed context menu items. However, it does not preserve custom user arguments and menu entry text. If you have previously specified these with -o or -e, do not use it. Freshening does support the use of -o in the same invocation. It will abort if you attempt to specify the menu text entry with -e.

DEBUGGING
Several options are present to aid debugging.

The -p option will print the regtool commands to stdout for inspection instead of executing them.

The -l command lists the currently installed shell here context menus.

The -r command lists the commands currently in the registry associated with all possible context menus.

The -f option forces chere to overwrite existing commands even if shell can't be found

EXAMPLES

    ./chere -il -t rxvt -s tcsh

Install tcsh, for all users using rxvt as the terminal, then list what is installed.

KNOWN BUGS
If you have an old or custom startup script, the shell may not enter the desired directory. The login script modifications described above are provided in the default startup scripts; the cygwin setup program attempts to merge updates in these scripts to your local login scripts, but this may not work. The default startup scripts can be found at:

/etc/defaults/etc/profile (provided by base-files, used by ash, bash and pdksh)

/usr/share/doc/zsh-x.x.x/StartupFiles/zprofile (provided by zsh)

/usr/share/doc/tcsh/... (not currently provided)

HINTS
If you are using cmd as a terminal because you don't want to install X consider using mintty or rxvt instead.

If you really do like cmd you can still use it as a shell in mintty or xterm.

Use ~/.Xdefaults to set terminal resources (colour, font etc). This even works for rxvt in non-X11 mode.

You can use -o to set the terminals -name option, -e to distinguish the context menu entries, and specify separate terminal resources for each of the context menu entries in ~/.Xdefaults.

http://biocycle.atmos.colostate.edu/~johnk/Xterm-Title.html has information on setting up Dynamic titles from various shells

ENVIRONMENT
CHERE_INVOKING DISPLAY

FILES
/etc/passwd /bin/xhere /etc/profile ~/profile ~/.bash_profile ~/.bash_login /etc/csh.login /etc/zprofile $ZDOTDIR/.zprofile /etc/zlogin $ZDOTDIR/.zlogin

AUTHOR
Written by Dave Kilroy <kilroyd@gmail.com>

REPORTING BUGS
Report bugs to <cygwin@cygwin.com>, following the directions in http://cygwin.com/problems.html. Also attach verbatim output of the command chere -r

COPYRIGHT
This script is in the public domain.

SEE ALSO
ash bash dash fish mksh pdksh posh tcsh zsh mintty rxvt urxvt xterm regtool