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

Windows 7 修改程式預設安裝目錄:登錄與權限遷移完整操作

編輯:Windows 7 系統介紹

Windows 7 更改預設安裝路徑:ProgramFilesDir 登錄修改與 xcopy 權限遷移

Windows 7 預設將程式安裝至 C:\Program Files(32 位元系統/64 位元系統的 64 位元程式)與 C:\Program Files (x86)(64 位元系統的 32 位元程式)。若 C 槽空間不足,可修改預設路徑至 D 槽等其他分區,但需同步處理權限遷移。

步驟一:修改登錄值

  1. Win+R → regedit → Enter。
  2. 導覽:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
  3. 找到 ProgramFilesDir(32 位元系統/64 位元系統的 64 位元程式)與 ProgramFilesDir (x86)(64 位元系統的 32 位元程式)。
  4. 雙擊修改數值資料為新路徑,如 D:\Program Files、D:\Program Files (x86)。

步驟二:以管理員身分複製資料夾結構與權限(關鍵)

  1. 以 Administrator 登入(或右鍵 CMD 以管理員執行)。
  2. 執行指令複製原資料夾**含所有權限、屬性、隱藏檔**:
    xcopy "C:\Program Files" "D:\Program Files" /E /H /K /X /Y
    xcopy "C:\Program Files (x86)" "D:\Program Files (x86)" /E /H /K /X /Y
  3. 參數說明:/E 包含空目錄、/H 隱藏/系統檔、/K 保留屬性、/X 保留稽核/ACL 權限、/Y 不提示覆蓋。

步驟三:刪除原資料夾(選擇性,高難度)

若 C 槽空間極緊需刪除原 Program Files:

  1. 取得 TrustedInstaller 擁有權 → 右鍵資料夾 → 內容 → 安全性 → 進階 → 擁有者 → 編輯 → 選 Administrators → 套用。
  2. 給予 Administrators「完全控制」權限。
  3. 刪除資料夾(可能需安全模式或啟動修復環境下執行)。

建議:若 C 槽尚有空間,**保留原資料夾**較安全,避免已安裝程式路徑硬編碼導致執行失敗。新安裝程式會自動導向新路徑。

驗證

安裝新程式測試,預設安裝路徑應指向新位置。已安裝程式不受影響(仍在原路徑運行)。

64 位元系統雙路徑說明

  • ProgramFilesDir → 64 位元程式預設路徑(通常 C:\Program Files)。
  • ProgramFilesDir (x86) → 32 位元程式預設路徑(通常 C:\Program Files (x86))。
  • **兩者皆需修改**並同步複製權限。
Copyright © Windows教程網 All Rights Reserved