Category Archives: Windows tweaks

How to set up Console2 to use bash

If you prefer to use bash over cmd, you can set up a bash tab in Console2 by going to Edit > Settings > Tabs, clicking the Add button, and setting the shell option to the location of your bash executable followed by the -l parameter (or –login). You can set the title to whatever you like, change the background color, etc.

Now, if you added the Console2 context menu entries that I described in my previous post, you might also like to change into the current directory when you invoke it from the context menu. Depending on what version of bash you have, you might need to put the following at the end of your .bashrc file in your home directory:

# Change to current directory when invoking from Windows Explorer context menu
cd -

I found that this step was not necessary if I used the version of bash that comes with Git (located at C:\Program Files (x86)\Git\bin\bash.exe on my system). However, it was necessary if I used the version that comes with cygwin (C:\cygwin\bin\bash.exe). Using the latter, the home directory used by bash was actually located at C:\cygwin\home\dave. This will (obviously) be different on your system.

EDIT 4/14/2015: It appears that Console2 is currently dormant. One alternative I’ve found is ConsoleZ, which is a fork of Console2. You can find it here: https://github.com/cbucher/console.

Then, use this script to create context menu entries:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\directory\shell\ConsoleZ]
@="Open ConsoleZ here"
[HKEY_CURRENT_USER\Software\Classes\directory\shell\ConsoleZ\command]
@="C:\\Users\\Dave\\AppData\\Local\\ConsoleZ\\Console.exe -d \"%V\""
[HKEY_CURRENT_USER\Software\Classes\directory\background\shell\ConsoleZ]
@="Open ConsoleZ here"
[HKEY_CURRENT_USER\Software\Classes\directory\background\shell\ConsoleZ\command]
@="C:\\Users\\Dave\\AppData\\Local\\ConsoleZ\\Console.exe -d \"%V\""

Update the path as appropriate.

How to add Console2 context menu entries in Windows

If you ever use the command line in Windows, you need to download Console2 immediately.

The first thing I noticed after installing it, however, is that it doesn’t add any context menu entries. I had to do quite a bit of research to come up with this registry hack:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Console2]
@="Open Console2 Here"
[HKEY_CLASSES_ROOT\Directory\shell\Console2\command]
@="C:\\Console2\\Console.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Console2]
@="Open Console2 Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Console2\command]
@="C:\\Console2\\Console.exe"

If you want to copy and paste the text above into a .reg file, make sure the encoding is set to UCS-2 Little Endian before you try to import it into the registry.

EDIT 4/14/2015: It appears that Console2 is currently dormant. One alternative I’ve found is ConsoleZ, which is a fork of Console2. You can find it here: https://github.com/cbucher/console.

Then, use this script to create context menu entries:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\directory\shell\ConsoleZ]
@="Open ConsoleZ here"
[HKEY_CURRENT_USER\Software\Classes\directory\shell\ConsoleZ\command]
@="C:\\Users\\Dave\\AppData\\Local\\ConsoleZ\\Console.exe -d \"%V\""
[HKEY_CURRENT_USER\Software\Classes\directory\background\shell\ConsoleZ]
@="Open ConsoleZ here"
[HKEY_CURRENT_USER\Software\Classes\directory\background\shell\ConsoleZ\command]
@="C:\\Users\\Dave\\AppData\\Local\\ConsoleZ\\Console.exe -d \"%V\""

Update the path as appropriate.

How to add “Open with Git Bash” and “Open with Git GUI” context menu entries in Windows

This is a just a small distraction. I’m sort of a clean freak when it comes to Windows, so I usually opt not to install things like context menu entries when I’m trying a new program. Unfortunately, I opted not to install them for Git and realized later that I really wanted them. There doesn’t seem to be a way to correct this post-installation, so I did some research and figured out a little registry hack to accomplish the same thing:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithGitBash]
@="Open with Git Bash"
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithGitBash\command]
@="\"wscript\" \"C:\\Program Files (x86)\\Git\\Git Bash.vbs\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithGitGUI]
@="Open with Git GUI"
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithGitGUI\command]
@="\"C:\\Program Files (x86)\\Git\\bin\\wish.exe\" \"C:\\Program Files (x86)\\Git\\libexec\\git-core\\git-gui\" \"--working-dir\" \"%1\""

Now, I can right click on a folder with a Git repository in it and open it instantly in Git Bash or Git GUI. Joy!

If you want to copy and paste the text above into a .reg file, make sure the encoding is set to UCS-2 Little Endian before you try to import it into the registry.