Configuring file associations in Windows 8.1


When you are using Windows 8.1 (or Windows 8, which behaves the same way), you may notice that some file types (mapped by file extension) are opened by modern apps while others may be opened by desktop apps.  If you are a tablet user, you may not want the desktop apps; if you are a laptop or desktop user without a touch screen, you may not want the modern apps.

Fortunately, you can configure these mappings fairly easily through the PC Settings application by navigating to “Search and Apps” then “Defaults”, then click the “Choose default apps by file type” link at the bottom of the page to get to the full list of file extensions:

image

In this particular example, the .PDF extension is mapped to the modern Reader app, but if you click on the Reader icon you can choose from available apps:

image

For a desktop or non-touch laptop, you might want to choose Adobe Reader instead.  And you might make similar changes for MP3 and MP4 files, changing them from the default of “Music” and “Video”:

image

to instead use Windows Media Player:

image

You get the point:  Go through each mapping and select desktop apps for non-touch machines, modern apps for tablets and other touch-enabled computers.  (You likely won’t be able to completely make the switch from modern to desktop apps, as there are more file types supported by the newer modern apps.  But you can get close.)

Obviously configuring all of those app mappings by hand isn’t something you want to do on thousands of machines.  With previous OS releases, you needed to poke in the necessary registry entries (or carefully install apps in the correct order) to get the mappings you wanted – it worked, but it wasn’t much fun.  Starting with Windows 8, there is an easier way to do this using DISM.EXE.  Configure the mappings by hand once, then export them:

image

The resulting XML file has one line for each association:

image

And you can import them the same way:

image

So imagine that you need to support both touch (tablet and laptop) and non-touch systems in your environment.  You can set up a step in a deployment task sequence that conditionally imports the appropriate file mappings:

image

The real key here is how to make those steps conditional.  That part is a little trickier.  Fortunately, MDT 2013 (and MDT 2012 Update 1) includes an executable, IsTouchEnabled.exe, that will help.  You can add it into the task sequence to set a variable that can then be used as a condition in a subsequent step.  The end result is something that looks like this:

image

The first step runs IsTouchEnabled.exe and is set to continue on error (because it reports a return code of 1 if touch is enabled):

image

(Make sure you click the “Continue on error” checkbox on the Options tab.)  The next step then sets an IsTouchEnabled task sequence variable only if the previous step sets a return code of 1:

image

image

Then the next two steps are configured with appropriate conditions:

image

image

As always, a few notes:

  • When DISM imports these file associations, it modified the default user profile.  So any users (e.g. the local Administrator account) that already existed before the DISM command was executed will continue to have the associations that were in the OS image.
  • Why does MDT include the IsTouchEnabled executable but doesn’t use it by default?  Well, it does actually use it, but only in UDI scenarios.  This is actually a .NET application that asks Windows if it supports digitizers (by calling the GetSystemMetrics API).
  • Why not have ZTIGather set a variable using the same executable?  Then I’d have to write a script 🙂  That’s overkill in this particular case, but feel free to do it if you like neat-and-tidy.
  • What happens if an app you specified isn’t present?  Not sure, try it out yourself 🙂

You can read more about these DISM command line options at http://technet.microsoft.com/en-us/library/hh824855.aspx.

Comments (17)
  1. Anonymous says:

    excelent post 🙂

  2. Andreas Lemarcq says:

    Thanks!

  3. Michael Niehaus says:

    The question is whether the GetSystemMetricsEx API call behaves the same in Windows PE – I haven’t tried that myself to see, as I don’t typically have .NET Framework in Windows PE.

  4. Michael Niehaus says:

    I haven’t tried it, but my guess is that it won’t work in Windows PE.

  5. Kamikaze-Steve says:

    I used this to try to modify the association of .PDF from Adobe Reader to Foxit Reader and .LOG from Notepad to CMTrace. I also added an association for a mailto: URL to point to Outlook. The mailto change worked, but the other two associations didn’t
    change. Here’s what the XML looks like:

    Any suggestions?
    (BTW, that’s how Foxit registers itself. )

  6. Kamikaze-Steve says:

    Ignore my question. I found 2 things. 1, you can’t post XML in a question. 🙂 and 2, you have to set the policy to import the associations. http://blogs.technet.com/b/mrmlcgn/archive/2013/02/26/windows-8-associate-a-file-type-or-protocol-with-a-specific-app-using-a-gpo-e-g-default-mail-client-for-mailto-protocol.aspx
    Thanks!

  7. Hollanders Rens says:

    Great post, thank you for explaining!

  8. Anonymous says:

    Pingback from Blog Post: Configuring file associations in Win…

  9. Haecki says:

    Thanks Michael for this useful post 🙂

  10. Dustin Hedges says:

    Hi Michael, Great blog post! I have a question on the IsTouchEnabled.exe utility. Will this work within WindowsPE by any chance?

  11. Anon1 says:

    I can use touch on touch-enabled laptops when in WinPE based on Win8 Kernel. Why would isTouchEnabled.exe not return the exact same exitcode as it does under Full OS? Is the object that isTouchEnabled.exe enumerates under WinPE not the same as when in Full OS?

  12. Pierre says:

    Hello
    I want to save doc, docx, xls, xlsx associations, I don’t see them in the file on your article. Is it a way to do this ?

    Thanks

  13. tom says:

    How did you get to the first page you displayed? I don’t see a “navigating” key on this keyboard.

  14. csmeeton says:

    Can you help me? I have a Dell Inspiron 3147 touchscreen PC running Windows 8.1 and I’d like to email photos without having to attach them manually. Every time I press "send to" from a photo, I get an error msg indicating that I don’t have a default mail
    program installed, which I do=Windows Mail App. So, why won’t the Windows Mail App automatically send out my photos? I have it set as my default mail program.

  15. MikZ says:

    Nice, but it’d be helpful if those complicated commands were text instead of images, so we can copy and paste them (assuming the clipboard has survived the Windows dumbing-down razor gang).

  16. Karl says:

    by the way this does not work if you don’t set the copyprofile=true option when you deploy with mdt or sccm. i tried both with no luck. in fact, to get the file associations set for each new user that logs on you have to run this every time a user logs
    on for the first time. maybe someone else has a solution, since i have been advised not to set the copyprofile=true.

  17. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kepulauan%20Riau
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Maluku
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Maluku%20Utara
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Nusa%20Tenggara%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Nusa%20Tenggara%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sulawesi%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sulawesi%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sulawesi%20Tengah
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sulawesi%20Tenggara
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sulawesi%20Utara
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sumatera%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sumatera%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sumatera%20Utara
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Antar%20Daerah
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Artha%20Graha%20Internasional
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Bukopin
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Bumi%20Arta
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20ICB%20Bumiputera%20Indonesia
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Ekononomi%20Raharja
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Ganesha
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Hana
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Himpunan%20Saudara%201906
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20ICBC%20Indonesia
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Index%20Selindo
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20SBI%20Indonesia
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Internasional%20Indonesia

Comments are closed.