locked
How to configure Open with RRS feed

  • Question

  • I've been having a hard time recently unravelling shell\open\command conflicts for a number of users. The deeper I dig, the more confused I get, so I'm hoping someone knows what happens. Although these cases involved the extension eml and the program wlmail.exe, my question is general.
    There are at least three UI ways of specifying which application is to be used to open a particular filetype or files with a particular extension:
    • Always use this program... in an Explorer Open with dialogue (extension -> program)
    • The Set associations applet in Control Panel (filetype -> program)
    • The Choose defaults for this program sub-applet to the Set Default Programs applet in Control Panel (program -> filetype)
    There are also a number of different places in the registry where the program to be used to open a particular filetype is specified:
    • HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{ext}\UserChoice\Progid
      I have seen cases where Progid points to {filetype} and others where it points to application/{exe}
    • HKR\{filetype}\shell\open\command
      [That there are at least two different filetypes applicable to eml files doesn't make matters any easier. On some systems it's Microsoft Internet Mail Message WLMail and on others WindowsLiveMail.Email.1]
    • HKR\Applications\{exe}\shell\open\command
    1. Does it make any difference which of the three methods is used to associate a filetype/extension with a program?
      If so, why? If not, why have three?
    2. Which of the shell\open\command keys do they write to?
    3. In which order does Explorer look for a shell\open\command?
    4. One application-specific oddity about wlmail.exe v. 15: the command to open a file is "{path}\wlmail.exe" /eml%1. "{path}\wlmail.exe" "%1" doesn't work. Do all three methods know this?

    Noel
    Saturday, November 19, 2011 6:59 PM

Answers

  • Yes, HKEY_CLASSES_ROOT is just a merge of the HKLM and HKCU classes information.

     

    Don’t quote me, but I think it must display the HKCU preference for that user. I don’t use multiple accounts so have never had the need to check it.

     

    I agree with you regarding the ‘Open with’ because the terminology in the right-click and in the registry is the same, but the original entries must come from the operating system install as there is a huge number of them. Understandably, application installation will also make entries when one answers the question ‘Do you want to make XXXX the default program’.

     

    If you are thinking of carrying out any tests, I, and perhaps many other people here, would be grateful if you posted your findings in the forum. I used to have an old Microsoft Registry Guide, which may have shed some light on it but a house search yesterday didn’t find it.

     

    Good luck with the detective work.


    • Edited by BurrWalnut Monday, November 21, 2011 6:39 PM
    • Proposed as answer by zhen tan Friday, November 25, 2011 7:22 AM
    • Marked as answer by Arthur Xie Thursday, December 8, 2011 10:05 AM
    Monday, November 21, 2011 2:50 PM

All replies

  • Noel

     

    I can enlighten you a little bit regarding file associations, file types and their respective registry keys. The reason that several GUIs are present is baffling but I suspect it must have something to do with defaults (Administrator HKLM registry keys) and standard accounts (HKCU keys).

     

    If you use the assoc and ftype commands (non-gui), you will notice that registry entries are made to HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE. As you know, a file extension is associated to a file type, which in turn opens a specific program when the file is double-clicked.. An example of this is the program we all use, notepad below:

     

    1. Open a Run window (Windows Logo key+R), type cmd and press Enter.

    Typing assoc .txt and pressing Enter will return txtfile (the file type).

    Typing ftype txtfile and pressing Enter will return %SystemRoot%\System32\notepad.exe %1 (the full path of the program that opens .txt files)

     

    2. So, the creation of the association for an example application, using .ldg and .sta extensions, a file type called myaccs and a program named ledger.exe would be created with the following commands:

    ASSOC .ldg=myaccs (capitals for clarity only)

    ASSOC .sta=myaccs (e.g. more than one extension can be associated to a file type)

    FTYPE myaccs= %SystemRoot%\Program Files\ledger.exe %1 (the path of the program that is opened)

     

    Now, when you double-click on a file with the .ldg or .sta extension, Windows will recognize it and launch ledger.exe.

     

    3. If you want to display all extensions and their associated file types, copy these following 4 lines into a cmd prompt:

    assoc >"%userprofile%\desktop\assoc.txt

    start notepad "%userprofile%\desktop\assoc.txt

    exit

    cls

     

    A .txt file is created on the Desktop and Notepad will open and display the list. The list represents the registry keys located in the merged HKEY_CLASSES_ROOT hive. In the left pane, look for the extension, for example .txt. The (Default) field in the right pane contains the file type, e.g. txtfile.

     

    4. Now display all file types and their associated programs by copying these 4 lines into a cmd prompt:

    ftype >"%userprofile%\desktop\ftype.txt

    start notepad "%userprofile%\desktop\ftype.txt

    exit

    cls

     

    Another .txt file is created and Notepad will open it. This list is generated from HKEY_CLASSES_ROOT, further down beyond the extensions. Look for the file type, for example txtfile, then click shell\open\command. In the right pane, the (Default) field shows the full path of the program that opens it, e.g. notepad.

     

    One thing to bear in mind is that the entries in HKEY_CURRENT_USER\Software\Classes take precedence over those in HKEY_LOCAL_MACHINE\Software\Classes.


    • Edited by BurrWalnut Sunday, November 20, 2011 7:06 PM
    Sunday, November 20, 2011 7:04 PM
  • Thanks very much. The HKR entries are simply populated from  HKCU and HKLM entries; does
    entries in HKEY_CURRENT_USER\Software\Classes take precedence over those in HKEY_LOCAL_MACHINE\Software\Classes
    mean that in the event of a conflict, HKR will show the HKCU values rather than the HKLM ones?
     
    Do you happen to know where the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{ext}\UserChoice data come from? I suspect the Explorer Open with dialogue, and I can see that Explorer has a handle on that key when a file is selected.
     

    Noel
    Monday, November 21, 2011 1:35 PM
  • Yes, HKEY_CLASSES_ROOT is just a merge of the HKLM and HKCU classes information.

     

    Don’t quote me, but I think it must display the HKCU preference for that user. I don’t use multiple accounts so have never had the need to check it.

     

    I agree with you regarding the ‘Open with’ because the terminology in the right-click and in the registry is the same, but the original entries must come from the operating system install as there is a huge number of them. Understandably, application installation will also make entries when one answers the question ‘Do you want to make XXXX the default program’.

     

    If you are thinking of carrying out any tests, I, and perhaps many other people here, would be grateful if you posted your findings in the forum. I used to have an old Microsoft Registry Guide, which may have shed some light on it but a house search yesterday didn’t find it.

     

    Good luck with the detective work.


    • Edited by BurrWalnut Monday, November 21, 2011 6:39 PM
    • Proposed as answer by zhen tan Friday, November 25, 2011 7:22 AM
    • Marked as answer by Arthur Xie Thursday, December 8, 2011 10:05 AM
    Monday, November 21, 2011 2:50 PM