Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

當前資料夾秒開命令提示字元:Shift+右鍵 vs AutoHotkey 兩大招

編輯:Windows XP 系統介紹

雖然圖形介面稱霸,但命令列仍是高效操作利器。Windows 預設要在資料夾開啟 CMD 需 Shift+右鍵,或修改註冊表移除 Shift 需求;更進階者可用 AutoHotkey 一鍵在總管當前路徑開啟 CMD。

方法一:註冊表修改,右鍵直接顯示「在此處開啟命令視窗」

  1. Win+R → regedit
  2. 依序刪除下列機碼下的 Extended 字串值:
    HKEY_CLASSES_ROOT\Directory\shell\cmd
    HKEY_CLASSES_ROOT\Drive\shell\cmd
    HKEY_CLASSES_ROOT\Directory\Background\shell\cmd
  3. 完成後,資料夾、磁碟機、桌面空白處右鍵即直接顯示選項,無需按 Shift。

方法二:AutoHotkey 腳本,Win+C 一鍵在當前總管路徑開啟 CMD

#IfWinActive ahk_class ExploreWClass|CabinetWClass
#c::
    OpenCmdInCurrent()
return

OpenCmdInCurrent() {
    WinGetText, full_path, A
    StringSplit, word_array, full_path, `n
    current_dir := word_array1
    Run, cmd /k cd /d "%current_dir%"
}
#IfWinActive

將腳本存為 .ahk 並執行,或編譯為 EXE 放入啟動資料夾。按 Win+C 即在當前總管視窗路徑開啟 CMD,輕鬆達到 Linux 終端機「右鍵開啟終端機」的體驗。

進階技巧

  • 搭配 cmder、Windows Terminal 替代預設 CMD,體驗更佳。
  • PowerShell 使用者可將腳本改為 Run, wt -d "%current_dir%"(Windows Terminal)或 powershell -NoExit -Command "cd '%current_dir%'"。

無論註冊表微調或熱鍵腳本,都能大幅縮短「導航到目錄」的時間,讓命令列操作更流暢。

Copyright © Windows教程網 All Rights Reserved