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

Win7 右鍵「開啟方式」出現兩個記事本?批次檔修正檔案關聯去重

編輯:Win7 系統應用技巧

因 C:\Windows\notepad.exe 與 C:\Windows\System32\notepad.exe 同時存在,系統在註冊檔案關聯時重複建立「記事本」選項。執行批次檔修正登錄關聯,保留單一路徑即可去重。

批次檔內容(存為 .bat 執行)

@echo off
if exist "%systemroot%\notepad.exe" set Npath="%systemroot%\notepad.exe %1"
if not exist "%systemroot%\notepad.exe" set Npath="%systemroot%\system32\notepad.exe %1"
reg add "HKCR\txtfile\shell\open\command" /ve /d %Npath% /t REG_SZ /f
reg add "HKCR\Applications\notepad.exe\shell\open\command" /ve /d %Npath% /t REG_SZ /f
reg add "HKCR\SystemFileAssociations\text\shell\open\command" /ve /d %Npath% /t REG_SZ /f

右鍵開啟方式雙重記事本

執行後重新整理桌面或重新登入,右鍵「開啟方式」將只剩一個記事本。

Copyright © Windows教程網 All Rights Reserved