Skip to content

Instantly share code, notes, and snippets.

@hollowmaster1496
Last active October 2, 2025 14:49
Show Gist options
  • Select an option

  • Save hollowmaster1496/617769d51d39cf4cc8f6427d6f3b4369 to your computer and use it in GitHub Desktop.

Select an option

Save hollowmaster1496/617769d51d39cf4cc8f6427d6f3b4369 to your computer and use it in GitHub Desktop.
Open MSYS2 terminal here (mingw-w64) from right-click menu

For anyone who develops software on Windows (but needs quick access to a Linux terminal), here's a quick and easy way to get it with MSYS2.

Before starting, install "MSYS2" with default settings.

  1. From Windows search, launch 'regedit.exe'
  2. Navigate to "HKEY_CLASSES_ROOT\Directory\Background\shell"
  3. Right-click on 'shell' and select New>Key. Call this key MSYS2.
  4. Now right-click on 'MSYS2' and select New>Key. Call this key command
  5. Select command and then double-click on (Default). Set 'Value data' to "C:\msys64\msys2_shell.cmd" "-here"

Now try right-clicking in file explorer and select the new shortcut :)

@rlewkowicz
Copy link

That made it open, but not to my location. This worked though:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\MSYS2]
@="Open MSYS2 here"
"Icon"="C:\\msys64\\msys2.ico"

[HKEY_CLASSES_ROOT\Directory\Background\shell\MSYS2\command]
@="C:\\msys64\\msys2.exe bash"

@CptNemo0
Copy link

Huge! Thanks man.

@sxlderek
Copy link

sxlderek commented Oct 2, 2025

Here are the commands I used with scoop-installed msys2. I hope others find them helpful

# scoop install msys2

## install msys2 context menu
$baseKey = "Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\MSYS2"
$commandKey = "$baseKey\command"
New-Item -Path $baseKey -Force
Set-ItemProperty -Path $baseKey -Name "(default)" -Value "Open MSYS2 here"
Set-ItemProperty -Path $baseKey -Name "Icon" -Value "$env:USERPROFILE\scoop\apps\msys2\current\msys2.ico"
New-Item -Path $commandKey -Force
Set-ItemProperty -Path $commandKey -Name "(default)" -Value "$env:USERPROFILE\scoop\apps\msys2\current\mingw64.exe bash"


## remove msys2 context menu
$baseKey = "Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\MSYS2"
$commandKey = "$baseKey\command"
Remove-Item -Path $commandKey -Force -ErrorAction SilentlyContinue
Remove-Item -Path $baseKey -Force -ErrorAction SilentlyContinue

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