誤將某個程式(如記事本、QQ、Word)設為「開啟方式」的預設程式,導致所有 .exe 執行檔或 .lnk 捷徑雙擊都啟動同一個程式,系統幾乎無法正常操作。
此法適用於 Windows XP、Vista、7、8、10、11,原理是刪除使用者層級的檔案關聯覆寫,回復系統預設值。
[Version]
Signature="$Chicago$"
[DefaultInstall]
DelReg=DeleteMe
[DeleteMe]
HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe"
HKCU,"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk"
FixFileAssoc.inf(副檔名務必為 .inf),儲存類型選「所有檔案」,存放在桌面。FixFileAssoc.inf 按右鍵,選擇 「安裝」。
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ (使用者設定) > HKCR (系統預設)。HKCU 下建立 UserChoice 子鍵鎖定關聯。DelReg 刪除這兩個使用者層級鍵值,系統自動回落至 HKCR 預設關聯。以系統管理員身分開啟 PowerShell,依序執行:
# 移除 .exe 使用者關聯
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe" -Recurse -Force -ErrorAction SilentlyContinue
# 移除 .lnk 使用者關聯
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.lnk" -Recurse -Force -ErrorAction SilentlyContinue
# 重建圖示快取
ie4uinit.exe -show
執行完畢重新開機。
HKCR\.inf\Shell\Install\command 預設值是否為 rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %1。HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts 分支。