Always solve the problem of "right-click a file-select Open Mode-two notebooks appear" in win7.
For example, many people may find two "notebooks" in the right-click menu. Actually, this is quite normal.
Because the windows folder (C: \ Windows) and the system32 file in our system
Folder (C: \ Windows \ system32.pdf each has its own notepad.exe program. The system registers the application
When the program and file are associated with the open method, they are used separately, but the open method needs to read
Here are two notebooks. I should know what is going on here! I made a batch to solve this problem and copied and pasted the code into a text file,
Save the file with the suffix. bat and execute it. @ Echo offif exist "% systemroot % \ notepad.exe" set Npath = "% systemroot % \
Notepad.exe % "1if not exist" % systemroot % \ notepad.exe "set Npath =" % systemroot %
\ System32 \ notepad.exe % "1reg add" HKCR \ txtfile \ shell \ open \ command "/ve/d % Npath %/t REG_SZ/freg add" HKCR \ Applications \ notepad.exe \ shell \ open \ command"
/Ve/d % Npath %/t REG_SZ/freg add "HKCR \ SystemFileAssociations \ text \ shell \ open \ command"
/Ve/d % Npath %/t REG_SZ/f has been tested by me. In addition, the above source code is incorrect and should be: @ echo offif exist "% systemroot % \ notepad.exe" set Npath = "% systemroot %
\ Notepad.exe % "1if not exist" % systemroot % \ notepad.exe "set Npath =" % systemroot %
\ System32 \ notepad.exe % "1reg add" HKCR \ txtfile \ shell \ open \ command "/ve/d % Npath %
/T REG_SZ/freg add "HKCR \ Applications \ notepad.exe \ shell \ open \ command"
/Ve/d % Npath %/t REG_SZ/freg add "HKCR \ SystemFileAssociations \ text \ shell \ open \ command"
Brief Introduction to the/ve/d % Npath %/t REG_SZ/f command: if exist "% systemroot % \ notepad.exe" set Npath = "% systemroot %
\ Notepad.exe % "1 is to set a variable: Npath =" % systemroot % \ notepad.exe % "1,
This variable will be written to the Registry. HKCR \ txtfile \ shell \ open \ commandHKCR \ Applications \ notepad.exe \ shell \ open \ commandHKCR \ SystemFileAssociations \ text \ shell \ open \ command displays the Registry HKCR \ txtfile \ shell \ open \ command: for example, if you want to open 1.txt, use the command notepad 1.txt. This method solves the problem of opening two folders in the txt suffix file. However, the INI file cannot be opened by right-clicking the INI file.
Two notepad options are also displayed. We can find HKEY_CLASSES_ROOT \ inifile \ shell \ open \ command
This item only has one numeric value: it should be one to open notepad. Let's take a look at this item: HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \
CurrentVersion \ Explorer \ FileExts \. ini \ OpenWithList found that he has no project.: And the following HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \
CurrentVersion \ Explorer \ FileExts \. ini \ OpenWithProgids has an item value: inifile .. this shows that it is based on the inifile registration item to find the open method. this only indicates that there are two possibilities ① apart from the previous HKEY_CLASSES_ROOT \ inifile item, there is another inifile item. After searching, we found the HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ inifile, but there is only one data item, which is consistent with the data of HKEY_CLASSES_ROOT \ inifile. ② This is the second possibility. Another. ini registry controls the suffix type selection. After searching, there are several. ini items (not all listed) 1) HKEY_CLASSES_ROOT \. ini was originally a PerceivedType. It is text by default. 2) HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion
\ Explorer \ RecentDocs \. ini (useless) 3) HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \. ini. By default, textPerceivedType indicates that the accepted or perceived type is the key value in the registry.
For example, in the registry, if the string value "PerceivedType" = "text" exists,
Right-click the file to select the text option. This text corresponds to the following item: HKEY_CLASSES_ROOT \ SystemFileAssociations \ text do you remember him? This is the registry key that was modified when you right-click the txt file and two notebooks are displayed. The value has already been set above. It is "% systemroot % \ notepad.exe". See the table below, which explains why the inf file also has two notebooks. See: Conclusion: when we set the txt suffix to open the type, if HKEY_CLASSES_ROOT \ SystemFileAssociations \ text \ shell \ open \ command = % systemroot % \ notepad.exe is set, the text type is directly mapped to c: \ Windows \ notepad.exe all PerceivedType = text files including the INI file inf file
The type is mapped to c: \ Windows \ notepad.exe. Ini, the open type of the inf file has been mapped to c: \ Windows \ System32 \ notepad.exe. At this time, the file will be right-clicked to open --- two notepad options will appear .. The solution is to convert HKEY_CLASSES_ROOT \ SystemFileAssociations \ text \ shell \ open \ command = % systemroot % \ System32 \ notepad.exe... Run the following command: @ echo offset Npath = "% systemroot % \ system32 \ notepad.exe %" 1reg add "HKCR \ txtfile \ shell \ open \ command"/ve/d % Npath %/t REG_SZ/freg add "HKCR \ Applications \ notepad.exe \ shell \ open \ command"
/Ve/d % Npath %/t REG_SZ/freg add "HKCR \ SystemFileAssociations \ text \ shell \ open \ command"
/Ve/d % Npath %/t REG_SZ/f finally let's look at the so-called INI file: --- end