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

Windows 7 檔案關聯修復完全指南 (一):assoc 指令修復副檔名關聯、ftype 指令基礎

編輯:Win7 系統基礎知識

使用者誤將捷徑 (.lnk) 以「開啟方式」關聯至 Word 且勾選「永遠使用」,導致所有捷徑變成 Word 文件且無法恢復。本文從基礎知識切入,教導 assoc/ftype 指令修復檔案關聯。

檔案關聯兩層架構

  1. 副檔名 → 檔案類型 (由 assoc 管理)
  2. 檔案類型 → 開放命令 (開啟方式) (由 ftype 管理)

assoc 指令:修復副檔名與檔案類型關聯

  • 查詢:assoc .lnk → 顯示 .lnk=lnkfile
  • 修改:assoc .lnk=lnkfile (恢復標準關聯)
  • 破壞測試:assoc .lnk=lnk → 所有捷徑顯示 .lnk 副檔名且無法開啟
  • 修改的登錄位置:HKEY_CLASSES_ROOT\. 預設值 (但 assoc 修改範圍更廣,不建議直接改登錄)。

ftype 指令:修復檔案類型與開放命令關聯

  • 查詢:ftype txtfile → 顯示 txtfile="%SystemRoot%\system32\NOTEPAD.EXE" %1
  • 修改:ftype txtfile=notepad.exe → 建立新關聯
  • 清除:ftype lnkfile= (等號後無空格)
  • 修改的登錄位置:HKEY_CLASSES_ROOT\\shell\open\command 預設值 (同樣修改範圍更廣)。

實戰案例:.lnk 捷徑關聯錯誤

  1. assoc .lnk → 回傳 .lnk=lnkfile (第一層正常)
  2. ftype lnkfile → 回傳「找不到檔案類型」 (第二層系統預設為空,正常)
  3. 結論:問題在使用者層級「右鍵開啟方式」設定 (UserChoice),非 assoc/ftype 可解。

下篇將詳細說明 UserChoice 機制與刪除修復法。

Copyright © Windows教程網 All Rights Reserved