#1 28 May 2020 10:48

Rekrul
Member
Registered: 17 Apr 2016
Posts: 71

Association shown by ftype isn't the real association

The command ftype is supposed to show what program will be used to open a file of that type. However I've found that this information isn't always correctly.

For example, if I type;

ftype txtfile

I get;

txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1

The problem with this is that text files are NOT associated with Notepad, they're associated with Metapad, an editor that I installed. In fact, if I type ftype alone and it prints all the associations, Metapad is only associated with something called "tmi_auto_file", which I have no idea what that is.

It also claims that AVI files are associated with Windows Media Player. They're actually associated with Media Player Classic. MPC is the program that opens when I double-click them.

So my question is; Where are the real file associations stored since the ones displayed by ftype are apparently meaningless?

Offline

#2 28 May 2020 12:51

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,074
Website

Re: Association shown by ftype isn't the real association

The ASSOC command controls File associations, FTYPE is just setting the available FileTypes.

Offline

#3 29 May 2020 00:43

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 184

Re: Association shown by ftype isn't the real association

If you've installed software that overwrites the default program associated with the file, that information is stored in the registry. I've got Notepad++ installed, and that's listed as the default program for .txt files under the key

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice\ProgId

Offline

#4 29 May 2020 05:43

Rekrul
Member
Registered: 17 Apr 2016
Posts: 71

Re: Association shown by ftype isn't the real association

Simon Sheppard wrote:

The ASSOC command controls File associations, FTYPE is just setting the available FileTypes.

You would think so, but when I type;

assoc .txt

It prints;

.txt=txtfile

Nothing about what program will open it. However when I type;

ftype txtfile

I get;

txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1

It would appear that the functions of the two commands are backwards of what their names suggest. Assoc seems to set an extension to a file type, while ftype associates that type with a program.

Shadow Thief wrote:

If you've installed software that overwrites the default program associated with the file, that information is stored in the registry. I've got Notepad++ installed, and that's listed as the default program for .txt files under the key

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice\ProgId

Looking through my registry, it appears that there's no particular pattern to how associations are set. For some, the associations are under the Classes keys, in other cases, they're not. Exporting the entire registry to a file and searching it, I see some associations listed only under keys with numbers as their titles.

And I still don't understand why the actual associations differ from what every program says they are. I've run FileTypeMan fom NirSoft and an old program WAssociate and they both claim that text files will open in Notepad. Searching the registry, the only reference I can find to Metapad and .txt is this key;

[HKEY_USERS\S-1-5-21-321803341-1280003371-2099921806-1003\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt]
"Application"="metapad.exe"

Offline

Board footer

Powered by FluxBB