How to add a Shell Here context menu to Explorer


Powertoys provides a very useful "Command prompt here" option for Explorer, and I got fed up with selecting this and then typing sh.  Here is how you can avoid doing the same and provide yourself with a useful shortcut.

1) Add these lines to your environ.ksh or equivalent.

if [ ! -z $StartupDir ]
then
        cd $StartupDir
fi

2) Add the following registry keys.

[HKEY_CLASSES_ROOT\Directory\shell\Sh]
@="&Shell Prompt"

[HKEY_CLASSES_ROOT\Directory\shell\Sh\command]
@="sh -c \"export StartupDir='%1'; sh -L\""

Alternatively run this .reg file to set the keys for you, either run it from the web page or save it as a file with a .reg extension and then run it.