Introduction to issues related to file association in the system

  

The problem of file association sounds strange. In fact, each of us may encounter such a situation, first look at what kind of scene the user has encountered. I met a friend for emergency help: the system is windows7, this friend has no OFFICE icon on the desktop, and is anxious to use WORD, right click on a desktop icon, select Word in the open mode, and do not put "always Use this program to open the same type of file & rdquo; before the tick off. After this change, all the shortcuts turned out to be word documents. Can be changed to something else, such as the change to Notepad mode, but there is no way to restore the original.

This is a file association issue. Such a problem is simply not possible under xp. It seems that this specific problem is a new problem under Win7. I searched the Internet roughly and found that it was not just this friend who appeared to have such a problem. It seems that there is a need for a solution.

In order to solve this problem, we need to talk about some basic knowledge of file associations so that our friends can know what they know.

File associations, the main thing is to associate file types with open commands. Windows recognizes the file type by its file extension. This first needs to associate the extension with the file type.

assoc command

To modify the association between extension and file type, we need to use a command: assoc

point to start, search, enter cmd, open cmd, in In cmd, type: assoc /? Enter. We can get help with this command.

The assoc command has two functions. One is to display the association between the extension and the file type, and the other is to rewrite the association between the extension and the file type.

Let's take a shortcut as an example to illustrate this problem.

The extension of the shortcut is .lnk. Under Windows, this extension is generally not revealed. If it appears, it must be associated with a file.

We enter in the cmd: assoc.lnk, the result of the command we can get after the carriage return is: .lnk=lnkfile. The result of this command shows that the extension .lnk is associated with the file type lnkfile. Any file with a .lnk extension belongs to the lnkfile file type.

Now let's enter the command: assoc .lnk=lnk , press the Enter key, the lnk extension and the file type association will be rewritten. Then we enter the command: assoc .lnk, press the Enter key, the result of the command we get will be: .lnk=lnk , this result shows that the extension .lnk is already associated with the file type lnk, and no longer Is associated with lnkfile.

At this time, you can go to the desktop and look at it. The suffixes .lnk of all the shortcuts on your desktop are all displayed, and all shortcuts are no longer available. When you double-click, you will be prompted: Windows cannot open this file.

Now let's type: assoc .lnk=lnkfile , press the Enter key, we will find that everything is back to its original state.

In short, if there is a problem with the association between the extension's extension and the file type, we only need to type: assoc .lnk=lnkfile, and the problem can be solved after the carriage return.

Thus, if we know the correct file type to which an extension belongs, when there is a problem with the association between this extension and the file type, we only need to type: assoc .ext=filetype , Press the Enter key. This .ext represents the file extension, such as .lnk, which represents the file type, such as lnkfile. If we don't know what type of file the extension is associated with, we just need to type in the cmd: assoc.ext to enter. We can get what the file type it is associated with.

Each registered extension will have a corresponding registry key in the registry: HKEY_CLASSES_ROOT\\.ext ,

The .ext here represents the extension, such as shortcut The corresponding entry is: HKEY_CLASSES_ROOT\\.lnk , this item has a default value, the data of this default value is the file type associated with this shortcut. Therefore, the assoc command, the main thing is to modify the default value of this item. However, it should be noted that the content modified by the assoc command is not only the default value of the item, it will also modify other aspects. So we change the value of this value directly in the registry, and can not completely replace the assoc command.

Copyright © Windows knowledge All Rights Reserved