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;
}