Aracılığıyla paylaş


Export or Import Default Application Associations

When building an image, you can update the default programs associated with file name extensions or protocols.

To do this, create an app association file and import it into your images using DISM.

Generate a default app associations XML File

Deploy your Windows image to a test computer and configure the programs that are included in your image. You can log into Windows and use Control Panel to select your default app associations. You can export the default app associations that you have configured to an XML file on a network share or removable media so that you can import them into the WIM or VHD file before you deploy it to your destination computers.

Set default app associations

  1. Install your Windows image to a test computer. For more information about how to apply a Windows image, see Apply Images Using DISM.

  2. Start the test computer and complete Windows Setup.

  3. Open Settings. In Find a setting, search for and open Default apps.

  4. Configure default apps by file name extension or by app. For example, to set an installed photo viewing app as the default program that is used to open all of the file types and protocols that it supports, click Set defaults by app, select the photo viewing app > Manage, and then select the file types and associations for the app.

Export default app association settings

  1. On your test computer, open a Command Prompt as administrator.

  2. Export the default app association settings from the test computer to an .xml file on a network share or USB drive:

    Dism /Online /Export-DefaultAppAssociations:"F:\AppAssociations.xml"

Add or Remove Default Application Association Settings to a Windows Image

You can change the default app association settings in a WIM or VHD file before you deploy it to your destination computers. You can also add and remove default app association settings from an online image.

Import default app association settings

  1. On your technician computer, open a Command Prompt as administrator.

  2. Mount a Windows image from a WIM or VHD file:

    Dism /Mount-Image /ImageFile:C:\test\images\install.wim /Name:"Windows" /MountDir:C:\test\offline

  3. Import the .xml file that has the default app association settings to the Windows image:

    Dism.exe /Image:C:\test\offline /Import-DefaultAppAssociations:F:\AppAssociations.xml

Review the default app association setting in an image

  1. On your technician computer, open a Command Prompt administrator.

  2. List the app associations that have been applied to the mounted image:

    Dism.exe /Image:C:\test\offline /Get-DefaultAppAssociations

Remove default app association settings

  1. On your technician computer, open a Command Prompt as administrator.

  2. Remove the custom default app association that have been added to the mounted image:

    Dism.exe /Image:C:\test\offline /Remove-DefaultAppAssociations

Unmount the Windows image

  1. On your technician computer, open a Command Prompt as administrator.

  2. Unmount the image, committing changes:

    Dism /Unmount-Image /MountDir:C:\test\images\install.wim /commit

Tips

Tip 1

  • Refresh this file with each major version. Some recommended apps can manage more extensions with each new Windows 10 version available. It's a good practice to refresh your XML. For example, in Windows 10, version 1703, Microsoft Edge registers the epub extension. If you're using an XML file from Windows 10, version 1607, epub is missing. As a result, you will get an An app default was reset notification for epub.

  • Manually editing the file: Don't just delete app associations you're not interested in. Otherwise on the first boot, the missing entries may trigger a flurry of notifications on the first boot saying "An app default was reset".

    To prevent notifications, you can import multiple app association files. For example, you can import one file that includes all of the current Windows version's associations, and import your own separate file that includes a set of custom associations that you maintain one at a time.

    1. From a new test computer, export a file that just includes the default file associations, for example, F:\1809-DefaultAppAssociations.xml.
    2. Modify your app associations as before, and export the file again. Use a text/XML editor to modify just the associations you're interested in, for example, F:\InternetExplorerAssociations.xml.
    3. Importing xml only handles the last file imported. Results are not cumulative if you import multiple files. If you have multiple files with different content, merge those files manually, removing any duplicates, and then import the single file.

Tip 2

If the XML information is exported from a brand-new reference machine, the resulting XML file may be truncated until the delay-install apps have fully installed on the system. There are a few options to ensure a complete list:

  1. Wait to export until the Apps have a chance to completely install. It typically requires 10-30 minutes.
  2. Test default apps like Groove, Photos, Paint 3D by opening the app on the reference machine.
  3. Run dism /online /get-defaultappassociations >> test.xml in command prompt with administrator permission before modifying any defaults. After exporting defaults, compare the results with xml file to ensure the entries in the exported file include the entries from /get-defaultappassociations.

Tip 3

If a device has only one application that can handle a specific association, that application will appear as the default for that type, even though there is no explicit choice in the registry. Exporting the default applications to XML will not gather these implied settings. To change the application from implied to explicit on the reference machine, just select that program for that association. Once selected (or reselected for implied associations), that choice will be written to the registry and then available for export.

Tip 4

On upgrade, Windows may re-assign default handlers for some inbox applications specified in your xml file. For instance, if you have set up applications that were previously recommended in Windows 7, Windows 8, or Windows 8.1, they may be changed in later versions of Windows according to ApplyOnUpgrade and overwriteIfProgIdIs in OEMDefaultAssociations.xml, or due to applications from previous versions of Windows going out of support.