Skip to content

Instantly share code, notes, and snippets.

@magthe
Created September 11, 2014 06:56
Show Gist options
  • Save magthe/a60293fe395af7245a9e to your computer and use it in GitHub Desktop.
Save magthe/a60293fe395af7245a9e to your computer and use it in GitHub Desktop.
MSYS2 "Open Here" registry settings
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
@="Open MSYS2 here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2\command]
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
@="Open MSYS2 here"
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2\command]
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
@hiptkang
Copy link

hiptkang commented Dec 1, 2018

For some users...

registry file

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw64]
@="MinGW &64 Bash Here"
"Icon"="\"C:\\msys64\\msys2.ico\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw64\command]
@="C:\\msys64\\msys2_shell.cmd -mingw64 -where \"%V/\""

[HKEY_CLASSES_ROOT\Directory\shell\mingw64]
@="MinGW &64 Bash Here"
"Icon"="\"C:\\msys64\\msys2.ico\""

[HKEY_CLASSES_ROOT\Directory\shell\mingw64\command]
@="C:\\msys64\\msys2_shell.cmd -mingw64 -where \"%V/\""

@Mattiwatti
Copy link

The command lines from @MacGyver27's .reg file worked fine for me so I didn't need to modify it. But here are some things to add that people may want to change to the above files:

  • If you add a key to HKEY_CLASSES_ROOT\Directory\shell, the menu item will be displayed when you right click on a folder in explorer. If you add a key to HKEY_CLASSES_ROOT\Directory\Background\shell, the menu item will be displayed when you right click on an empty area in a folder in explorer. If you add a key to HKEY_CLASSES_ROOT\Drive\shell, the menu item will be displayed when you right click on a drive. You may or may not want to add all three.
  • If your context menu is too cluttered you may want to enable the item for SHIFT+right clicks only. In this case you should add the following:
[HKEY_CLASSES_ROOT\xxx\shell\<msys2|mingw32|mingw64>]
"Extended"=""
"ShowBasedOnVelocityId"=dword:00639bc8

@ceremcem
Copy link

ceremcem commented Aug 6, 2020

For those who want make's autocompletion to work, replace the /command lines with this command, as applied in here.

@Hexlord
Copy link

Hexlord commented Sep 20, 2020

For some users...

registry file

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw64]
@="MinGW &64 Bash Here"
"Icon"="\"C:\\msys64\\msys2.ico\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw64\command]
@="C:\\msys64\\msys2_shell.cmd -mingw64 -where \"%V/\""

[HKEY_CLASSES_ROOT\Directory\shell\mingw64]
@="MinGW &64 Bash Here"
"Icon"="\"C:\\msys64\\msys2.ico\""

[HKEY_CLASSES_ROOT\Directory\shell\mingw64\command]
@="C:\\msys64\\msys2_shell.cmd -mingw64 -where \"%V/\""

The only option that worked for me with fresh MSYS2, thank you so much

@wswind
Copy link

wswind commented Nov 2, 2021

C:\\msys64\\msys2_shell.cmd -mingw64 -here works for me.

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