徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法

2015-07-15 00:00

    在win7系統(tǒng)中經(jīng)常會對文件選擇右鍵菜單進(jìn)行操作,而小編今天在右擊文件選擇打開方式的時候發(fā)現(xiàn)這樣一個問題,就是右鍵菜單中出現(xiàn)了兩個記事本的情況,這讓小編很不解,后面網(wǎng)上查找了一下,其實這是很正常的一件事,那么如果不喜歡的話我們可以讓它只剩下一個記事本,下面給大家?guī)韽氐捉鉀Qwin7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的步驟如下!

推薦:win7純凈版系統(tǒng)下載


徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法

原因分析:

    因為在我們系統(tǒng)windows文件夾(C:\Windows)和system32文件夾(C:\Windows\System32)下面各有一個notepad.exe程序,系統(tǒng)在注冊應(yīng)用程序和文件關(guān)聯(lián)打開方式的時候,分別使用了它們,但是打開方式又要讀取這兩個地方,所以就出現(xiàn)兩個記事本了。

解決方法:

  1、網(wǎng)站查找的方法:首先創(chuàng)建批處理,用來處理這個問題,把里面的代碼復(fù)制粘貼到文本文件,保存為后綴。bat的文件,執(zhí)行就可以了。
[email protected] 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
    2、經(jīng)小編測試,再加上翻閱資料,上述源碼有誤,應(yīng)該是:
[email protected] 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

3、然后就可以解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項了。


徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法

命令簡單介紹:

if exist "%systemroot%\notepad.exe" set Npath="%systemroot%\notepad.exe %"1

這句話是設(shè)置一個變量: Npath="%systemroot%\notepad.exe %"1,這個變量將寫入注冊表。

徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法

%1 表示參數(shù)

比如你想打開1.txt,就是用 命令:notepad 1.txt搞定。

這個方法算是解決了txt后綴文件打開方式出現(xiàn)兩個文件夾的問題。

總結(jié):

我們在設(shè)置txt后綴打開類型的時候,

設(shè)置了HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\open\command=%systemroot%\notepad.exe

這就導(dǎo)致text類型直接映射到c:\Windows\notepad.exe

這時候包括ini文件inf文件在內(nèi)的所有PerceivedType=text的文件類型映射到了c:\Windows\notepad.exe。

ini,inf文件的打開類型已經(jīng)映射到了c:\Windows\System32\notepad.exe

這時候就會右鍵打開---出現(xiàn)兩個記事本選項。。

解決的根本之道就是,將HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\open\command=%systemroot%\System32\notepad.exe

請使用命令:

@echo off

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

最后我們看看所謂的ini文件:


徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法
    好了,以上給大家介紹的就是徹底解決win7系統(tǒng)右鍵選擇打開方式中出現(xiàn)兩個記事本選項的方法,大家可以嘗試上面的方法進(jìn)行解決就可以了。

網(wǎng)友評論

相關(guān)閱讀