Quake-ify Windows CMD


I haven’t found a thing that will do this for me, so I built one around my Windows Git Bash using visual basic script. The script acts as follows:

if (bashAppIsClosed) {
    start it
} else if (bashAppIsMinimized) {
    restore it
} else {
    minimize it

Disclaimer: If you have Git Bash open behind other applications, it will still minimize the git-bash window. This isn’t a problem if you use the “Always On Top” Autohotkey, ^SPACE:: Winset, Alwaysontop, , A, which will guake-ify your bash just that much more.

Here’s the good stuff

dim maximized : maximized = 3
dim workbenchPath : workbenchPath = "C:\Users\me\workbench\"
dim gitBashPath : gitBashPath = "C:\Users\me\AppData\Local\Programs\Git\git-bash.exe --cd=" & workbenchPath
dim bashTitle : bashTitle = "MINGW64:/c/Users/me/workbench"
dim restore : restore = "% r"
dim minimize : minimize = "% n"
set shell = WScript.CreateObject("WScript.Shell")
dim isVisible : isVisible = shell.AppActivate(bashTitle)

if NOT isVisible then
    set WMI = GetObject("winmgmts:")
    set objProcesses = WMI.execquery("SELECT * FROM win32_process WHERE Name = 'git-bash.exe'")
    if objProcesses.Count = 0 then 
        shell.Run gitBashPath, maximized
        shell.SendKeys restore
    end if    
    shell.SendKeys minimize
end if

I believe this script will work with any application, so if you prefer a different command-line tool you should be able to use the executable path of your cmd so long as you update the WHERE Name = 'git-bash.exe' as well.

Stuff I had to look up that might also help you

Please, steal my code!

  1. Create a file named git-quake.vbs (or whatever)
  2. Paste the script above replacing my gitBashPath path for yours, and bashTitle with the title text of your bash window.
  3. In your Windows Explorer, navigate to the file you just created.
  4. Right-click on the file > Send to > Desktop (create shortcut)
  5. Right-click on the shortcut you just created > Properties > Shortcut
  6. Assign whichever hotkey you want to open/minimize/restore your bash.
Written on May 10, 2018