Git CMD here:

將下面內容存成 .reg 檔案,再執行即可:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%1\""
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
安裝 Git for Windows 時,可以勾選 Git GUI here 和 Git Bash here

就可以隨時可以在資料夾按右鍵的快顯功能表中出現這二個功能

但有些比較喜歡「命令提示字元」環境的人,會使用開始功能中的 Git CMD 來操作 git

雖然可用,但還要自己切換到目標目錄,不如右鍵的快顯功能表來得方便!剛好前一陣子解了 Git for Windows issue 1229,試著用原來的機碼:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""
[HKEY_CLASSES_ROOT\Directory\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"
[HKEY_CLASSES_ROOT\Directory\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""
[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.\""
改成:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%1\""
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
將上面內容存成 .reg 檔案再執行,果然!有 Git CMD here 可以用了:

其實機碼分三組
第一組表示在「資料夾空白處」按右鍵所顯示的內容(\Directory\Background\shell)
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
第二組表示在「資料夾上」按右鍵所顯示的內容(\Directory\shell)
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%1\""
第三組比較特別,是在「媒體櫃資料夾空白處」按右鍵所顯示的內容(\LibraryFolder\background\shell)
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd]
@="Git &CMD Here"
"Icon"="C:\\Program Files\\Git\\git-cmd.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell_cmd\command]
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
這三組的內容其實是非常接近,原本 Git Bash here 用的名稱是
git_shell
所以 Git CMD here 要用另一個名稱(尾端加上 _cmd)
git_shell_cmd
快顯功能表中的選項所要顯示的名稱用 @="Git &CMD Here" 表示
快顯功能表中的選項所要顯示的圖示用 "Icon"="C:\\Program Files\\Git\\git-cmd.exe"表示

最後,就是命令啦!
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%v.\""
和
@="\"C:\\Program Files\\Git\\git-cmd.exe\" \"--cd=%1\""
啟動 git-cmd.exe 並使用 --cd 選項來切換目錄(cd: change directory),至於要切到哪個目錄,則由 shell 自動帶入 %v. 或 %1 ,這樣就省去切換目錄的動作。