/Win-Shell-Menu-WinShellExt

Windows Explorer Shell Extensions

Primary LanguageC++MIT LicenseMIT

Documents

Repos

Right-Click menu Location of Windows Registry Table

[HKEY_CLASSES_ROOT\Drive]
[HKEY_CLASSES_ROOT\Folder]
[HKEY_CLASSES_ROOT\Directory]
[HKEY_CLASSES_ROOT\LibraryFolder]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory] - Legacy, Auto write by [HKEY_CLASSES_ROOT]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder] - Legacy, Auto write by [HKEY_CLASSES_ROOT]

Expand right-click menu on background

SET REGPATH=HKEY_CLASSES_ROOT\Directory\Background\shell\CMDShell
REG ADD "%REGPATH%" /ve /d "CMD Prompt" /f
REG ADD "%REGPATH%\command" /ve /d "cmd.exe /K CD %%1" /f

Expand right-click menu on folder

SET REGPATH=HKEY_CLASSES_ROOT\Folder\shell
REG ADD "%REGPATH%\zzdos" /ve /d "CMD Prompt" /f
REG ADD "%REGPATH%\zzdos\command" /ve /d "cmd.exe /K CD %%1" /f
REM
REG ADD "%REGPATH%\zzexplorer" /ve /d "Open in new window" /f
REG ADD "%REGPATH%\zzexplorer\command" /ve /d "explorer.exe /e,/root,%%L" /f

Expand right-click menu

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd "%V""

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""

Previous Version

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe -noexit -command Set-Location -literalPath '%V'"

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere]
@="Open CMD Here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

1. Edit with Vim

2. Cygwin Bash Here

The chere command - official tool

Cygwin-Bash-Here Repo

How does it work? It adds a simple command to HKCR\Directory\shell and HKCR\Directory\Background\shell:

C:\cygwin\bin\mintty.exe --dir "%V" -e /bin/env CHERE_INVOKING=1 /bin/bash --login

Open cygwin bash shell from Windows context menu using Windows Registry Table

DIRECTORY : Add option in the context menu for a directory

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Open Bash Here"
[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="c:\\cygwin\\bin\\mintty.exe bash --login -i -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

DRIVE : Add option in the context menu for a drive

[HKEY_CLASSES_ROOT\Drive\shell\bash]
@="Open Bash Here"
[HKEY_CLASSES_ROOT\Drive\shell\bash\command]
@="c:\\cygwin\\bin\\mintty.exe bash --login -i -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

BACKGROUND : Add option in the background context menu - This works in Windows 7, but requires the chere package

[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Open Bash Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="c:\\cygwin\\bin\\mintty.exe -i /Cygwin-Terminal.ico -e /bin/xhere /bin/bash.exe"

BACKGROUND : Add option in the background context menu - This works in Windows 8, but DONOT requires the chere package

[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Open Bash Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="c:\\cygwin\\bin\\mintty.exe -i /Cygwin-Terminal.ico bash -i -c 'cd \"`cygpath \"%V\"`\";bash'

BACKGROUND-OF-LIBRARY : Add option in the background context menu in the Library folders

[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell]
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\bash]
@="Open Bash Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="c:\\cygwin\\bin\\mintty.exe -i /Cygwin-Terminal.ico bash -i -c 'cd \"`cygpath \"%V\"`\";bash'

3. Git Bash here

Version 1

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui]
@="Git &GUI Here"
"Icon"="C:\\Program Files\\Git\\cmd\\git-gui.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""

Version 2

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%1\""

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""

Version 3

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui]
@="Git &GUI Here"
"Icon"="C:\\Program Files\\Git\\cmd\\git-gui.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""