Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> 關於 Windows

修改 CMD 預設啟動目錄:透過本地使用者設定檔路徑變更

編輯:關於 Windows

打開 CMD (Win+R → cmd) 預設停留在 C:\Documents and Settings\Administrator (XP/Server 2003) 或 C:\Users\Administrator (Vista/7/10)。若習慣直接在特定工作目錄 (如 D:\Projects) 開始操作,可修改使用者帳號的「本機路徑」屬性達成。

操作步驟 (適用 XP/Server 2003/Windows 7/10/11)

  1. Win+R → lusrmgr.msc → 開啟「本機使用者和群組」。
  2. 左側選「使用者」→ 右鍵目標帳號 (如 Administrator) →「屬性」。
  3. 切換「設定檔」頁籤 →「本機路徑」輸入欲啟動的完整路徑 (如 D:\Work) → 確定。
  4. 使用者屬性設定檔本機路徑

  5. 登出/重新登入或重啟電腦生效。

原理與注意事項

  • CMD 啟動時讀取使用者環境變數 %USERPROFILE% (即設定檔路徑) 作為目前工作目錄。
  • 修改此路徑同時影響「我的文件」、「桌面」等特殊資料夾實際位置,請確認目標資料夾存在且有寫入權限。
  • 若僅想變更 CMD 起始目錄而不移動使用者設定檔,建議改用:
    ① 建立捷徑指向 cmd.exe /k cd /d D:\Work。
    ② 或修改註冊表 HKCU\Software\Microsoft\Command Processor 新增字串值 Autorun = cd /d D:\Work。
Copyright © Windows教程網 All Rights Reserved