Ways to change how files are opened under Windows 7 systems

Source: Internet
Author: User
Tags requires

The system is windows7, this friend because the desktop does not have Office icons, and is 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 not possible under XP, and it seems that this particular problem is a new problem under Windows 7. 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.

  First, Assoc command

To modify the association of an extension with a file type, we need to use a command: Assoc

Click to 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, in Windows, this extension is generally not visible, if it appears, it must be its file association problems. We entered in CMD: Assoc. lnk carriage return, we can get the command result:. lnk=lnkfile

The results of this command show: extension. LNK is associated with the file type Lnkfile. The name of the extension is. LNK files, all belong to lnkfile this 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:

Assoc. lnk

Enter. The results of our command will be:

. Lnk=lnk

This result shows 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 take a look at it, 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:

Assoc. lnk=lnkfile

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:

Assoc. lnk=lnkfile

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:

Assoc. Ext=filetype

Enter.

This one. Ext represents the file name extension, for example. LNK, this filetype 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 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: Hkey_classes_root.ext

Here's. Ext represents an extension, such as a shortcut to the corresponding item:

Hkey_classes_root.lnk

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.

  Second, Fytpe 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. Like what. The file type associated with the txt extension is txtfile, and txtfile is 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:

Ftype/?

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:

Ftype FileType

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:

Ftype Lnkfile

Carriage return, we will get the command result:

Lnkfile=notepad.exe

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:

Ftype lnkfile=

Enter. Under XP, this command is invalid, but we can enter it under XP:

Ftype lnkfile=

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.

Let's Enter:

Ftype txtfile

Enter. Under normal circumstances, the result of the command we can get is:

Txtfile= "%systemroot%system32notepad.exe"%1

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:

Ftype filetype=opencommandstring

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:

Hkey_classes_rootfiletype

This filetype represents the file type, such as the corresponding registry entry for the Batfile file type:

Hkey_classes_rootbatfile

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.

  Third, the right key to open the way

We talked about the extension to the file type, the file type associated with the Open command (that is, how the file was opened), it looks as if we've finished talking about the file association, but there's another important aspect that we haven't 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:

Hkey_classes_rootfiletype

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:

Hkey_current_usersoftwaremicrosoftwindowscurrentversion

Explorerfileexts.ext

This one. Ext represents the file name extension, such as:

Hkey_current_usersoftwaremicrosoftwindowscurrentversion

Explorerfileexts.lnk

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:

Hkey_classes_root.ext

Hkey_classes_rootfiletype

Hkey_current_usersoftwaremicrosoftwindowscurrentversion

Explorerfileexts.ext

Problem solving

Now it's time to go back to the question we talked about at the beginning.

I taught that friend. First Enter:

Assoc. lnk

The results of the returned command are:

. lnk=lnkfile

This indicates that the extension. The association between LNK and file type Lnkfile is not problematic.

I want him again. Enter:

Ftype Lnkfile

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 for XP and Windows 7, but for the extension. The shortcuts to LNK are different. Under Windows 7, even for the. The LNK shortcut is also the right key to open the setting that takes precedence over the ftype command. 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:

Hkey_current_usersoftwaremicrosoftwindowscurrentversion

Explorerfileexts.lnkuserchoice

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 right button, under XP, we can in my computer, the pastry tool----View----Folder Options---File type, where we can do the same, and in Windows 7, We can----Control Panel---program---the default program----always use the specified program to open this text type---Set up, XP settings are much more options, and Windows 7 settings are extremely concise. Limited to space, the specific settings will not speak.

Conclusion: Through the above steps, you can change the Windows 7 system files under the open way problem!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.