How to change the way Win7 files are opened

Source: Internet
Author: User
Tags requires

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.

ASSOC command

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:

Assoc. lnk

Enter. The results of our command will be:

. Lnk=lnk

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:

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. 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:

Hkey_classes_root.ext

Here's. ext represents the extension, such as the corresponding entry for the shortcut:

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.

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. 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:

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.

Right-open mode

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:

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. 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 there is no problem with the association between the extension. lnk and the file type Lnkfile.

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 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:

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 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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.