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:
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:
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”:
to instead use Windows Media Player:
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:
The resulting XML file has one line for each association:
And you can import them the same way:
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:
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:
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):
(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:
Then the next two steps are configured with appropriate conditions:
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 https://technet.microsoft.com/en-us/library/hh824855.aspx.
- Anonymous
January 01, 2003
excelent post :) - Anonymous
January 01, 2003
Thanks! - Anonymous
January 01, 2003
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. - Anonymous
January 01, 2003
I haven't tried it, but my guess is that it won't work in Windows PE. - Anonymous
January 01, 2003
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. ) - Anonymous
January 01, 2003
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! - Anonymous
January 01, 2003
Great post, thank you for explaining! - Anonymous
January 09, 2014
Pingback from Blog Post: Configuring file associations in Win... - Anonymous
January 15, 2014
Thanks Michael for this useful post :-) - Anonymous
January 21, 2014
Hi Michael, Great blog post! I have a question on the IsTouchEnabled.exe utility. Will this work within WindowsPE by any chance? - Anonymous
February 27, 2014
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? - Anonymous
March 12, 2014
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 - Anonymous
March 23, 2014
How did you get to the first page you displayed? I don't see a "navigating" key on this keyboard. - Anonymous
February 07, 2015
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. - Anonymous
July 15, 2015
The comment has been removed - Anonymous
August 20, 2015
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.