--- title: Custom XML Examples description: Use custom XML examples to learn how to migrate an unsupported application, migrate files and registry keys, and migrate the Videos folder. ms.reviewer: kevinmi,warrenw manager: aaroncz ms.author: frankroj ms.service: windows-client author: frankroj ms.topic: article ms.subservice: itpro-deploy ms.date: 01/09/2024 appliesto: - ✅ Windows 11 - ✅ Windows 10 --- # Custom XML Examples ## Example 1: Migrating an unsupported application The following template is a template for the sections that are needed to migrate applications. The template isn't functional on its own, but it can be used to write custom **.xml** file. **Template**
Expand to show Example 1 application template: ```xml Some Application value MigXMLHelper.DoesObjectExist("Registry","HKLM\Software\MyApp [win32_version]") MigXMLHelper.DoesFileVersionMatch("%MyAppExePath%","ProductVersion","8.*") MigXMLHelper.DoesFileVersionMatch("%MyAppExePath%","ProductVersion","9.*") HKCU\Software\MyApp\Toolbar\* [*] HKCU\Software\MyApp\ListView\* [*] HKCU\Software\MyApp [ShowTips] HKCU\Software\MyApp\Toolbar\* [*] HKCU\Software\MyApp\ListView\* [*] HKCU\Software\MyApp [ShowTips] HKCU\Software\MyApp [Display] ```
## Example 2: Migrating the My Videos folder The following sample is a custom **.xml** file named `CustomFile.xml` that migrates the **Videos** folder for all users, if the folder exists on the source computer. - **Sample condition**: Verifies that the **Videos** folder exists on the source computer: `MigXmlHelper.DoesObjectExist("File","%CSIDL_MYVIDEO%")` - **Sample filter**: Filters out the shortcuts in the **Videos** folder that don't resolve on the destination computer: `` This filter has no effect on files that aren't shortcuts. For example, if there's a shortcut in the **Videos** folder on the source computer that points to `C:\Folder1`, that shortcut is migrated only if `C:\Folder1` exists on the destination computer. However, all other files, such as **.mp3** files, migrate without any filtering. - **Sample pattern**: Migrates the **Videos** folder for all users: `%CSIDL_MYVIDEO%* [*]` **XML file**
Expand to show Example 2 XML file: ```xml My Video MigXmlHelper.DoesObjectExist("File","%CSIDL_MYVIDEO%") %CSIDL_MYVIDEO%\* [*] ```
## Example 3: Migrating files and registry keys The sample patterns describe the behavior in the following example **.xml** file. - **Sample pattern**: Migrates all instances of the file `Usmttestfile.txt` from all subdirectories under `%ProgramFiles%\USMTTestFolder`: `%ProgramFiles%\USMTTestFolder* [USMTTestFile.txt]` - **Sample pattern**: Migrates the whole directory under `%ProgramFiles%\USMTDIRTestFolder`: `%ProgramFiles%\USMTDIRTestFolder* []` - **Sample pattern**: Migrates all instances of MyKey under `HKCU\Software\USMTTESTKEY`: `HKCU\Software\USMTTESTKEY* [MyKey]` - **Sample pattern**: Migrates the entire registry hive under `HKLM\Software\USMTTESTKEY`: `HKLM\Software\USMTTESTKEY* []` **XML file**
Expand to show Example 3 XML file: ```xml File Migration Test %ProgramFiles%\USMTTestFolder\* [USMTTestFile.txt] %ProgramFiles%\USMTDIRTestFolder\* [*] Registry Migration Test HKCU\Software\USMTTESTKEY\* [MyKey] HKLM\Software\USMTTESTKEY\* [*] ```
## Example 4: Migrating specific folders from various locations The behavior for this custom **.xml** file is described within the `` tags in the code. **XML file**
Expand to show Example 4 XML file: ```xml Component to migrate all Engineering Drafts subfolders without documents in this folder C:\EngineeringDrafts\* [*] C:\EngineeringDrafts\ [*] Component to migrate all user documents except Sample.doc C:\UserDocuments\* [*] C:\UserDocuments\ [Sample.doc] Component to migrate all Requests folders on any drive on the computer Component to migrate all Presentations folder from any location on the C: drive C:\*\Presentations\* [*] C:\Presentations\* [*] ```
## Related articles - [USMT XML reference](usmt-xml-reference.md). - [Customize USMT XML files](usmt-customize-xml-files.md).