Skip to content

Instantly share code, notes, and snippets.

@sxlderek
Created February 19, 2022 18:58
Show Gist options
  • Select an option

  • Save sxlderek/b6f5cbffa3b29f8e87c61b33fcbe2c14 to your computer and use it in GitHub Desktop.

Select an option

Save sxlderek/b6f5cbffa3b29f8e87c61b33fcbe2c14 to your computer and use it in GitHub Desktop.
create / delete context menu for msys2 mingw64

to create the context menu

# run in admin powershell
'Directory',
'Directory\Background',
'Drive' | ForEach-Object {
  $Path = "Registry::HKEY_CLASSES_ROOT\$_\shell\mingw64";
  New-Item -Path $Path -Name 'command' -Force | Out-Null;
  Set-ItemProperty -Path "$Path\command" -Name '(default)' -Value 'C:\\msys64\\msys2_shell.cmd -mingw64 -where "%V/"';
  Set-ItemProperty -Path $Path -Name '(default)' -Value 'MinGWx64 Bash Here';
  Set-ItemProperty -Path $Path -Name 'Icon' -Value 'C:\\msys64\\msys2.ico';
}

to delete the context menu

# run in admin powershell
'Directory',
'Directory\Background',
'Drive' | ForEach-Object {
  $Path = "Registry::HKEY_CLASSES_ROOT\$_\shell\mingw64";
  Remove-Item -Path $Path -Recurse -Force;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment