在檔案總管中已瀏覽到目標資料夾,仍需開啟 CMD 再 cd /d 路徑,極度低效。Linux 右鍵「在終端機開啟」早成標配,Windows 也有原生與腳本兩種解法。
regedit 依序展開:HKEY_CLASSES_ROOT\Directory\shell\cmdHKEY_CLASSES_ROOT\Drive\shell\cmdHKEY_CLASSES_ROOT\Directory\Background\shell\cmdcmd 鍵值下,刪除 Extended 字串值 (或重命名為 Extended_)。⚠ 修改登錄前請匯出備份;系統更新可能重置此設定。
安裝 AutoHotkey 後,建立腳本 open_cmd_here.ahk:
#IfWinActive ahk_class CabinetWClass || ahk_class ExploreWClass
; Win+E 開啟檔案總管時,按 Win+C 在當前路徑開啟 CMD
#c::
OpenCmdInCurrent()
return
OpenCmdInCurrent() {
; 取得檔案總管地址列完整路徑
ControlGetText, path, ToolbarWindow322, A
if (path = "") {
ControlGetText, path, ToolbarWindow323, A
}
; 移除「檔案總管 >」前綴
RegExMatch(path, "(.*)\\s*[>]]", path)
Run, cmd.exe /k cd /d "%path%"
}
#IfWinActive
Shift+右鍵是零成本原生解法;AutoHotkey 則提供極致客製化熱鍵體驗。依習慣選擇,告別手動 cd,讓命令列真正融入檔案操作流程。