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 http://technet.microsoft.com/en-us/library/hh824855.aspx.