Skip to content

Instantly share code, notes, and snippets.

@dave-newson
Last active October 20, 2022 23:32
Show Gist options
  • Save dave-newson/a0a082e37aef20f78bb3e739bf357bcc to your computer and use it in GitHub Desktop.
Save dave-newson/a0a082e37aef20f78bb3e739bf357bcc to your computer and use it in GitHub Desktop.
Windows 10 + Console2 + Cygwin

Console 2 on Windows with Bash

Why

Cmd sucks. Powershell is weird. I like tabs. Git for windows uses cygwin. Cygwin doesn't interpret ANSI colours.

Thingos to download

Foreword

I've installed everything to C:\Apps. It's up to you if you want to install things elsewhere (Program Files, etc). I chose C:\Apps because some programs really don't like paths with spaces in the names.

Steps

Installation

  • Install Git for Windows to C:\Apps\Git
  • Install Console2 to C:\Apps\Console2
  • Extract AnsiCon to C:\Apps\ansicon

Setup Console2

  • Run Console2
  • Go to Edit > Settings
  • Go to Tabs
  • Click Add to add a new tab setting
  • Set the Title to Git Bash
  • Set the Icon to C:\Apps\Git\etc\git.ico
  • Set the Shell to C:\Apps\Ansi166\x64\ansicon.exe "C:\Apps\Git\bin\bash.exe" --login -i We go through ansicon because cygwin doesn't handle ANSI colours natively, which ends up with messy output.
  • Set Startup dir to %HOMEDRIVE%%HOMEPATH%
  • Set Cursor to xterm

Override "Git Bash Here"

Part of installing Git for Windows gives you that handy right-click-anywhere and "Git Bash Here" feature. We want that to open Console2 instead of cygwin bash, so:

  • Create this file: C:\Apps\console.vbs
Set AppObj = CreateObject("Shell.Application")
If WScript.Arguments.Length=1 Then
    AppObj.ShellExecute "C:\Apps\Console2\Console.exe", " -t ""Git Bash"" -d """ & WScript.Arguments(0) & """"
Else
    AppObj.ShellExecute "C:\Apps\Console2\Console.exe", " -t ""Git Bash"""
End If

Running this should open a Console2 tab for Git Bash.

  • Create this temporary file: C:\Apps\bash.reg
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\git_shell\command]
@="\"C:\\windows\\SysWOW64\\wscript\" \"C:\\Apps\\console.vbs\" \"%1\""

Running this will update the Git For Windows "Git Bash Here" command to use our console.vbs.

All Done

Now if you right-click anywhere in Windows Explorer, and select "Git Bash Here" it should load Console2 with Bash CLI and support for ANSI Colours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment