A friend urgent help: The system is windows7, this friend because the desktop does not have Office icons, and anxious to use Word, a desktop icon right click, select the Open way to select Word, and did not "always use this program to open the same type of file" before the check out. After this change, all the shortcuts are turned into Word documents. Can be changed to something else, such as a notepad to open, but there is no way to restore the original state.
This is a file-related issue. Such a problem is simply impossible under XP, and it seems that this particular problem is a new problem under the Win7. On the Internet, found that the problem is not just this friend, seems to have to solve the need.
In order to solve this problem, we need to first talk about the basic knowledge of the file association, so that friends can know the reason why.
File associations, primarily by associating file types with open commands. Windows uses file extensions to identify file types, which first requires associating the extension with the file type.
To modify the extension's association with the file type, we need to use a command: Assoc point start, search, enter cmd, open cmd, enter in cmd: Assoc/? Carriage return. We can get help with this command.
The ASSOC command has two functions, one is to display an association between the extension and the file type, and one is to overwrite the extension with the file type. Let's take a shortcut's association as an example to tell the problem.
The extension of the shortcut is. lnk, which is generally not visible under Windows, and if so, it must be a problem with its file association.
We entered in CMD: Assoc. lnk carriage return, we can get the command result:. lnk=lnkfile
This command result shows that the extension. lnk is associated with the file type Lnkfile. All files with the. lnk extension belong to the Lnkfile file type.
Now let's enter the command:
Assoc. Lnk=lnk carriage return. lnk the extension associated with the file type is overwritten. And then we'll enter the command:
Enter. The results of our command will be:
This result shows that the extension. lnk is already associated with the file type LNK and is no longer associated with lnkfile. This time you go to the desktop to see, the suffix name of all shortcuts on your desktop. LNK is all displayed, and all shortcuts are no longer available. When you double-click, you are prompted that Windows cannot open this file.
Now let us enter:
Enter. We will find that everything is back to the original.
In summary, if there is a problem with the association between the extension of the shortcut and the file type, we only need to enter:
When you enter the car, you can resolve the problem.
So, if we know the correct file type that the extension belongs to, when there is a problem with the association between the extension and the file type, we just need to enter:
This. ext represents the file name extension, such as. lnk, which represents the file type, such as lnkfile. FileType. If we don't know what type of file the extension is associated with, we just need to type in CMD: Assoc. ext carriage Return. We can get the type of file it is associated with.
Each registered extension will have a corresponding registry key in the registry:
Here's. ext represents the extension, such as the corresponding entry for the shortcut:
This item has a default value, and the data for this default value is the file type associated with this shortcut. Thus Assoc command, the main thing is to modify the default value of this item data. It should be noted, however, that the content modified by the Assoc command is not just the data for the default value of the item, but it will also modify some other aspects. So we can change the data of this value directly in the registry, and we can't completely replace the Assoc command.
We now know how to associate an extension with a file type, and further need to know how to associate a file type with an open command. For example, the. txt extension is associated with a file type that is txtfile, and txtfile in normal circumstances, always open with Notepad.exe (Notepad), which is the open command that opens the Txtfile file type.
How can I modify the association between this file type and the Open command? This requires another important command: Ftype
Let's type in cmd:
Enter. We can get help with this command.
The ftype command has two functions, one is to show the association between the file type and the Open command, and the other is to overwrite the association between the file type and the Open command.
If we want to know what kind of open command a file type is associated with, we just need to type in cmd:
Enter. We will be able to get the results we want. This filetype represents the specified file type, such as Lnkfile
Let's enter: Ftype lnkfile
Enter. Under normal circumstances, the result of the command we obtained was that no file type "Lnkfile" or its associated open command was found. The result is that, in normal circumstances, Lnkfile is not associated with any open command.
Let's enter: Ftype Lnkfile=notepad.exe
Enter. Let's enter again:
Carriage return, we will get the command result:
This result shows that the file type Lnkfile is associated with the Open command notepad.exe.
In this case, the shortcut is still not affected.
So how do you clear this association and not associate it with other open commands? We just enter:
Enter. Under XP, this command is invalid, but we can enter it under XP:
Enter. This command and the previous command on the surface can hardly see the difference, is that the previous command in the = no space after, and then a command in the = after a space.
Enter. Under normal circumstances, the result of the command we can get is:
This result indicates that the file type txtfile is associated with the Open command txtfile= "%systemroot%system32notepad.exe"%1.
If there is a problem with the association between a file type and an open command, and we know what the correct open command is, then we just need to enter the following command in CMD and return to the repair:
Here filetype represents the specified file type, such as Txtfile, where opencommandstring represents an open command, such as Notepad.exe
If there is a problem with the association between our txtfile and the Open command, we only need to enter it in CMD:
Ftype txtfile= "%systemroot%system32notepad.exe"%1
Enter. In this way, we also fix the association between the txtfile file type and its open command.
The so-called open command, in fact, is the way to open this type of file.
Each type of file that is registered has a corresponding registry key in the registry.
This registry entry is:
This filetype represents the file type, such as the corresponding registry entry for the Batfile file type:
The registry key modified by the ftype command is primarily---hkey_classes_rootfiletypeshell
Opencommand---The data for the default value of this item.
It should be noted, however, that the ftype command modifies not just the data for this default value. Therefore, directly in the registry to modify this data, and can not replace the ftype command changes.
Of course, all the things that the ftype command modifies can be found in the registry, but we look at it one by one, far better than using the ftype command to simply modify it.
Earlier we talked about the association of extensions to file types, the association of file types with open commands (that is, how the files are opened), and it looks as if we're done talking about file associations,
In fact, there is another important aspect that we have not talked about. This is where we right-click a file, choose the open mode (not all the files have the right to open this option), then we select a program, and "Always use this program to open the same type of file" on the tick before the check, point confirmation. For example, the friend at the beginning of this article, all shortcuts are selected to open as a word program. After that, the file type is also associated with this open command.
What is the relationship between the ftype command, which modifies the file type associated with an open command, and how the file type can be modified to be associated with an open command?
We found that the ftype command and the right key to open the way, the two modified registry entries are different. The registry key modified by the Ftype command is:
This filetype represents the file type, such as Hkey_classes_rootlnkfile
The primary registry key that is modified by the right key opening method is:
This. ext represents the file name extension, such as:
As I understand it, the contents of the Ftype command are set by the system, and the content modified by the right key is set by the user, and the actual object is the same, and when the two are inconsistent, the user setting takes precedence over the system settings.
Three registry entries
In summary, file associations involve a key of three registry entries:
Now it's time to go back to the question we talked about at the beginning.
I taught that friend. First Enter:
The results of the returned command are:
This indicates that there is no problem with the association between the extension. lnk and the file type Lnkfile.
I want him again. Enter:
The results of the returned command are:
The file type "Lnkfile" or its associated open command was not found and the result is normal, indicating that the association between the Lnkfile and the open commands in the system setup is OK.
The problem, then, is that there is a problem with the association between the Lnkfile in user settings and the Open command. In general, the right-open setting takes precedence over the settings associated with a file by the Ftype command, which is the same under XP and Win7, but the two are different for shortcuts with the. lnk extension. Under Win7, even for the. lnk shortcut, the setting with the right key open method takes precedence over the ftype command's setting.
Found the problem, we can know that for this fast way file association error, we use assoc and Ftype commands are not resolved. The answer is:
Right-click in the registry to delete the following registry key:
The values and data under this registry key (specifically the value named ProgID and its data) are the default open programs that are set by the right key open method.
After the deletion, restart the computer, or restart the explorer, the problem is resolved perfectly.
In addition to this solution, other solutions have not been found for the time being.
By the way, under XP, Userchoice This registry entry is not.
Because some files do not have the option to open the way, under XP, we can in my Computer the pastry tool----View----Folder Options---File type, where we can make the same settings, and in Win7, We can----Control Panel---program---the default program----always use the specified program to open this type of---to set up, XP settings can be much more options, and Win7 the setting is very concise. Limited to space, the specific settings will not speak.