@echo off

::------------------------------------------------------------------------------
:: MSMG 工具箱 v11.8
:: 版权所有 (c) 2013-2021 MSMG。保留所有权利。
::------------------------------------------------------------------------------
::
:: 贡  献  者： CREDITS.TXT
:: 许      可： LICENSE.TXT
:: 第三方许可： <Bin\LICENSES>
::
::-------------------------------------------------------------------------------------------

color 1f
title MSMG 工具箱 v11.8

reg add "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v "ScreenBufferSize" /t REG_DWORD /d "0x23290050" /f >nul
reg add "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /v "WindowSize" /t REG_DWORD /d "0x190050" /f >nul

setlocal EnableExtensions EnableDelayedExpansion

:: 设置工具箱环境路径变量
set "Bin=%~dp0Bin"
set "Custom=%~dp0Custom"
set "Drivers=%~dp0Drivers"
set "DVD=%~dp0DVD"
set "ISO=%~dp0ISO"
set "Logs=%~dp0Logs"
set "Mount=%~dp0Mount"
set "Packs=%~dp0Packs"
set "ROOT=%~dp0"
set "Temp=%~dp0Temp"
set "Updates=%~dp0Updates"
set "WHD=%~dp0WHD"

:: 设置主机操作系统版本、体系结构和语言变量
set HostArchitecture=
set HostBuild=
set HostBuildBranch=
set HostDisplayVersion=
set HostEdition=
set HostInstallationType=
set HostLanguage=
set HostOSName=
set HostServicePackBuild=
set HostVersion=

If exist "%WinDir%\SysWOW64" set "HostArchitecture=x64"
If not exist "%WinDir%\SysWOW64" set "HostArchitecture=x86"
for /f "tokens=3 delims= " %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild" ^| find "REG_SZ"') do (set /a HostBuild=%%i)
for /f "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "BuildBranch" ^| find "REG_SZ"') do (set HostBuildBranch=%%j)
for /f "tokens=3 delims= " %%k in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "DisplayVersion" ^| find "REG_SZ"') do (set HostDisplayVersion=%%k)
for /f "tokens=3 delims= " %%l in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "EditionID" ^| find "REG_SZ"') do (set HostEdition=%%l)
for /f "tokens=3 delims= " %%m in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "InstallationType" ^| find "REG_SZ"') do (set HostInstallationType=%%m)
for /f "tokens=6 delims= " %%o in ('DISM /Online /English /Get-Intl ^| findstr /i /C:"Default system UI language"') do (set HostLanguage=%%o)
for /f "tokens=3*" %%p in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" ^| find "ProductName"') do (set HostOSName=%%p %%q)
for /f "tokens=3 delims= " %%r in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "UBR" ^| find "REG_DWORD"') do (set /a HostServicePackBuild=%%r)
for /f "tokens=4-5 delims=. " %%s in ('ver 2^>nul') do set "HostVersion=%%s.%%t"

:: 设置 WADK 工具环境路径变量
if "%HostVersion%" equ "6.1" set "DISM=%Bin%\%HostArchitecture%\DISM81\Dism.exe"
if "%HostVersion%" neq "6.1" set "DISM=%Bin%\%HostArchitecture%\DISM10\Dism.exe"
set "DismScratch=%Temp%\DISM"
set "DismFormat=/English /ScratchDir:%DismScratch% /LogPath:%Logs%\Dism.txt /LogLevel:3 /NoRestart"
set "Imagex=%Bin%\%HostArchitecture%\imagex.exe"
set "Oscdimg=%Bin%\%HostArchitecture%\oscdimg.exe"
set "Dvdburn=%Bin%\dvdburn.exe"
set "WimConfigFile=%Bin%\wimscript.ini"

:: 设置源操作系统变量
set SelectedSourceOS=
set OSID=
set "BootWim=%DVD%\sources\boot.wim"
set "InstallWim=%DVD%\sources\install.wim"
set "InstallEsd=%DVD%\sources\install.esd"
set "WinReWim=Windows\System32\Recovery\winre.wim"
set "BootMount=%Mount%\Boot"
set "InstallMount=%Mount%\Install"
set "WinReMount=%Mount%\WinRE"

:: 设置源映像信息变量
set ImageCount=
set ImageIndexNo=
set ImageArchitecture=
set ImageName=
set ImageDescription=
set ImageFlag=
set ImageEdition=
set ImageInstallationType=
set ImageDefaultLanguage=
set ImageMajorVersion=
set ImageMinorVersion=
set ImageBuild=
set ImageVersion=
set ImageServicePackBuild=
set ImageServicePackLevel=
set PackageBuild=
set PackageVersion=
set PackageServicePackBuild=
set DefaultIndexNo=

:: 设置工具箱的控制标识变量
set "IsSourceSelected=No"
set "IsBootImageSelected=No"
set "IsRecoveryImageSelected=No"
set "IsDialogsEnabled=Yes"
set "IsLogsEnabled=Yes"
set "IsImageRegistryLoaded=No"
set "IsW7SP1CRUSelected=No"

set "PreActTokens=%Custom%\ActivationTokens"
set "CustomFiles=%Custom%\Files"
set "CustomFonts=%Custom%\Fonts"
set "CustomRecoveryImage=%Custom%\RecoveryImage"
set "CustomRegistry=%Custom%\Registry"
set "CustomTerminalServer=%Custom%\TerminalServer"
set "CustomUxTheme=%Custom%\UxTheme"

:: 设置工具箱的包环境路径变量
set "Apps=%Packs%\Apps"
set "Braille=%Packs%\Braille"
set "DaRT=%Packs%\DaRT"
set "Dedup=%Packs%\Dedup"
set "DirectX9c=%Packs%\DirectX9c"
set "EdgeClassic=%Packs%\EdgeBrowser"
set "EdgeChromium=%Packs%\EdgeChromium"
set "Games=%Packs%\Games"
set "IE11=%Packs%\IE11"
set "LanguagePacks=%Packs%\LanguagePacks"
set "MediaFeaturePack=%Packs%\MediaFeaturePack"
set "MMRC=%Packs%\MultimediaRestrictedCodecs"
set "NetFx35=%Packs%\NetFX35"
set "NetFx462=%Packs%\NetFX462"
set "NetFx48=%Packs%\NetFX48"
set "NET5=%Packs%\NET5"
set "OfficeUWP=%Packs%\OfficeUWP"
set "OpenSSH=%Packs%\OpenSSH"
set "PortableDevices=%Packs%\PortableDevices"
set "PowerShell7=%Packs%\PowerShell7"
set "RDP81=%Packs%\RDP81"
set "RSAT=%Packs%\RSAT"
set "Sidebar=%Packs%\Sidebar"
set "Skins=%Packs%\Skins"
set "SystemRestore=%Packs%\SystemRestore"
set "ThinPC=%Packs%\ThinPC"
set "UAP=%Packs%\UAP"
set "VCRuntime=%Packs%\VCRuntime"
set "Win32Calc=%Packs%\Win32Calc"
set "WinToGo=%Packs%\WinToGo"
set "WMF=%Packs%\WMF"
set "WMR=%Packs%\WMR"
set "WSL=%Packs%\WSL"

:: 设置工具箱的依赖工具环境路径变量
set "Lists=%Bin%\Lists"
set "Patches=%Bin%\Patches"
set "ResourceHacker=%Bin%\ResourceHacker.exe"
set "ToolKitHelper=%Bin%\ToolKitHelper.exe"
set "W10EsdDecrypter=%Bin%\Dism++CUI.exe /ESDFile"
set "W81EsdDecrypter=%Bin%\esddecrypt.exe"
set "WimlibImagex=%Bin%\%HostArchitecture%\wimlib-imagex.exe"
set "XCopy=xcopy.exe /E /I /H /R /Y /J"
set "XMLs=%Bin%\XMLs"
set "W7ESU=%Bin%\Patches\W7ESU"
set "W10CUFix=%Bin%\Patches\W10CUFix"
set "WMCGActTokens=%Bin%\Patches\WMCGActTokens.tpk"
set "PSFExtractor=%Bin%\PSFExtractor.exe"
set "Zip=%Bin%\%HostArchitecture%\7z.exe"

:: 设置组件状态标识
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_SnippingTool,C_SpeechRecognition,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WinSAT,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_RemoteAssistance,C_DeviceLockdown,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_ManualSetup,C_Paint,C_SecurityCenter,C_StepsRecorder,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_EdgeDevToolsClient,C_Edge,C_FileExplorer,C_LockApp,C_MapControl,C_NarratorQuickStart,C_OneDrive,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SecureAssessmentBrowser,C_SettingSync,C_SkypeORTC,C_SmartScreen,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreClient,C_XboxClient,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingWeather,C_BingNews,C_Calculator,C_Camera,C_ClientWebExperience,C_CommunicationsApps,C_DesktopAppInstaller,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Notepad,C_Paint3D,C_People,C_Photos,C_Print3D,C_ServicesStoreEngagement,C_PowerAutomateDesktop,C_ScreenSketch,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_VP9VideoExtensions,C_WalletService,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStoreApp,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	set "%%i=+"
)

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 最终用户许可协议
::-------------------------------------------------------------------------------------------
cls

echo.===============================================================================
echo.##################### MSMG 工具箱 - 最终用户许可协议 ##########################
echo.===============================================================================
echo.
echo.
echo. MSMG 工具箱基本上是一个集维护、自定义定制、添加或删除功能和组件、启用或者禁
echo. 用 Windows 操作系统中的功能的工具。
echo.
echo.
echo. MSMG 工具箱仅限用于已通过许可的 Microsoft Windows 操作系统。
echo.
echo.
echo. 此 MSMG 工具箱“按原样”提供，并且不作任何明示或暗示性的保证。在任何情况之下，
echo. 作者均不会对因为使用此脚本工具而导致可能的任何破坏承担责任。
echo.
echo.
echo. MSMG 工具箱将会使用各类第三方工具来完成其中的一部分任务。
echo.
echo.
echo. MSMG 工具箱、Windows 均为其各自公司或作者的注册商标。
echo.
echo.
echo.
echo.===============================================================================
choice /C:AR /N /M "########################[ 按‘A’同意 / 按‘R’拒绝 ]#########################"
if errorlevel 2 (
	reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

	color 00
	endlocal EnableExtensions EnableDelayedExpansion

	exit
)

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 启动模组
::-------------------------------------------------------------------------------------------
cls

echo.
echo.正在执行工具箱预清理操作，请稍候……
call :Cleanup >nul
cls
echo.===============================================================================
echo.                              MSMG 工具箱 - 启动
echo.===============================================================================
echo.
echo.正在读取主机操作系统信息……
echo.
echo.%HostOSName% ^(%HostBuildBranch%^) %HostDisplayVersion% ^(v%HostVersion%.%HostBuild%.%HostServicePackBuild%^) %HostArchitecture% %HostLanguage%

:: 设置 DOS 字符代码页
if "%HostLanguage%" equ "en-GB" chcp 437 >nul
if "%HostLanguage%" equ "en-US" chcp 437 >nul
if "%HostLanguage%" equ "zh-CN" chcp 936 >nul

echo.
echo.正在设置工具箱和 WADK 工具环境路径变量……
echo.
echo.DISM.exe           =  %DISM%
call :CreateFolder "%DismScratch%"
set "DISM=%DISM% %DismFormat%"
echo.Imagex.exe         =  %Imagex%
echo.Oscdimg.exe        =  %Oscdimg%
echo.Dvdburn.exe        =  %Dvdburn%
echo.7zip.exe           =  %Zip%
echo.Dism++CUI.exe      =  %W10EsdDecrypter%
echo.EsdDecrypt.exe     =  %W81EsdDecrypter%
echo.ToolKitHelper.exe  =  %ToolKitHelper%
echo.ResourceHacker.exe =  %ResourceHacker%
echo.WimlibImagex.exe   =  %WimlibImagex%
echo.
echo.===============================================================================
echo.
pause
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 主菜单
::-------------------------------------------------------------------------------------------
:MainMenu

cls
echo.===============================================================================
echo.                          MSMG 工具箱 - 主  菜  单
echo.===============================================================================
echo.
echo.                             [1]   源  文  件
echo.
echo.                             [2]   集      成
echo.
echo.                             [3]   移      除
echo.
echo.                             [4]   自定义定制
echo.
echo.                             [5]   应      用
echo.
echo.                             [6]   目      标
echo.
echo.                             [7]   工      具
echo.
echo.
echo.                             [X]   退      出
echo.
echo.===============================================================================
echo.
choice /C:1234567X /N /M "请输入你的选项 ："
if errorlevel 8 goto :Quit
if errorlevel 7 goto :ToolsMenu
if errorlevel 6 goto :TargetMenu
if errorlevel 5 goto :ApplyMenu
if errorlevel 4 goto :CustomizeMenu
if errorlevel 3 goto :RemoveMenu
if errorlevel 2 goto :IntegrateMenu
if errorlevel 1 goto :SourceMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 选择源文件菜单
::-------------------------------------------------------------------------------------------
:SourceMenu

cls
echo.===============================================================================
echo.                          MSMG 工具箱 - 源文件菜单
echo.===============================================================================
echo.

:: 检查源操作系统是否已选择
if "%IsSourceSelected%" equ "Yes" (
	echo.源操作系统已被选择……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   从 ^<DVD^> 文件夹中选择源文件
echo.
echo.  [2]   从 DVD 驱动器中复制源文件
echo.
echo.  [3]   从 DVD ISO 镜像中解压源文件
echo.
echo.  [4]   从 OEM IMG 映像中解压源文件
echo.
echo.  [5]   从应用商店 ESD 映像中解压源文件
echo.
echo.  [6]   从 Media Creation Tool 映像中解压源文件
echo.
echo.  [7]   从自定义 Windows ESD 映像中解压源文件
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:1234567X /N /M "请输入你的选项 ："
if errorlevel 8 goto :MainMenu
if errorlevel 7 goto :ExtractSourceESD
if errorlevel 6 goto :ExtractSourceMCT
if errorlevel 5 goto :ExtractSourceStoreESD
if errorlevel 4 goto :ExtractSourceIMG
if errorlevel 3 goto :ExtractSourceISO
if errorlevel 2 goto :CopySourceDVD
if errorlevel 1 goto :SelectSourceDVD
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 集成菜单
::-------------------------------------------------------------------------------------------
:IntegrateMenu

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 集成菜单
echo.===============================================================================
echo.
:: 检查源操作系统是否已选择
if "%IsSourceSelected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   Windows 语言包
echo.
echo.  [2]   Windows 驱动
echo.
echo.  [3]   Windows 功能
echo.
echo.  [4]   Windows 更新
echo.
echo.  [5]   Windows 自定义功能
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:12345X /N /M "请输入你的选项 ："
if errorlevel 6 goto :MainMenu
if errorlevel 5 goto :IntCustomFeaturesMenu
if errorlevel 4 goto :IntUpdatesMenu
if errorlevel 3 goto :IntFeaturesMenu
if errorlevel 2 goto :IntDriversMenu
if errorlevel 1 goto :IntLanguagePacksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 集成 Windows 功能菜单
::-------------------------------------------------------------------------------------------
:IntFeaturesMenu

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成 Windows 功能菜单
echo.===============================================================================

:: 检查所选择的源操作系统是否是 Windows 7 客户端/Embedded
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" neq "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   远程桌面协议 ^(RDP^) 8.0 和 8.1
	echo.  [F]   Windows 媒体功能包
	echo.  [G]   Windows Management Framework ^(WMF^) 5.1 ^| 依赖于 .NET Framework 4.8
	echo.  [H]   Windows PowerShell 7 ^| 依赖于 Windows Management Framework 5.1
	echo.  [I]   Windows Thin PC 附加功能
	echo.  [J]   远程服务器管理工具 ^(RSAT^)
	echo.  [K]   Microsoft DaRT 7.0 工具集
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft 游戏
	echo.  [N]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNX /N /M "请输入你的选项 ："
	if errorlevel 15 goto :IntegrateMenu
	if errorlevel 14 goto :IntVCRuntime
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntThinPcPkgs
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntWMF
	if errorlevel 6  goto :IntMediaFeaturePack
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: 检查所选择的源操作系统是否是 Windows Server 2008 R2 Core/非 Core 版本
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" if "%ImageInstallationType%" neq "Embedded" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   远程桌面协议 ^(RDP^) 8.0 和 8.1
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1 ^| 依赖于 .NET Framework 4.8
	echo.  [G]   Windows PowerShell 7 ^| 依赖于 Windows Management Framework 5.1
	echo.  [H]   Windows 系统恢复
	echo.  [I]   Microsoft DaRT 7.0 工具集
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft 游戏
	echo.  [L]   Windows 边栏
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "请输入你的选项 ："
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntSidebar
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntSystemRestore
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: 检查所选择的源操作系统是否是 Windows 8.1 RT（ARM）
if "%SelectedSourceOS%" equ "w81" if "%ImageArchitecture%" equ "arm" (
	echo.
	echo.  [1]   Microsoft .NET Framework 4.8
	echo.
	echo.  [2]   Microsoft 默认内置应用
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :IntegrateMenu
	if errorlevel 2 goto :IntInboxApps
	if errorlevel 1 goto :IntNetFX48
)

:: 检查所选择的源操作系统是否是 Windows 8.1 客户端版本
if "%SelectedSourceOS%" equ "w81" if "%ImageArchitecture%" neq "arm" if "%ImageInstallationType:~,6%" neq "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Windows 重复数据删除
	echo.  [F]   Windows To Go 工作区
	echo.  [G]   Windows 媒体功能包
	echo.  [H]   Microsoft 默认内置应用
	echo.  [I]   Windows Management Framework ^(WMF^) 5.1
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   远程服务器管理工具 ^(RSAT^)
	echo.  [L]   Microsoft DaRT 8.1 工具集
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft 游戏
	echo.  [O]   Windows 边栏
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "请输入你的选项 ："
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWMF
	if errorlevel 8  goto :IntInboxApps
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntDedup
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Core/非 Core 版本
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" neq "Client" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Microsoft 默认内置应用
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1
	echo.  [G]   Windows PowerShell 7
	echo.  [H]   Microsoft DaRT 8.1 工具集
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft 游戏
	echo.  [K]   Windows 边栏
	echo.  [L]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLX /N /M "请输入你的选项 ："
	if errorlevel 13 goto :IntegrateMenu
	if errorlevel 12 goto :IntVCRuntime
	if errorlevel 11 goto :IntSidebar
	if errorlevel 10 goto :IntGames
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntInboxApps
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1507 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageInstallationType%" equ "Client" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft Edge 经典浏览器
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Microsoft Win32 计算器
	echo.  [F]   Windows To Go 工作区
	echo.  [G]   Windows 媒体功能包
	echo.  [H]   Windows PowerShell 7
	echo.  [I]   远程服务器管理工具 ^(RSAT^)
	echo.  [J]   Microsoft 默认内置应用
	echo.  [K]   Microsoft DaRT 10.0 工具集
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft 游戏
	echo.  [N]   Windows 边栏 ^| 依赖于：Windows 邮件应用
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOX /N /M "请输入你的选项 ："
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntInboxApps
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1511 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft Edge Chromium 浏览器
	echo.  [D]   Microsoft Win32 计算器
	echo.  [E]   Windows 重复数据删除
	echo.  [F]   Windows To Go 工作区
	echo.  [G]   Windows 媒体功能包
	echo.  [H]   Windows PowerShell 7
	echo.  [I]   远程服务器管理工具 ^(RSAT^)
	echo.  [J]   Microsoft 默认内置应用
	echo.  [K]   Microsoft DaRT 10.0 工具集
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft 游戏
	echo.  [N]   Windows 边栏
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOX /N /M "请输入你的选项 ："
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntInboxApps
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntDedup
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1607 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge 经典浏览器
	echo.  [E]   Microsoft Edge Chromium 浏览器
	echo.  [F]   Microsoft Win32 计算器
	echo.  [G]   Windows 重复数据删除
	echo.  [H]   Windows To Go 工作区
	echo.  [I]   Windows 媒体功能包
	echo.  [J]   Windows Multimedia Restricted Codecs
	echo.  [K]   Windows PowerShell 7
	echo.  [L]   远程服务器管理工具 ^(RSAT^)
	echo.  [M]   Microsoft 默认内置应用
	echo.  [N]   Microsoft DaRT 10.0 工具集
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft 游戏
	echo.  [Q]   Windows 边栏
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "请输入你的选项 ："
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntInboxApps
	if errorlevel 12 goto :IntRSAT
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntMMRC
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1703 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Microsoft Win32 计算器
	echo.  [F]   Windows 盲文辅助功能
	echo.  [G]   Windows 重复数据删除
	echo.  [H]   Windows To Go 工作区
	echo.  [I]   Windows 媒体功能包
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   远程服务器管理工具 ^(RSAT^)
	echo.  [L]   Microsoft 默认内置应用
	echo.  [M]   Microsoft DaRT 10.0 工具集
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft 游戏
	echo.  [P]   Windows 边栏
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "请输入你的选项 ："
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntInboxApps
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1709 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType%" equ "Client" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Microsoft Win32 计算器
	echo.  [F]   Windows 盲文辅助功能
	echo.  [G]   Windows 重复数据删除
	echo.  [H]   Windows To Go 工作区
	echo.  [I]   Windows 媒体功能包
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   远程服务器管理工具 ^(RSAT^)
	echo.  [L]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [M]   Microsoft 默认内置应用
	echo.  [N]   Microsoft DaRT 10.0 工具集
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft 游戏
	echo.  [Q]   Windows 边栏
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "请输入你的选项 ："
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntInboxApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1803 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Microsoft Win32 计算器
	echo.  [F]   Windows 盲文辅助功能
	echo.  [G]   Windows 重复数据删除
	echo.  [H]   Windows To Go 工作区
	echo.  [I]   Windows 媒体功能包
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   远程服务器管理工具 ^(RSAT^)
	echo.  [L]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [M]   Microsoft 默认内置应用
	echo.  [N]   Microsoft Office 桌面 UWP 应用
	echo.  [O]   Microsoft DaRT 10.0 工具集
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft 游戏
	echo.  [R]   Windows 边栏
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "请输入你的选项 ："
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOfficeUWPApps
	if errorlevel 13 goto :IntInboxApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1809 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge 经典浏览器
	echo.  [E]   Microsoft Edge Chromium 浏览器
	echo.  [F]   Microsoft Win32 计算器
	echo.  [G]   Windows 盲文辅助功能
	echo.  [H]   Windows 重复数据删除
	echo.  [I]   Windows To Go 工作区
	echo.  [J]   Windows 媒体功能包
	echo.  [K]   Windows 混合现实
	echo.  [L]   Windows Multimedia Restricted Codecs
	echo.  [M]   Windows 便携设备
	echo.  [N]   Windows PowerShell 7
	echo.  [O]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [P]   Microsoft 默认内置应用
	echo.  [Q]   Microsoft Office 桌面 UWP 应用
	echo.  [R]   Microsoft DaRT 10.0 工具集
	echo.  [S]   Microsoft DirectX 9.0c
	echo.  [T]   Microsoft 游戏
	echo.  [U]   Windows 边栏
	echo.  [V]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUVX /N /M "请输入你的选项 ："
	if errorlevel 23 goto :IntegrateMenu
	if errorlevel 22 goto :IntVCRuntime
	if errorlevel 21 goto :IntSidebar
	if errorlevel 20 goto :IntGames
	if errorlevel 19 goto :IntDirectX9c
	if errorlevel 18 goto :IntDaRT
	if errorlevel 17 goto :IntOfficeUWPApps
	if errorlevel 16 goto :IntInboxApps
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntPortableDevices
	if errorlevel 12 goto :IntMMRC
	if errorlevel 11 goto :IntWMR
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntDedup
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1903/v1909 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium 浏览器
	echo.  [D]   Microsoft Win32 计算器
	echo.  [E]   Windows 盲文辅助功能
	echo.  [F]   Windows 重复数据删除
	echo.  [G]   Windows To Go 工作区
	echo.  [H]   Windows 媒体功能包
	echo.  [I]   Windows 便携设备
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [L]   Microsoft 默认内置应用
	echo.  [M]   Microsoft Office 桌面 UWP 应用
	echo.  [N]   Microsoft DaRT 10.0 工具集
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft 游戏
	echo.  [Q]   Windows 边栏
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "请输入你的选项 ："
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntOfficeUWPApps
	if errorlevel 12 goto :IntInboxApps
	if errorlevel 11 goto :IntOpenSSH
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntPortableDevices
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v2004/v20H2/v21H1/v21H2 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium 浏览器
	echo.  [D]   Microsoft Win32 计算器
	echo.  [E]   Windows 盲文辅助功能
	echo.  [F]   Windows 重复数据删除
	echo.  [G]   Windows 媒体功能包
	echo.  [H]   Windows 便携设备
	echo.  [I]   Windows PowerShell 7
	echo.  [J]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [K]   Microsoft 默认内置应用
	echo.  [L]   Microsoft Office 桌面 UWP 应用
	echo.  [M]   Microsoft DaRT 10.0 工具集
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft 游戏
	echo.  [P]   Windows 边栏
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "请输入你的选项 ："
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntOfficeUWPApps
	if errorlevel 11 goto :IntInboxApps
	if errorlevel 10 goto :IntOpenSSH
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntPortableDevices
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 11 v21H2/v22H2 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Win32 计算器
	echo.  [D]   Windows 盲文辅助功能
	echo.  [E]   Windows 媒体功能包
	echo.  [F]   Windows 便携设备
	echo.  [G]   Windows PowerShell 7
	echo.  [H]   Open Secure Shell ^(SSH^) 客户端和服务器端
	echo.  [I]   Microsoft 默认内置应用
	echo.  [J]   Microsoft DaRT 11.0 工具集
	echo.  [K]   Microsoft DirectX 9.0c
	echo.  [L]   Microsoft 游戏
	echo.  [M]   Windows 边栏
	echo.  [N]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNX /N /M "请输入你的选项 ："
	if errorlevel 15 goto :IntegrateMenu
	if errorlevel 14 goto :IntVCRuntime
	if errorlevel 13 goto :IntSidebar
	if errorlevel 12 goto :IntGames
	if errorlevel 11 goto :IntDirectX9c
	if errorlevel 10 goto :IntDaRT
	if errorlevel 9  goto :IntInboxApps
	if errorlevel 8  goto :IntOpenSSH
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntPortableDevices
	if errorlevel 5  goto :IntMediaFeaturePack
	if errorlevel 4  goto :IntBraille
	if errorlevel 3  goto :IntWin32Calc
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1803/v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 ARM64-位客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17134" if "%ImageArchitecture%" equ "arm64" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET 5
	echo.
	echo.  [3]   Microsoft 默认内置应用
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :IntegrateMenu
	if errorlevel 3 goto :IntInboxApps
	if errorlevel 2 goto :IntNET5
	if errorlevel 1 goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server 2016/2019，Server v1709/v1803/v1809 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET Framework 4.8
	echo.
	echo.  [3]   Microsoft .NET 5
	echo.
	echo.  [4]   Windows PowerShell 7
	echo.
	echo.  [5]   适用于 Windows 的 Linux 子系统 ^(WSL^)
	echo.
	echo.  [6]   Microsoft DaRT 10.0 工具集
	echo.
	echo.  [7]   Microsoft DirectX 9.0c
	echo.
	echo.  [8]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "请输入你的选项 ："
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntVCRuntime
	if errorlevel 7 goto :IntDirectX9c
	if errorlevel 6 goto :IntDaRT
	if errorlevel 5 goto :IntWSL
	if errorlevel 4 goto :IntPowerShell7
	if errorlevel 3 goto :IntNET5
	if errorlevel 2 goto :IntNetFX48
	if errorlevel 1 goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server 2016/2019 非 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge 经典浏览器
	echo.  [E]   Microsoft Edge Chromium 浏览器
	echo.  [F]   Windows Multimedia Restricted Codecs
	echo.  [G]   Windows 系统恢复
	echo.  [H]   适用于 Windows 的 Linux 子系统 ^(WSL^)
	echo.  [I]   Windows To Go 工作区
	echo.  [J]   Windows PowerShell 7
	echo.  [K]   Microsoft 默认内置应用
	echo.  [L]   Microsoft DaRT 10.0 工具集
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft 游戏
	echo.  [O]   Windows 边栏
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "请输入你的选项 ："
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntInboxApps
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntWSL
	if errorlevel 7  goto :IntSystemRestore
	if errorlevel 6  goto :IntMMRC
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server v1903/v1909/v2004/v20H2/v21H1/v21H2/Windows Server LTSC 2022 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET 5
	echo.
	echo.  [3]   Windows PowerShell 7
	echo.
	echo.  [4]   适用于 Windows 的 Linux 子系统 ^(WSL^)
	echo.
	echo.  [5]   Microsoft DaRT 10.0 工具集
	echo.
	echo.  [6]   Microsoft DirectX 9.0c
	echo.
	echo.  [7]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "请输入你的选项 ："
	if errorlevel 8 goto :IntegrateMenu
	if errorlevel 7 goto :IntVCRuntime
	if errorlevel 6 goto :IntDirectX9c
	if errorlevel 5 goto :IntDaRT
	if errorlevel 4 goto :IntWSL
	if errorlevel 3 goto :IntPowerShell7
	if errorlevel 2 goto :IntNET5
	if errorlevel 1 goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server v1903/v1909 非 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge 经典浏览器
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Windows Multimedia Restricted Codecs
	echo.  [F]   适用于 Windows 的 Linux 子系统 ^(WSL^)
	echo.  [G]   Windows To Go 工作区
	echo.  [H]   Windows PowerShell 7
	echo.  [I]   Microsoft 默认内置应用
	echo.  [J]   Microsoft DaRT 10.0 工具集
	echo.  [K]   Microsoft DirectX 9.0c
	echo.  [L]   Microsoft 游戏
	echo.  [M]   Windows 边栏
	echo.  [N]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNX /N /M "请输入你的选项 ："
	if errorlevel 15 goto :IntegrateMenu
	if errorlevel 14 goto :IntVCRuntime
	if errorlevel 13 goto :IntSidebar
	if errorlevel 12 goto :IntGames
	if errorlevel 11 goto :IntDirectX9c
	if errorlevel 10 goto :IntDaRT
	if errorlevel 9  goto :IntInboxApps
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntWSL
	if errorlevel 5  goto :IntMMRC
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server v2004/v20H2/v21H1/v21H2 非 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge 经典浏览器
	echo.  [D]   Microsoft Edge Chromium 浏览器
	echo.  [E]   Windows Multimedia Restricted Codecs
	echo.  [F]   适用于 Windows 的 Linux 子系统 ^(WSL^)
	echo.  [G]   Windows PowerShell 7
	echo.  [H]   Microsoft 默认内置应用
	echo.  [I]   Microsoft DaRT 10.0 工具集
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft 游戏
	echo.  [L]   Windows 边栏
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "请输入你的选项 ："
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntSidebar
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntInboxApps
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWSL
	if errorlevel 5  goto :IntMMRC
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server LTSC 2022 非 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.  [2]   Microsoft .NET 5
	echo.  [3]   Windows PowerShell 7
	echo.  [4]   Microsoft 默认内置应用
	echo.  [5]   Microsoft DaRT 10.0 工具集
	echo.  [6]   Microsoft DirectX 9.0c
	echo.  [7]   Microsoft 游戏
	echo.  [8]   Windows 边栏
	echo.  [9]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123456789X /N /M "请输入你的选项 ："
	if errorlevel 10 goto :IntegrateMenu
	if errorlevel 9  goto :IntVCRuntime
	if errorlevel 8  goto :IntSidebar
	if errorlevel 7  goto :IntGames
	if errorlevel 6  goto :IntDirectX9c
	if errorlevel 5  goto :IntDaRT
	if errorlevel 4  goto :IntInboxApps
	if errorlevel 3  goto :IntPowerShell7
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 集成 Windows 自定义定制功能菜单
::-------------------------------------------------------------------------------------------
:IntCustomFeaturesMenu

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 集成 Windows 自定义定制功能菜单
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Windows 自定义定制功能菜单
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                警         告
	echo.                                =============
	echo.
	echo.   集成 Windows 自定义定制功能将会涉及到修补系统文件，因此 SFC 可以报告有关
	echo.   Windows 系统文件损坏的信息，这属于正常现象。
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.   若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 集成 Windows 自定义定制功能菜单
echo.===============================================================================
:: 检查所选择的源操作系统是否是 Windows 7 客户端版本/Server 2008 R2 非-Core 版本
if "%selectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" if "%ImageInstallationType%" neq "Server Core" (
	echo.
	echo.  [1]   Microsoft 终端服务器补丁
	echo.
	echo.  [2]   自定义主题 UxTheme 补丁
	echo.
	echo.  [3]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [4]   自定义默认用户帐户图片
	echo.
	echo.  [5]   自定义系统文件
	echo.
	echo.  [6]   自定义字体
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123456X /N /M "请输入你的选项 ："
	if errorlevel 7 goto :IntegrateMenu
	if errorlevel 6 goto :IntCustomFonts
	if errorlevel 5 goto :IntCustomFiles
	if errorlevel 4 goto :IntUAP
	if errorlevel 3 goto :IntCustomRecoveryImage
	if errorlevel 2 goto :IntCustomUxTheme
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows 7 Embedded 版本
if "%selectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" (
	echo.
	echo.  [1]   Microsoft 终端服务器补丁
	echo.
	echo.  [2]   自定义主题 UxTheme 补丁
	echo.
	echo.  [3]   自定义默认用户帐户图片
	echo.
	echo.  [4]   自定义系统文件
	echo.
	echo.  [5]   自定义字体
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345X /N /M "请输入你的选项 ："
	if errorlevel 6 goto :IntegrateMenu
	if errorlevel 5 goto :IntCustomFonts
	if errorlevel 4 goto :IntCustomFiles
	if errorlevel 3 goto :IntUAP
	if errorlevel 2 goto :IntCustomUxTheme
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows Server 2008 Core 版本
if "%selectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft 终端服务器补丁
	echo.
	echo.  [2]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [3]   自定义系统文件
	echo.
	echo.  [4]   自定义字体
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows 8.1 客户端版本非专业版（含 WMC）/Server 2012 R2 非-Core 版本
if "%selectedSourceOS%" equ "w81" if "%ImageFlag%" neq "ProfessionalWMC" if "%ImageInstallationType%" neq "Server Core" (
	echo.
	echo.  [1]   Windows 8.1 预激活数据
	echo.
	echo.  [2]   Microsoft 终端服务器补丁
	echo.
	echo.  [3]   自定义主题 UxTheme 补丁
	echo.
	echo.  [4]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [5]   自定义默认用户帐户图片
	echo.
	echo.  [6]   自定义系统文件
	echo.
	echo.  [7]   自定义字体
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "请输入你的选项 ："
	if errorlevel 8 goto :IntegrateMenu
	if errorlevel 7 goto :IntCustomFonts
	if errorlevel 6 goto :IntCustomFiles
	if errorlevel 5 goto :IntUAP
	if errorlevel 4 goto :IntCustomRecoveryImage
	if errorlevel 3 goto :IntCustomUxTheme
	if errorlevel 2 goto :IntCustomTerminalServer
	if errorlevel 1 goto :IntPreActTokens
)

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版（含 WMC）
if "%selectedSourceOS%" equ "w81" if "%ImageEdition%" equ "ProfessionalWMC" (
	echo.
	echo.  [1]   Windows 8.1 Media Center 通用激活令牌
	echo.
	echo.  [2]   Windows 8.1 预激活数据
	echo.
	echo.  [3]   Microsoft 终端服务器补丁
	echo.
	echo.  [4]   自定义主题 UxTheme 补丁
	echo.
	echo.  [5]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [6]   自定义默认用户帐户图片
	echo.
	echo.  [7]   自定义系统文件
	echo.
	echo.  [8]   自定义字体
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	choice /C:12345678X /N /M "请输入你的选项 ："
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntCustomFonts
	if errorlevel 7 goto :IntCustomFiles
	if errorlevel 6 goto :IntUAP
	if errorlevel 5 goto :IntCustomRecoveryImage
	if errorlevel 4 goto :IntCustomUxTheme
	if errorlevel 3 goto :IntCustomTerminalServer
	if errorlevel 2 goto :IntPreActTokens
	if errorlevel 1 goto :IntWMCGActTokens
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Core 版本
if "%selectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft 终端服务器补丁
	echo.
	echo.  [2]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [3]   自定义系统文件
	echo.
	echo.  [4]   自定义字体
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows Server Core 版本
if "%selectedSourceOS%" neq "w7" if "%selectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft 终端服务器补丁
	echo.
	echo.  [2]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.
	echo.  [3]   自定义系统文件
	echo.
	echo.  [4]   自定义字体
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :IntegrateMenu
	if errorlevel 4 goto :IntCustomFonts
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows 10 客户端版本/Server 非-Core 版本
if "%selectedSourceOS%" equ "w10" if "%ImageInstallationType%" neq "Server Core" if "%ImageBuild%" leq "20348"  (
	echo.
	echo.  [A]   Microsoft 终端服务器补丁
	echo.  [B]   自定义主题 UxTheme 补丁
	echo.  [C]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.  [D]   自定义默认用户帐户图片
	echo.  [E]   自定义系统文件
	echo.  [F]   自定义字体
	echo.  [G]   Microsoft Win32 计算器 Metro 皮肤
	echo.  [H]   Windows 图标皮肤
	echo.  [I]   Windows 照片查看器 Metro 皮肤
	echo.  [J]   Windows Media Player Metro 皮肤
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJX /N /M "请输入你的选项 ："
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntWMPMetroSkin
	if errorlevel 9  goto :IntWPVMetroSkin
	if errorlevel 8  goto :IntWIconsSkin
	if errorlevel 7  goto :IntWin32CalcMetroSkin
	if errorlevel 6  goto :IntCustomFonts
	if errorlevel 5  goto :IntCustomFiles
	if errorlevel 4  goto :IntUAP
	if errorlevel 3  goto :IntCustomRecoveryImage
	if errorlevel 2  goto :IntCustomUxTheme
	if errorlevel 1  goto :IntCustomTerminalServer
)

:: 检查所选择的源操作系统是否是 Windows 11 v21H2/v22H2 客户端版本
if "%selectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000"  (
	echo.
	echo.  [A]   Microsoft 终端服务器补丁
	echo.  [B]   自定义主题 UxTheme 补丁
	echo.  [C]   自定义 Windows 恢复环境 ^(WinRE^)
	echo.  [D]   自定义默认用户帐户图片
	echo.  [E]   自定义系统文件
	echo.  [F]   自定义字体
	echo.  [G]   Microsoft Win32 计算器 Metro 皮肤
	echo.  [H]   Windows 照片查看器 Metro 皮肤
	echo.  [I]   Windows Media Player Metro 皮肤
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIX /N /M "请输入你的选项 ："
	if errorlevel 10 goto :IntegrateMenu
	if errorlevel 9  goto :IntWMPMetroSkin
	if errorlevel 8  goto :IntWPVMetroSkin
	if errorlevel 7  goto :IntWin32CalcMetroSkin
	if errorlevel 6  goto :IntCustomFonts
	if errorlevel 5  goto :IntCustomFiles
	if errorlevel 4  goto :IntUAP
	if errorlevel 3  goto :IntCustomRecoveryImage
	if errorlevel 2  goto :IntCustomUxTheme
	if errorlevel 1  goto :IntCustomTerminalServer
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 移除菜单
::-------------------------------------------------------------------------------------------
:RemoveMenu

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 移除菜单
echo.===============================================================================
echo.

:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查所选择的源操作系统是否是 Windows 7 源操作系统
if "%selectedSourceOS%" equ "w7" (
	echo.  [1]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 8.1 源操作系统
if "%selectedSourceOS%" equ "w81" (
	echo.  [1]   使用应用列表移除 Windows 应用
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 2015/2016 LTSB
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N 2015/2016 LTSB
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 客户端版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [1]   使用应用列表移除 Windows 应用
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 2019 LTSC
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N 2019 LTSC
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 客户端非-EnterpriseS/EnterpriseSN 版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用应用列表移除 Windows 应用
	echo.
	echo.  [3]   使用程序包列表移除 Windows 组件
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10 客户端版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19044" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用应用列表移除 Windows 应用
	echo.
	echo.  [3]   使用程序包列表移除 Windows 组件
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 11 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用应用列表移除 Windows 应用
	echo.
	echo.  [3]   使用程序包列表移除 Windows 组件
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 11 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22000" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   使用应用列表移除 Windows 应用
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 10/11 Server 版本
if "%selectedSourceOS%" neq "w7" if "%selectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" (
	echo.  [1]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
:: 检查所选择的源操作系统是否是 Windows 7 源操作系统
if "%selectedSourceOS%" equ "w7" (
	choice /C:1X /N /M "请输入你的选项 ："
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: 检查所选择的源操作系统是否是 Windows 8.1 源操作系统
if "%selectedSourceOS%" equ "w81" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 2015/2016 LTSB
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseS" (
	choice /C:1X /N /M "请输入你的选项 ："
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N 2015/2016 LTSB
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseSN" (
	choice /C:1X /N /M "请输入你的选项 ："
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: 检查所选择的源操作系统是否是 Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 客户端版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 2019 LTSC
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N 2019 LTSC
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: 检查所选择的源操作系统是否是 Windows 10 客户端非-EnterpriseS/EnterpriseSN 版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: 检查所选择的源操作系统是否是 Windows 10 客户端版本
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19044" if "%ImageInstallationType%" equ "Client" (
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: 检查所选择的源操作系统是否是 Windows 11 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" if "%ImageInstallationType%" equ "Client" (
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: 检查所选择的源操作系统是否是 Windows 11 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22000" if "%ImageInstallationType%" equ "Client" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: 检查所选择的源操作系统是否是 Windows 10/11 Server 版本
if "%selectedSourceOS%" neq "w7" if "%selectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" (
	choice /C:1X /N /M "请输入你的选项 ："
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 自定义定制菜单
::-------------------------------------------------------------------------------------------
:CustomizeMenu

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 自定义定制菜单
echo.===============================================================================
echo.
:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查所选择的源操作系统是否是 Windows 7/Server 2008 R2
if "%selectedSourceOS%" equ "w7" (
	echo.此功能尚未实现……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   使用功能列表启用 Windows 功能
echo.  [2]   使用功能列表禁用 Windows 功能
echo.  [3]   从 XML 文件导入自定义默认 Metro 应用关联
echo.  [4]   将默认内置应用关联导出到 XML 文件
echo.  [5]   移除默认内置应用关联 XML 文件
echo.  [6]   从 XML 文件导入自定义开始菜单布局
echo.  [7]   从注册表文件导入自定义注册表设置
echo.  [8]   应用调整
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:12345678X /N /M "请输入你的选项 ："
if errorlevel 9 goto :MainMenu
if errorlevel 8 goto :ApplyTweaksMenu
if errorlevel 7 goto :ImportCustomRegistry
if errorlevel 6 goto :ImportStartMenuLayout
if errorlevel 5 goto :RemoveMetroAppsAssociation
if errorlevel 4 goto :ExportMetroAppsAssociation
if errorlevel 3 goto :ImportMetroAppsAssociation
if errorlevel 2 goto :DisableFeatures
if errorlevel 1 goto :EnableFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 应用源文件菜单
::-------------------------------------------------------------------------------------------
:ApplyMenu

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 应用源文件菜单
echo.===============================================================================
echo.
:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" equ "w7" (
	echo.  [1]   应用并保存到源映像文件
	echo.
	echo.  [2]   丢弃更改并卸载源映像文件
	echo.
	echo.
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" neq "w7" (
	echo.  [1]   清理源映像文件
	echo.
	echo.  [2]   应用并保存到源映像文件
	echo.
	echo.  [3]   丢弃更改并卸载源映像文件
)
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :DiscardSource
	if errorlevel 1 goto :SaveSource
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" neq "w7" (
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :MainMenu
	if errorlevel 3 goto :DiscardSource
	if errorlevel 2 goto :SaveSource
	if errorlevel 1 goto :CleanupSource
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 目标选择菜单
::-------------------------------------------------------------------------------------------
:TargetMenu

cls
echo.===============================================================================
echo.                         MSMG 工具箱 - 目标选择菜单
echo.===============================================================================
echo.
:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "Yes" (
	echo.源操作系统已被选择，请从“应用”菜单中选择保存或丢弃源文件……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   制作 DVD ISO 镜像
echo.
echo.  [2]   刻录 ISO 镜像到 DVD 光盘
echo.
echo.  [3]   将源文件复制到 USB 闪存驱动器
echo.
echo.  [4]   同步源启动和安装映像到 USB 闪存驱动器
echo.
echo.  [5]   将 ISO 镜像刻录到可启动 USB 闪存驱动器
echo.
echo.  [6]   格式化 USB 闪存驱动器
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123456X /N /M "请输入你的选项 ："
if errorlevel 7 goto :MainMenu
if errorlevel 6 goto :FormatUSB
if errorlevel 5 goto :BurnUSB
if errorlevel 4 goto :SyncUSB
if errorlevel 3 goto :CopyUSB
if errorlevel 2 goto :BurnISO
if errorlevel 1 goto :MakeISO
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 工具菜单
::-------------------------------------------------------------------------------------------
:ToolsMenu

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 工具菜单
echo.===============================================================================
echo.
echo.  [1]   WIM 管理器
echo.
echo.  [2]   调试信息
echo.
echo.  [3]   选    项
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "请输入你的选项 ："
if errorlevel 4 goto :MainMenu
if errorlevel 3 goto :Options
if errorlevel 2 goto :Debug
if errorlevel 1 goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 从 <DVD> 文件夹中选择源文件
::-------------------------------------------------------------------------------------------
:SelectSourceDVD

cls
echo.===============================================================================
echo.                  MSMG 工具箱 - 从 ^<DVD^> 文件夹中选择源文件
echo.===============================================================================
echo.

:: 检查 Windows 源启动映像是否存在
if not exist "%BootWim%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Boot.wim”映像……
	echo.
	echo.请将 Windows 安装程序中的“Boot.wim”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源安装映像是否为 ESD 格式
if exist "%InstallEsd%" (
	echo.工具箱所找到的 Windows 安装映像是 .esd 格式，ESD 映像是高度压缩的映
	echo.像，无法直接维护。
	echo.
	echo.此工具箱要求 Windows 安装映像以 .wim 格式进行维护。
	echo.
	echo.请使用 .wim 格式的 Windows 安装映像或使用转换菜单将 .esd 映像转换为 
	echo..wim 格式
	echo.
	goto :Stop
)

:: 检查 Windows 源安装映像是否存在
if not exist "%InstallWim%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Install.wim”映像……
	echo.
	echo.请将 Windows 安装程序中的“Install.wim”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在选择源映像文件#########################################################
echo.-------------------------------------------------------------------------------

:: 获取映像索引号以维护
call :GetImageIndexNo "%InstallWim%"

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入的索引编号 # 无效，有效范围为 [1、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
	echo.
	pause
	goto :SelectSourceDVD
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
    for /l %%i in (2, 1, %ImageCount%) do (
        set "ImageIndexNo=!ImageIndexNo!,%%i"
    )
)

if /i "%ImageIndexNo%" equ "Q" (
   set ImageIndexNo=
   goto :MainMenu
)

:: 设置默认映像索引编号
for /f "tokens=1 delims=," %%a in ("!ImageIndexNo!") do (set DefaultIndexNo=%%a)

:: 获取第一映像索引信息
call :GetImageIndexInfo "%InstallWim%", %DefaultIndexNo% >nul

:: 设置选择的源操作系统版本
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"

if "%ImageVersion:~0,-6%" equ "10.0" (
   if "%ImageBuild%" leq "20348" (
       set "SelectedSourceOS=w10"
       set "OSID=10"
   )
   if "%ImageBuild%" geq "22000" (
       set "SelectedSourceOS=w11"
       set "OSID=11"
   )
)

if "%ImageVersion:~0,-6%" equ "11.0" (
   set "SelectedSourceOS=w11"
   set "OSID=11"
)

:: 设置软件服务包内部版本、版本和服务包内部版本
if "%SelectedSourceOS%" equ "w7" set "PackageServicePackBuild=17514"
if "%SelectedSourceOS%" equ "w81" set "PackageServicePackBuild=16384"

if "%SelectedSourceOS%" equ "w10" (
   if "%ImageBuild%" geq "10240" if "%ImageBuild%" leq "15063" (
       set "PackageBuild=%ImageBuild%"
       set "PackageVersion=10.0.%ImageBuild%"
       set "PackageServicePackBuild=0"
   )
   if "%ImageBuild%" equ "16299" (
		set "PackageBuild=16299"
		set "PackageVersion=10.0.16299"
		set "PackageServicePackBuild=15"
	)
	if "%ImageBuild%" geq "17134" if "%ImageBuild%" leq "17763" (
       set "PackageBuild=%ImageBuild%"
       set "PackageVersion=10.0.%ImageBuild%"
       set "PackageServicePackBuild=1"
   )
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
		set "PackageBuild=18362"
		set "PackageVersion=10.0.18362"
		set "PackageServicePackBuild=1"
	)
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" (
		set "PackageBuild=19041"
		set "PackageVersion=10.0.19041"
		set "PackageServicePackBuild=1"
	)
	if "%ImageBuild%" equ "20348" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=1"
	)
)

if "%SelectedSourceOS%" equ "w11" (
	if "%ImageBuild%" geq "22000" (
		set "PackageBuild=%ImageBuild%"
		set "PackageVersion=10.0.%ImageBuild%"
		set "PackageServicePackBuild=1"
	)
)

:: 设置程序包索引和体系结构
if "%ImageArchitecture%" equ "x86" (
   set "PackageIndex=1"
   set "PackageArchitecture=x86"
)
if "%ImageArchitecture%" equ "x64" (
   set "PackageIndex=2"
   set "PackageArchitecture=amd64"
)
if "%ImageArchitecture%" equ "arm" (
   set "PackageIndex=3"
   set "PackageArchitecture=arm"
)
if "%ImageArchitecture%" equ "arm64" (
   set "PackageIndex=4"
   set "PackageArchitecture=arm64"
)

:: 检查主机操作系统是否是 Windows 7 并是否选择了 Windows 10/11
if "%HostVersion%" equ "6.1" if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	echo.
	echo.工具箱无法在 Windows 7 主机操作系统上维护 Windows 10 源操作系统……
	echo.
	echo.工具箱需要主机操作系统为 Windows 8.1/10 以维护 Windows 10 源操作系统……
	goto :Stop
)

echo.
choice /C:YN /N /M "你是否要安装 Windows 安装程序启动映像 ？ [是‘Y’/否‘N’] ："
if errorlevel 2 set "IsBootImageSelected=No"
if errorlevel 1 set "IsBootImageSelected=Yes"

choice /C:YN /N /M "你是否要安装 Windows 恢复映像 ？ [是‘Y’/否‘N’] ："
if errorlevel 2 set "IsRecoveryImageSelected=No"
if errorlevel 1 set "IsRecoveryImageSelected=Yes"

echo.
echo.-------------------------------------------------------------------------------
echo.####源映像文件详细信息#########################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ： Install.wim
echo.    映像索引编号             ： %ImageIndexNo%
echo.    映像体系结构             ： %ImageArchitecture%
echo.    映像版本                 ： %ImageVersion%
echo.    映像服务包内部版本       ： %ImageServicePackBuild%
echo.    映像服务包等级           ： %ImageServicePackLevel%
echo.    映像内部版本             ： %ImageBuild%
echo.    映像默认语言             ： %ImageDefaultLanguage%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在安装源映像文件#########################################################
echo.-------------------------------------------------------------------------------
echo.
:: 安装源启动映像索引以维护
if "%IsBootImageSelected%" equ "Yes" (
   for /l %%i in (1, 1, 2) do (
	   call :CreateFolder "%BootMount%\%%i"

       echo.-------------------------------------------------------------------------------
       echo.正在将 [Boot.wim，索引 ：%%i] 映像安装在 ^<\Mount\Boot\%%i^>……
       echo.-------------------------------------------------------------------------------
       call :MountImage "%BootWim%", %%i, "%BootMount%\%%i"
   )
)

:: 安装源安装和恢复映像索引安装以维护
for %%i in (%ImageIndexNo%) do (
	call :CreateFolder "%InstallMount%\%%i"

	:: 安装源安装映像索引以维护
	echo.-------------------------------------------------------------------------------
	echo.正在将 [Install.wim，索引 ：%%i] 映像安装在 ^<\Mount\Install\%%i^>……
	echo.-------------------------------------------------------------------------------
	call :MountImage "%InstallWim%", %%i, "%InstallMount%\%%i"
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	call :CreateFolder "%WinReMount%"

	:: 安装源恢复映像索引以维护
	echo.-------------------------------------------------------------------------------
	echo.正在将 [Install.wim，索引 ：!DefaultIndexNo! -^> WinRE.wim] 映像安装在 ^<\Mount\WinRE^>……
	echo.-------------------------------------------------------------------------------
	call :MountImage "%InstallMount%\!DefaultIndexNo!\%WinReWim%", 1, "%WinReMount%"
)

echo.-------------------------------------------------------------------------------
echo.####选择并安装源映像文件已完成#################################################
echo.-------------------------------------------------------------------------------

set "IsSourceSelected=Yes"

:Stop
echo.
echo.===============================================================================
echo.
pause

goto :MainMenu
::-------------------------------------------------------------------------------------------

:: MSMG 工具箱 - 从 DVD 驱动器复制源文件到 <DVD> 文件夹
::-------------------------------------------------------------------------------------------
:CopySourceDVD

setlocal

set DriveLetter=

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 从 DVD 驱动器复制源文件到 ^<DVD^> 文件夹
echo.===============================================================================
echo.

:: 检查 Windows 源 DVD 文件夹是否是空的
if exist "%DVD%\sources\*.wim" (
	echo.工具箱中的源 ^<DVD^> 文件夹不是空的……
	echo.
	choice /C:YN /N /M "你想移除它并继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始将源文件从 DVD 驱动器复制到 ^<DVD^> 文件夹###########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 DVD 驱动器选项####################################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 DVD 驱动器盘符
set /p DriveLetter=请输入 DVD 驱动器盘符 ：

:: 设置 DVD 驱动器盘符
set "DriveLetter=%DriveLetter%:"
echo.

:: 检查指定的 DVD 驱动器号是否为空驱动器
if not exist "%DriveLetter%\sources\boot.wim" (
	echo.无法在指定的驱动器号中找到 Windows 操作系统的安装文件……
	echo.
	echo.请输入正确的 DVD 驱动器盘符……
	goto :Stop
)

:: 检查指定的 DVD 驱动器号是否为空驱动器
if not exist "%DriveLetter%\sources\install.wim" (
	echo.无法在指定的驱动器号中找到 Windows 操作系统的安装文件……
	echo.
	echo.请输入正确的 DVD 驱动器盘符……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在从 DVD 驱动器复制源文件到 ^<DVD^> 文件夹#################################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.正在从 DVD 驱动器 ^<%DriveLetter%^> 复制源文件到源 ^<DVD^> 文件夹……
echo.
echo.从 DVD 驱动器复制可能会需要一些时间，请稍候……
%XCopy% %DriveLetter% "%DVD%" >nul
echo.
echo.复制完成……
echo.
echo.-------------------------------------------------------------------------------
echo.####从 DVD 驱动器复制源文件到 ^<DVD^> 文件夹已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set DriveLetter=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

:: MSMG 工具箱 - 从 DVD ISO 镜像解压源文件到 <DVD> 文件夹
::-------------------------------------------------------------------------------------------
:ExtractSourceISO

setlocal

set ISOFileName=

cls
echo.===============================================================================
echo.            MSMG 工具箱 - 从 DVD ISO 镜像解压源文件到 ^<DVD^> 文件夹
echo.===============================================================================
echo.

:: 检查 Windows 源 DVD 文件夹是否是空的
if exist "%DVD%\sources\*.wim" (
	echo.工具箱中的源 ^<DVD^> 文件夹不是空的……
	echo.
	choice /C:YN /N /M "你想移除它并继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :Stop
	echo.
)

:: 检查 DVD ISO 镜像文件夹是否是空的
if not exist "%ISO%\*.iso" (
	echo.DVD ISO 镜像文件夹 ^<ISO^> 是空的……
	echo.
	echo.请将 DVD ISO 镜像复制到 ^<ISO^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从 DVD ISO 镜像解压源文件到 ^<DVD^> 文件夹###########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 DVD ISO 镜像选项##################################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 DVD ISO 映像文件名称
set /p ISOFileName=请输入 ISO 镜像文件名称，不含 .iso ：

:: 设置 DVD ISO 映像文件名称
set "ISOFileName=%ISOFileName%.iso"
echo.

:: 检查指定的 DVD ISO 镜像文件是否存在
if not exist "%ISO%\%ISOFileName%" (
	echo.无法在 ^<ISO^> 文件夹中找到指定的 DVD ISO 镜像……
	echo.
	echo.请输入正确的 DVD ISO 镜像文件名称……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在将源文件从 DVD ISO 镜像解压到 ^<DVD^> 文件夹#############################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.正在解压 DVD ISO 镜像内容到源 ^<DVD^> 文件夹……
echo.
echo.解压可能需要一些时间，请稍等……
%Zip% x -y "%ISO%\%ISOFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if exist "%DVD%\sources\install.esd" set /a n+=1
if "%n%" equ "2" (echo.解压完成……) else echo.解压失败……
echo.
echo.-------------------------------------------------------------------------------
echo.####从 DVD ISO 镜像解压源文件到 ^<DVD^> 文件夹已完成#############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set ISOFileName=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 从 OEM IMG 镜像解压源文件到 <DVD> 文件夹
::-------------------------------------------------------------------------------------------
:ExtractSourceIMG

setlocal

set IMGFileName=

cls
echo.===============================================================================
echo.            MSMG 工具箱 - 从 OEM IMG 镜像解压源文件到 ^<DVD^> 文件夹
echo.===============================================================================
echo.

:: 检查 Windows 源 DVD 文件夹是否是空的
if exist "%DVD%\sources\*.wim" (
	echo.工具箱中的源 ^<DVD^> 文件夹不是空的……
	echo.
	choice /C:YN /N /M "你想移除它并继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :Stop
)

:: 检查 OEM IMG 文件夹是否为空
if not exist "%ISO%\*.img" (
	echo.无法在 ^<ISO^> 文件夹中找到 Windows OEM IMG 安装镜像文件……
	echo.
	echo.请将 Windows OEM IMG 安装镜像文件复制到 ^<ISO^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从 OEM IMG 镜像解压源文件到 ^<DVD^> 文件夹###########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 OEM IMG 镜像选项##################################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 OEM IMG 文件名称
set /p IMGFileName=请输入 OEM IMG 镜像文件名称，不含 .img 扩展名 ：

:: 设置 OEM IMG 文件名称
set "IMGFileName=%IMGFileName%.img"
echo.

:: 检查指定的 OEM IMG 镜像文件是否存在
if not exist "%ISO%\%IMGFileName%" (
	echo.无法找到指定的 OEM IMG 镜像文件……
	echo.
	echo.请输入正确的 OEM IMG 镜像文件名称……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在将源文件从 OEM IMG 镜像解压到 ^<DVD^> 文件夹#############################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.正在解压 OEM IMG 镜像内容到源 ^<DVD^> 文件夹……
echo.
echo.解压可能需要一些时间，请稍等……
%Zip% x -y "%ISO%\%IMGFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if "%n%" equ "2" (echo.解压完成……) else echo.解压失败……
echo.
echo.-------------------------------------------------------------------------------
echo.####从 OEM IMG 镜像解压源文件到 ^<DVD^> 文件夹已完成#############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set IMGFileName=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 从应用商店 ESD 映像解压源文件
::-------------------------------------------------------------------------------------------
:ExtractSourceStoreESD

setlocal

set ImageBuild=

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 从应用商店 ESD 映像解压源文件
echo.===============================================================================
echo.

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallEsd%" (
	echo.无法在 ^<DVD\Sources^> 文件夹中找到 Windows 应用商店 ESD 映像文件“Install.esd”。
	echo.
	echo.请将 Windows 应用商店 ESD 映像文件复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####正在开始转换 Windows 应用商店 ESD 映像为 WIM 映像##########################
echo.-------------------------------------------------------------------------------
echo.
echo.正在读取映像信息……
echo.
echo.===============================================================================
echo.^|索引    ^| 体系结构   ^| 名称
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr Index') do (
	for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:  " %%c in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Name') do (
			if %%a equ 1 echo.^|  %%a     ^|  -          ^|%%c
			if %%a gtr 1 if %%a leq 9 echo.^|  %%a     ^|%%b          ^|%%c
			if %%a gtr 9 echo.^|  %%a    ^|%%b          ^|%%c
		)
	)
)
echo.===============================================================================
echo.

:: 查找当前 ESD 映像中的总索引数量
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 4 set ImageIndexNo=4

if %ImageCount% gtr 4 (
	:: 获取映像索引号以维护
	set /p ImageIndexNo=请输入映像索引编号 # 的 [范围 ：4、…%ImageCount%，按‘A’选择所有，按‘Q’退出] ：

	:: 检查映像索引有效性
	if not defined ImageIndexNo (
		echo.
		echo.输入的索引编号 # 无效，有效范围为 [4、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
		echo.
		pause
		goto :ExtractSourceStoreESD
	)

	if /i "%ImageIndexNo%" equ "A" (
		set "ImageIndexNo=3"

    	for /l %%i in (4, 1, %ImageCount%) do (
        	set "ImageIndexNo=!ImageIndexNo!,%%i"
    	)
	)

	if /i "%ImageIndexNo%" equ "Q" goto :MainMenu
)
echo.
echo.-------------------------------------------------------------------------------
echo.####正在转换 Windows 应用商店 ESD 映像为 WIM 映像##############################
echo.-------------------------------------------------------------------------------
echo.
echo.正在解密 Windows 应用商店 ESD 映像 ^(如果它被加密^)……
attrib -r -h -s -a "%InstallEsd%" >nul
for /f "skip=1 tokens=4 delims=:." %%e in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:4 ^| find /i "Version"') do set ImageBuild=%%e
if %ImageBuild% equ 9600 %W81EsdDecrypter% "%InstallEsd%" 2>nul
if %ImageBuild% gtr 9600 %W10EsdDecrypter% "%InstallEsd%" >nul
echo.
:: 创建临时启动和安装映像
echo.正在创建临时容器映像……
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"
call :CaptureImage "%BootWim%", "%Temp%\ESD", "BootWim", "BootWim", "No" >nul
call :CaptureImage "%InstallWim%", "%Temp%\ESD", "InstallWim", "InstallWim", "No" >nul
call :RemoveFolder "%Temp%\ESD"
echo.
echo.-------------------------------------------------------------------------------
echo.正在应用 Windows 应用商店 ESD 映像 [Install.esd，索引 ：1] 到 ^<Temp\DVD^>……
echo.-------------------------------------------------------------------------------
:: 创建 Windows 安装程序安装媒介文件夹“%Temp%\DVD”
call :RemoveFolder "%Temp%\DVD"
call :CreateFolder "%Temp%\DVD"
call :ApplyImage "%InstallEsd%", 1, "%Temp%\DVD"
move /y "%DVD%\sources\*.wim" "%Temp%\DVD\sources" >nul
echo.-------------------------------------------------------------------------------
echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：2] 为启动映像……
echo.-------------------------------------------------------------------------------
call :ExportImageIndex "%InstallEsd%", 2, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
call :DeleteImage "%Temp%\DVD\sources\boot.wim", 1 >nul
echo.-------------------------------------------------------------------------------
echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：3] 为启动映像……
echo.-------------------------------------------------------------------------------
call :ExportImageIndex "%InstallEsd%", 3, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"

if %ImageBuild% equ 9600 (
	echo.-------------------------------------------------------------------------------
	echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：4] 为安装映像……
	echo.-------------------------------------------------------------------------------
	call :ExportImageIndex "%InstallEsd%", 4, "%Temp%\DVD\sources\install.wim", "WIM", "No"
)

if %ImageBuild% gtr 9600 (
	for %%i in (%ImageIndexNo%) do (
		echo.-------------------------------------------------------------------------------
		echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：%%i] 为安装映像……
		echo.-------------------------------------------------------------------------------
		call :ExportImageIndex "%InstallEsd%", %%i, "%Temp%\DVD\sources\install.wim", "WIM", "No"
	)
)

:: 删除第一个空索引
call :DeleteImage "%Temp%\DVD\sources\install.wim", 1 >nul

:: 将 ESD 移动到 WIM 转换文件夹 <Temp\DVD> 至 <DVD> 的 Source 文件夹
call :RemoveFolder "%DVD%"
move /y "%Temp%\DVD" "%ROOT%" >nul

echo.-------------------------------------------------------------------------------
echo.####正在复制 EI.CFG 信息文件到 Source ^<DVD\sources^> 文件夹#####################
echo.-------------------------------------------------------------------------------
echo.
:: 获取安装映像索引的版本
call :GetImageEdition "%InstallWim%", 1

:: 写入 EI.cfg 信息文件到 <DVD\sources> 文件夹
echo.正在复制 EI.CFG 文件到 ^<DVD\sources^> 文件夹……

if exist "%DVD%\sources\EI.CFG" del /f /q "%DVD%\sources\EI.CFG" >nul
(
	echo.[EditionID]
	if %ImageCount% equ 1 echo.%ImageEdition%
	if %ImageCount% gtr 1 echo.
	echo.
	echo.[Channel]
	echo.Retail
	echo.
	echo.[VL]
	echo.0
	echo.
)>"%DVD%\sources\EI.CFG"

:: 从 Source 文件夹清理不需要的文件
call :RemoveFile "%DVD%\MediaMeta.xml"
echo.
echo.-------------------------------------------------------------------------------
echo.####从应用商店 ESD 映像中解压源文件已完成######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set ImageBuild=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

:: MSMG 工具箱 - 从 Microsoft 的 Media Creation Tool 映像中解压源文件
::-------------------------------------------------------------------------------------------
:ExtractSourceMCT

setlocal

cls
echo.===============================================================================
echo.      MSMG 工具箱 - 从 Microsoft 的 Media Creation Tool 映像中解压源文件
echo.===============================================================================
echo.

:: 检查 Windows 源启动映像是否存在
if not exist "%BootWim%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Boot.wim”映像……
	echo.
	echo.请将 Windows 安装程序中的“Boot.wim”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源安装映像是否存在
if not exist "%InstallEsd%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Install.esd”映像……
	echo.
	echo.请将 Windows 安装程序中的“Install.esd”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从自定义 Windows ESD 映像中解压源文件##############################
echo.-------------------------------------------------------------------------------
echo.
echo.正在读取映像信息……
echo.
echo.===============================================================================
echo.^|索引    ^| 体系结构   ^| 名称
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr Index') do (
	for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:  " %%c in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Name') do (
			if %%a leq 9 echo.^|  %%a     ^|%%b          ^|%%c
			if %%a gtr 9 echo.^|  %%a    ^|%%b          ^|%%c
		)
	)
)
echo.===============================================================================
echo.

:: 查找当前 ESD 映像中的总索引数量
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 1 (
	set /p ImageIndexNo=请输入 ESD 映像索引编号 # [按‘Q’退出] ：
) else set /p ImageIndexNo=请输入 ESD 映像索引编号 # 的 [范围 ：1、2、…%ImageCount%，按‘A’选择所有，按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入的索引编号 # 无效，有效范围为 [1、2、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
	echo.
	pause
	goto :ExtractSourceMCT
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
    for /l %%i in (2, 1, %ImageCount%) do (
        set "ImageIndexNo=!ImageIndexNo!,%%i"
    )
)

if /i "%ImageIndexNo%" equ "Q" goto :MainMenu

echo.
echo.-------------------------------------------------------------------------------
echo.####正在从 Microsoft 媒介创建工具 ESD 映像中解压源文件#########################
echo.-------------------------------------------------------------------------------

:: 创建临时启动和安装映像
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"

call :CaptureImage "%InstallWim%", "%Temp%\ESD", "InstallWim", "InstallWim", "No" >nul
call :RemoveFolder "%Temp%\ESD"

:: 转换 Windows 媒介创建工具安装 ESD 映像为 WIM 映像
for %%i in (%ImageIndexNo%) do (
	echo.-------------------------------------------------------------------------------
	echo.正在导出媒介创建工具 [Install.esd，索引 ：%%i] 为安装映像……
	echo.-------------------------------------------------------------------------------
	call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
)

:: 删除已转换的 Windows 媒介创建工具安装 WIM 映像中作为空索引的索引 1
call :DeleteImage "%InstallWim%", 1 >nul

:: 删除原始 Windows 媒介创建工具安装 ESD 映像
call :RemoveFile "%InstallEsd%"

echo.-------------------------------------------------------------------------------
echo.####从 Microsoft 媒介创建工具 ESD 映像中解压源文件已完成#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 从自定义 Windows ESD 映像中解压源文件
::-------------------------------------------------------------------------------------------
:ExtractSourceESD

setlocal

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 从自定义 Windows ESD 映像中解压源文件
echo.===============================================================================
echo.

:: 检查 Windows 源启动映像是否存在
if not exist "%BootWim%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Boot.wim”映像……
	echo.
	echo.请将 Windows 安装程序中的“Boot.wim”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源安装 ESD 映像是否存在
if not exist "%InstallEsd%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Install.esd”映像……
	echo.
	echo.请将 Windows 安装程序中的“Install.esd”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从自定义 Windows ESD 映像中解压源文件##############################
echo.-------------------------------------------------------------------------------
echo.
echo.正在读取映像信息……
echo.
echo.===============================================================================
echo.^|索引    ^| 体系结构   ^| 名称
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr Index') do (
	for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:  " %%c in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:%%a ^| findstr /i Name') do (
			if %%a leq 9 echo.^|  %%a     ^|%%b          ^|%%c
			if %%a gtr 9 echo.^|  %%a    ^|%%b          ^|%%c
		)
	)
)
echo.===============================================================================
echo.

:: 查找当前 ESD 映像中的总索引数量
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 1 (
	set /p ImageIndexNo=请输入 ESD 映像索引编号 # [按‘Q’退出] ：
) else set /p ImageIndexNo=请输入 ESD 映像索引编号 # 的 [范围 ：1、2、…%ImageCount%，按‘A’选择所有，按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入的索引编号 # 无效，有效范围为 [1、2、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
	echo.
	pause
	goto :ExtractSourceESD
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
    for /l %%i in (2, 1, %ImageCount%) do (
        set "ImageIndexNo=!ImageIndexNo!,%%i"
    )
)

if /i "%ImageIndexNo%" equ "Q" goto :MainMenu

echo.
echo.-------------------------------------------------------------------------------
echo.####正在从自定义 Windows ESD 映像中解压源文件##################################
echo.-------------------------------------------------------------------------------

:: 创建临时启动和安装映像
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"

call :CaptureImage "%InstallWim%", "%Temp%\ESD", "InstallWim", "InstallWim", "No" >nul
call :RemoveFolder "%Temp%\ESD"

:: 转换 Windows 安装 ESD 映像为 WIM 映像
for %%i in (%ImageIndexNo%) do (
	call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
)

:: 删除已转换的 Windows 安装 WIM 映像中作为空索引的索引 1
call :DeleteImage "%InstallWim%", 1 >nul

:: 删除原始 Windows 安装 ESD 映像
call :RemoveFile "%InstallEsd%"

echo.-------------------------------------------------------------------------------
echo.####从自定义 Windows ESD 映像中解压源文件已完成################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 语言包菜单模组
::-------------------------------------------------------------------------------------------
:IntLanguagePacksMenu

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                      MSMG 工具箱 - 集成 Windows 语言包
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                警         告
	echo.                                =============
	echo.
	echo.   请不要在集成更新之后集成语言包。如果你在集成语言包之前集成了包含与语言相关
	echo.   的资源的任何更新 ^(包括热修复程序、一般发行版内核更新 [GDR]、零日修补程序
	echo.   [ZDP] 或服务包 [SP] ^)，则在其中包含的特定于语言的更改将不会被应用到更新中，
	echo.   你将不得不重新集成更新。请始终在集成更新之前集成语言包。
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.   若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set LanguagePackType=
set LanguagePackCode=

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成 Windows 语言包菜单
echo.===============================================================================
echo.
echo.  [1]   集成到 Windows 安装程序启动映像
echo.
echo.  [2]   集成到 Windows 安装映像
echo.
echo.  [3]   集成到 Windows 恢复映像
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "请输入你的选项 ："
if errorlevel 4 goto :IntegrateMenu
if errorlevel 3 set "LanguagePackType=Recovery"
if errorlevel 2 set "LanguagePackType=Install"
if errorlevel 1 set "LanguagePackType=Boot"

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成 Windows 语言包菜单
echo.===============================================================================
echo.

if "%LanguagePackType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows 安装程序启动映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 安装程序启动映像……
	goto :Stop
)

if "%LanguagePackType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows 恢复映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 恢复映像……
	goto :Stop
)

cls
echo.===============================================================================
echo.            MSMG 工具箱 - 集成 Windows 语言包菜单 - 选择语言菜单
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" (
	echo. 阿拉伯语 - 沙特阿拉伯    [ar-SA]    拉脱维亚语 - 拉脱维亚    [lv-LV]
	echo. 保加利亚语 - 保加利亚    [bg-BG]    立陶宛语 - 立陶宛        [lt-LT]
	echo. 中文 - 香港特别行政区    [zh-HK]    挪威语 - 挪威            [nb-NO]
	echo. 中文 - 简体              [zh-CN]    波兰语 - 波兰            [pl-PL]
	echo. 中文 - 台湾              [zh-TW]    葡萄牙语 - 巴西          [pt-BR]
	echo. 克罗地亚语 - 克罗地亚    [hr-HR]    葡萄牙语 - 葡萄牙        [pt-PT]
	echo. 捷克语 - 捷克共和国      [cs-CZ]    罗马尼亚语 - 罗马尼亚    [ro-RO]
	echo. 丹麦语 - 丹麦            [da-DK]    俄语 - 俄罗斯            [ru-RU]
	echo. 荷兰语 - 荷兰            [nl-NL]    塞尔维亚语 - 塞尔维亚    [sr-Latn-CS]
	echo. 英语 - 美国              [en-US]    斯洛伐克语 - 斯洛伐克    [sk-SK]
	echo. 爱沙尼亚语 - 爱沙尼亚    [et-EE]    斯洛文尼亚语 - 斯洛文尼亚[sl-SI]
	echo. 芬兰语 - 芬兰            [fi-FI]    西班牙语 - 西班牙        [es-ES]
	echo. 法语 - 法国              [fr-FR]    瑞典语 - 瑞典            [sv-SE]
	echo. 德语 - 德国              [de-DE]    泰语 - 泰国              [th-TH]
	echo. 希腊语 - 希腊            [el-GR]    土耳其语 - 土耳其        [tr-TR]
	echo. 希伯来语 - 以色列        [he-IL]    乌克兰语 - 乌克兰        [uk-UA]
	echo. 匈牙利语 - 匈牙利        [hu-HU]
	echo. 意大利语 - 意大利        [it-IT]
	echo. 日语 - 日本              [ja-JP]
	echo. 朝鲜语 - 韩国            [ko-KR]   [X] 返回
)

if "%SelectedSourceOS%" equ "w81" (
	echo. 阿拉伯语 - 沙特阿拉伯    [ar-SA]    朝鲜语 - 韩国            [ko-KR]
	echo. 保加利亚语 - 保加利亚    [bg-BG]    拉脱维亚语 - 拉脱维亚    [lv-LV]
	echo. 中文 - 香港特别行政区    [zh-HK]    立陶宛语 - 立陶宛        [lt-LT]
	echo. 中文 - 简体              [zh-CN]    挪威语 - 挪威            [nb-NO]
	echo. 中文 - 台湾              [zh-TW]    波兰语 - 波兰            [pl-PL]
	echo. 克罗地亚语 - 克罗地亚    [hr-HR]    葡萄牙语 - 巴西          [pt-BR]
	echo. 捷克语 - 捷克共和国      [cs-CZ]    葡萄牙语 - 葡萄牙        [pt-PT]
	echo. 丹麦语 - 丹麦            [da-DK]    罗马尼亚语 - 罗马尼亚    [ro-RO]
	echo. 荷兰语 - 荷兰            [nl-NL]    俄语 - 俄罗斯            [ru-RU]
	echo. 英语 - 英国              [en-GB]    塞尔维亚语 - 塞尔维亚    [sr-Latn-CS]
	echo. 英语 - 美国              [en-US]    斯洛伐克语 - 斯洛伐克    [sk-SK]
	echo. 爱沙尼亚语 - 爱沙尼亚    [et-EE]    斯洛文尼亚语 - 斯洛文尼亚[sl-SI]
	echo. 芬兰语 - 芬兰            [fi-FI]    西班牙语 - 西班牙        [es-ES]
	echo. 法语 - 法国              [fr-FR]    瑞典语 - 瑞典            [sv-SE]
	echo. 德语 - 德国              [de-DE]    泰语 - 泰国              [th-TH]
	echo. 希腊语 - 希腊            [el-GR]    土耳其语 - 土耳其        [tr-TR]
	echo. 希伯来语 - 以色列        [he-IL]    乌克兰语 - 乌克兰        [uk-UA]
	echo. 匈牙利语 - 匈牙利        [hu-HU]
	echo. 意大利语 - 意大利        [it-IT]
	echo. 日语 - 日本              [ja-JP]	  [X] 返回
)

if "%SelectedSourceOS%" equ "w10" (
	echo. 阿拉伯语 - 沙特阿拉伯    [ar-SA]    日语 - 日本              [ja-JP]
	echo. 保加利亚语 - 保加利亚    [bg-BG]    朝鲜语 - 韩国            [ko-KR]
	echo. 中文 - 香港特别行政区    [zh-HK]    拉脱维亚语 - 拉脱维亚    [lv-LV]
	echo. 中文 - 简体              [zh-CN]    立陶宛语 - 立陶宛        [lt-LT]
	echo. 中文 - 台湾              [zh-TW]    挪威语 - 挪威            [nb-NO]
	echo. 克罗地亚语 - 克罗地亚    [hr-HR]    波兰语 - 波兰            [pl-PL]
	echo. 捷克语 - 捷克共和国      [cs-CZ]    葡萄牙语 - 巴西          [pt-BR]
	echo. 丹麦语 - 丹麦            [da-DK]    葡萄牙语 - 葡萄牙        [pt-PT]
	echo. 荷兰语 - 荷兰            [nl-NL]    罗马尼亚语 - 罗马尼亚    [ro-RO]
	echo. 英语 - 英国              [en-GB]    俄语 - 俄罗斯            [ru-RU]
	echo. 英语 - 美国              [en-US]    塞尔维亚语 - 塞尔维亚    [sr-Latn-RS]
	echo. 爱沙尼亚语 - 爱沙尼亚    [et-EE]    斯洛伐克语 - 斯洛伐克    [sk-SK]
	echo. 芬兰语 - 芬兰            [fi-FI]    斯洛文尼亚语 - 斯洛文尼亚[sl-SI]
	echo. 法语 - 加拿大            [fr-CA]    西班牙语 - 墨西哥        [es-MX]
	echo. 法语 - 法国              [fr-FR]    西班牙语 - 西班牙        [es-ES]
	echo. 德语 - 德国              [de-DE]    瑞典语 - 瑞典            [sv-SE]
	echo. 希腊语 - 希腊            [el-GR]    泰语 - 泰国              [th-TH]
	echo. 希伯来语 - 以色列        [he-IL]    土耳其语 - 土耳其        [tr-TR]
	echo. 匈牙利语 - 匈牙利        [hu-HU]    乌克兰语 - 乌克兰        [uk-UA]
	echo. 意大利语 - 意大利        [it-IT]    [X] 返回
)

if "%SelectedSourceOS%" equ "w11" (
	echo. 阿拉伯语 - 沙特阿拉伯    [ar-SA]    意大利语 - 意大利        [it-IT]
	echo. 巴斯克语 - 西班牙        [eu-ES]    日语 - 日本              [ja-JP]
	echo. 保加利亚语 - 保加利亚    [bg-BG]    朝鲜语 - 韩国            [ko-KR]
	echo. 加泰罗尼亚语 - 西班牙    [ca-ES]    拉脱维亚语 - 拉脱维亚    [lv-LV]
	echo. 中文 - 简体              [zh-CN]    立陶宛语 - 立陶宛        [lt-LT]
	echo. 中文 - 台湾              [zh-TW]    挪威语 - 挪威            [nb-NO]
	echo. 克罗地亚语 - 克罗地亚    [hr-HR]    波兰语 - 波兰            [pl-PL]
	echo. 捷克语 - 捷克共和国      [cs-CZ]    葡萄牙语 - 巴西          [pt-BR]
	echo. 丹麦语 - 丹麦            [da-DK]    葡萄牙语 - 葡萄牙        [pt-PT]
	echo. 荷兰语 - 荷兰            [nl-NL]    罗马尼亚语 - 罗马尼亚    [ro-RO]
	echo. 英语 - 英国              [en-GB]    俄语 - 俄罗斯            [ru-RU]
	echo. 英语 - 美国              [en-US]    塞尔维亚语 - 塞尔维亚    [sr-Latn-RS]
	echo. 爱沙尼亚语 - 爱沙尼亚    [et-EE]    斯洛伐克语 - 斯洛伐克    [sk-SK]
	echo. 芬兰语 - 芬兰            [fi-FI]    斯洛文尼亚语 - 斯洛文尼亚[sl-SI]
	echo. 法语 - 加拿大            [fr-CA]    西班牙语 - 墨西哥        [es-MX]
	echo. 法语 - 法国              [fr-FR]    西班牙语 - 西班牙        [es-ES]
	echo. 加利西亚语 - 西班牙      [gl-ES]    瑞典语 - 瑞典            [sv-SE]
	echo. 德语 - 德国              [de-DE]    泰语 - 泰国              [th-TH]
	echo. 希腊语 - 希腊            [el-GR]    土耳其语 - 土耳其        [tr-TR]
	echo. 希伯来语 - 以色列        [he-IL]    乌克兰语 - 乌克兰        [uk-UA]
	echo. 匈牙利语 - 匈牙利        [hu-HU]    越南语 - 越南            [vi-VN]
	echo. 印度尼西亚语 - 印度尼西亚[id-ID]    [X] 返回
)
echo.===============================================================================
set /p LanguagePackCode=请输入语言代码，不含‘[’‘]’：

if /i "%LanguagePackCode%" equ "X" goto :IntegrateMenu

cls
echo.===============================================================================
if "%LanguagePackType%" equ "Boot" echo.         MSMG 工具箱 - 集成 Windows 语言包到 Windows 安装程序启动映像
if "%LanguagePackType%" equ "Install" echo.             MSMG 工具箱 - 集成 Windows 语言包到 Windows 安装映像
if "%LanguagePackType%" equ "Recovery" echo.             MSMG 工具箱 - 集成 Windows 语言包到 Windows 恢复映像
echo.===============================================================================
echo.

:: 获取源映像索引体系结构
if "%LanguagePackType%" equ "Boot" (
	call :GetImageArchitecture "%BootWim%", 1 >nul
) else (
	call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul
)

:: 获取 Windows 语言包文件夹路径
if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%"

:: 检查 Windows PE 语言包文件夹是否是空的
if "%LanguagePackType%" equ "Boot" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" if not exist "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "20348" (
		for /d %%i in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
			if "%LanguagePackCode%" equ "%%i" if not exist "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows 语言包文件夹缺少以下文件……
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
)

:: 检查 Windows 语言或语言功能包文件夹是否是空的
if "%LanguagePackType%" equ "Install" (
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if not exist "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" if not exist "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Client" if not exist "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
)

:: 检查 Windows PE 语言包文件夹是否是空的
if "%LanguagePackType%" equ "Recovery" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w7" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if "%PackageArchitecture%" neq "arm" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "20348" (
		for /d %%i in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
			if "%LanguagePackCode%" equ "%%i" if not exist "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows 语言包文件夹缺少以下文件……
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "14393" if not exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\%LanguagePackCode%^> 文件夹……
		goto :Stop
	)
)
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####正在开始集成 Windows 语言包到 Windows 启动映像#############################
if "%LanguagePackType%" equ "Install" echo.####正在开始集成 Windows 语言包到 Windows 安装映像#############################
if "%LanguagePackType%" equ "Recovery" echo.####正在开始集成 Windows 语言包到 Windows 恢复映像#############################
echo.-------------------------------------------------------------------------------
echo.
if "%LanguagePackType%" equ "Boot" (
	echo.    映像文件名称             ：Boot.wim
	echo.    映像索引                 ：1、2
)
if "%LanguagePackType%" equ "Install" (
	echo.    映像文件名称             ：Install.wim
	echo.    映像索引                 ：%ImageIndexNo%
)
if "%LanguagePackType%" equ "Recovery" (
	echo.    映像文件名称             ：WinRE.wim
	echo.    映像索引                 ：1
)
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####正在集成 Windows 语言包到 Windows 启动映像#################################
if "%LanguagePackType%" equ "Install" echo.####正在集成 Windows 语言包到 Windows 安装映像#################################
if "%LanguagePackType%" equ "Recovery" echo.####正在集成 Windows 语言包到 Windows 恢复映像#################################
echo.-------------------------------------------------------------------------------
echo.
if "%LanguagePackType%" equ "Boot" (
	for /l %%i in (1, 1, 2) do (
		echo.==============================[Boot.wim，索引：%%i]==============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE 语言包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

			if "%ImageBuild%" geq "15063" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WinPE - AT Broker [%LanguagePackCode%] 到 Windows 启动映像……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WinPE - 音频核心 [%LanguagePackCode%] 到 Windows 启动映像……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WinPE - 音频驱动 [%LanguagePackCode%] 到 Windows 启动映像……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 增强的存储包 [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
		
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 讲述人 [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - IBS 支持包 [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - 脚本包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 安全启动包 [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)
	)

	echo.==============================[Boot.wim，索引：2]==============================
	echo.
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - 安装程序包到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE - 安装程序包 [%LanguagePackCode%] 到 Windows 启动映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%ImageInstallationType:~,6%" neq "Server" (
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 安装程序客户端包到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - 安装程序客户端包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	if "%ImageInstallationType:~,6%" equ "Server" (
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 安装程序服务器端包到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Packs%\LanguagePacks\%SelectedSourceOS%\%PackageVersion%\%ImageArchitecture%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - 安装程序服务器端包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	for /l %%i in (1, 1, 2) do (
		echo.==============================[Boot.wim，索引：%%i]==============================
		echo.
		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "20348" (
			for /d %%z in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
				if "%LanguagePackCode%" equ "%%z" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 WinPE - 语音、文本到语音转换 [%LanguagePackCode%] 到 Windows 启动映像……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				)
			)
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - 语音、文本到语音转换 [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WinPE - SRH [%LanguagePackCode%] 到 Windows 启动映像……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - SRT 包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - WDS 包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - WMI 包 [%LanguagePackCode%] 到 Windows 启动映像……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

		for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
			if "%LanguagePackCode%" equ "%%z" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WinPE - 字体支持包 [%LanguagePackCode%] 到 Windows 启动映像……
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w7" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.正在生成 Windows 启动映像语言包集成日志文件……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在写入 Windows 启动映像语言包集成日志……
		call :GetPackages "%BootMount%\%%i", "Boot-%%i.txt"
		echo.
	)

	echo.-------------------------------------------------------------------------------
	echo.正在创建 Windows 安装程序语言配置文件 [Lang.ini]……
	echo.-------------------------------------------------------------------------------
	%DISM% /Image:"%BootMount%\2" /Gen-LangINI /Distribution:"%DVD%"
	echo.
	echo.-------------------------------------------------------------------------------
	echo.正在集成 [%LanguagePackCode%] 本地化 Windows 安装资源到源 DVD 中……
	echo.-------------------------------------------------------------------------------
	echo.
	echo.正在将 Windows PE 语言包 [%LanguagePackCode%] 解压到临时文件夹……
	call :RemoveFolder "%Temp%\LanguagePack"
	call :CreateFolder "%Temp%\LanguagePack"

	if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
		if "%SelectedSourceOS%" equ "w7" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		if "%SelectedSourceOS%" equ "w81" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.正在复制本地化 Windows 安装程序资源到源 DVD 中……
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		if "%SelectedSourceOS%" equ "w81" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "15063" (
		expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.正在复制本地化 Windows 安装程序资源到源 DVD 中……
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-shmig-dl\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" if "%LanguagePackCode%" neq "en-US" (
		expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
		echo.
		echo.正在复制本地化 Windows 安装程序资源到源 DVD 中……
		call :CreateFolder "%DVD%\sources\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		echo.
	)

	echo.正在复制 Windows 安装程序语言配置文件到启动映像……
	copy /y "%DVD%\sources\lang.ini" "%BootMount%\2\sources\lang.ini" >nul
	echo.
)

if "%LanguagePackType%" equ "Install" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" (
			if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
			if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
			echo.
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 语言包 [%LanguagePackCode%]……
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
				if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 语言功能 - 基本包 [%LanguagePackCode%]……
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 语言功能 - 手写识别包 [%LanguagePackCode%]……
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 语言功能 - OCR 包 [%LanguagePackCode%]……
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 语言功能 - 文本到语音转换包 [%LanguagePackCode%]……
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 语言功能 - 语音包 [%LanguagePackCode%]……
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
						call :AddPackage "%InstallMount%\%%i", "%Temp%\LanguagePacks\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
					)
				)
			)

			echo.-------------------------------------------------------------------------------
			echo.正在更新 Windows 安装程序语言配置文件 [Lang.ini]……
			echo.-------------------------------------------------------------------------------
			%DISM% /Image:"%InstallMount%\%%i" /Gen-LangINI /Distribution:"%DVD%"
			echo.
			echo.-------------------------------------------------------------------------------
			echo.正在生成 Windows 语言包集成日志文件……
			echo.-------------------------------------------------------------------------------
			echo.
			echo.正在写入 Windows 语言包集成日志……
			call :GetPackages "%InstallMount%\%%i", "LanguagePacks_Install-%%i.txt"
			echo.
		)
	)

	echo.-------------------------------------------------------------------------------
	echo.正在集成 [%LanguagePackCode%] 本地化 Windows 安装资源到源 DVD 中……
	echo.-------------------------------------------------------------------------------
	echo.
	echo.正在将 Windows 语言包 [%LanguagePackCode%] 解压到临时文件夹……
	call :RemoveFolder "%Temp%\LanguagePack"
	call :CreateFolder "%Temp%\LanguagePack"
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" expand "%LanguagePacks%\Microsoft-Windows-Embedded-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-Refresh-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	echo.
	echo.正在复制本地化 Windows 安装程序资源到源 DVD 中……
	call :CreateFolder "%DVD%\sources\%LanguagePackCode%"

	if "%SelectedSourceOS%" equ "w7" (
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul

		if "%ImageInstallationType%" neq "Embedded" (
			call :CreateFolder "%DVD%\sources\sp1\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\etwproviders\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\sp1\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\sp1\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\sp1\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\sp1\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\sp1\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			echo.正在复制 Localized Windows Setup license files to the Source DVD...
			call :CreateFolder "%DVD%\sources\license\%LanguagePackCode%"
			call :CreateFolder "%DVD%\sources\sp1\license\%LanguagePackCode%"
			xcopy /y "%Temp%\LanguagePack\sources\license\%LanguagePackCode%\*.*" "%DVD%\sources\license\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\sp1\sources\license\%LanguagePackCode%\*.*" "%DVD%\sources\sp1\license\%LanguagePackCode%" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w81" (
		if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "15063" (
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" call :CreateFolder "%DVD%\sources\cli\%LanguagePackCode%"
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
		if "%ImageBuild%" leq "10586" if "%ImageInstallationType:~,6%" neq "Server" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\cli\*.*" "%DVD%\sources\cli\%LanguagePackCode%" >nul
		if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-shmig-dl\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-shmig-dl\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
		if "%ImageBuild%" neq "10240" if "%ImageBuild%" neq "10586" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
		xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
	)

	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "20348" (
		if "%ImageArchitecture%" equ "x86" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		if "%ImageBuild%" leq "17134" call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"

		if "%LanguagePackCode%" neq "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)

		if "%LanguagePackCode%" equ "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			if "%ImageArchitecture%" equ "x86" xcopy /y "%Temp%\LanguagePack\setup\sources\dlmanifests\microsoft-windows-iasserver-migplugin\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\dlmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\dlmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x64" xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-fabric-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-fabric-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			if "%ImageBuild%" leq "17134" xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-storagemigration\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-storagemigration\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w11" (
		call :CreateFolder "%DVD%\sources\etwproviders\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%"
		call :CreateFolder "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%"

		if "%LanguagePackCode%" neq "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\%LanguagePackCode%\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)

		if "%LanguagePackCode%" equ "en-US" (
			xcopy /y "%Temp%\LanguagePack\setup\sources\*.*" "%DVD%\sources\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\etwproviders\*.*" "%DVD%\sources\etwproviders\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-offlinefiles-core\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-shmig\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-shmig\%LanguagePackCode%" >nul
			xcopy /y "%Temp%\LanguagePack\setup\sources\replacementmanifests\microsoft-windows-sxs\*.*" "%DVD%\sources\replacementmanifests\microsoft-windows-sxs\%LanguagePackCode%" >nul
		)
	)
	echo.
)

if "%LanguagePackType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE 语言包 [%LanguagePackCode%] 到 Windows 恢复映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
    	call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		
    	if "%ImageBuild%" geq "17134" (
			if exist "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
    			echo.-------------------------------------------------------------------------------
			    echo.正在集成 WinPE - Appx 打包 [%LanguagePackCode%] 到 Windows 恢复映像……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
            )
		
		    if exist "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WinPE - Opc 服务 [%LanguagePackCode%] 到 Windows 恢复映像……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%", "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		    )
		
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - Appx 打包 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    )

	    if "%ImageBuild%" geq "15063" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - AT Broker [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - 音频核心 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - 音频驱动 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    )
	)
	
	if "%SelectedSourceOS%" neq "w7" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - 增强的存储包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	    if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - IBS 支持包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	)
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - HTA 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		
	    if "%ImageBuild%" geq "15063" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - 讲述人 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    )
	
	    if "%ImageBuild%" geq "17134" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - Opc 服务 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    )
	)
	
	if "%SelectedSourceOS%" neq "w7" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - Rejuv 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	    if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE - 脚本包 [%LanguagePackCode%] 到 Windows 恢复映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%SelectedSourceOS%" neq "w7" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - 安全启动包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	    if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	if "%SelectedSourceOS%" equ "w7" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - 安装程序包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - 安装程序客户端包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	)
	
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "20348" (
	    for /d %%z in (de-DE, en-GB, es-ES, es-MX, fr-CA, fr-FR, it-IT, ja-JP, ko-KR, pl-PL, pt-BR, pt-PT, ru-RU, zh-CN, zh-HK, zh-TW) do (
		    if "%LanguagePackCode%" equ "%%z" (
		        echo.-------------------------------------------------------------------------------
		        echo.正在集成 WinPE - 语音、文本到语音转换 [%LanguagePackCode%] 到 Windows 恢复映像……
		        echo.-------------------------------------------------------------------------------
		        call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		    )
	    )
	)
	
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - 语音、文本到语音转换 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - SRH [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE - SRT 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	
	if "%SelectedSourceOS%" neq "w7" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - Storage WMI 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	    if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
	
	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE - WDS 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WinPE - WiFi 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)

	echo.-------------------------------------------------------------------------------
	echo.正在集成 WinPE - WMI 包 [%LanguagePackCode%] 到 Windows 恢复映像……
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
		
	for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
	    if "%LanguagePackCode%" equ "%%z" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WinPE - 字体支持包 [%LanguagePackCode%] 到 Windows 恢复映像……
		    echo.-------------------------------------------------------------------------------
		    if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
		    if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab"
	    )
	)

	echo.-------------------------------------------------------------------------------
	echo.正在生成 Windows 恢复映像语言包集成日志文件……
	echo.-------------------------------------------------------------------------------
	echo.
	echo.正在写入 Windows 恢复映像语言包集成日志……
	echo.
	call :GetPackages "%WinReMount%", "LanguagePacks_Install_WinRE.txt"
)

echo.-------------------------------------------------------------------------------
echo.####正在清理临时文件和文件夹###################################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在清理临时文件夹……
call :RemoveFolder "%Temp%\LanguagePacks"
echo.
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####集成 Windows 语言包到 Windows 启动映像已完成###############################
if "%LanguagePackType%" equ "Install" echo.####集成 Windows 语言包到 Windows 安装映像已完成###############################
if "%LanguagePackType%" equ "Recovery" echo.####集成 Windows 语言包到 Windows 恢复映像已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set LanguagePacks=
set LanguagePackType=
set LanguagePackCode=

endlocal

:: 返回到集成语言包菜单
goto :IntLanguagePacksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 驱动菜单模组
::-------------------------------------------------------------------------------------------
:IntDriversMenu

setlocal

set DriverType=

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Windows 驱动菜单
echo.===============================================================================
echo.
echo.  [1]   集成到 Windows 安装程序启动映像
echo.
echo.  [2]   集成到 Windows 安装映像
echo.
echo.  [3]   集成到 Windows 恢复映像
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "请输入你的选项 ："
if errorlevel 4 goto :IntegrateMenu
if errorlevel 3 set DriverType=Recovery
if errorlevel 2 set DriverType=Install
if errorlevel 1 set DriverType=Boot

cls
echo.===============================================================================
if "%DriverType%" equ "Boot" echo.          MSMG 工具箱 - 集成 Windows 驱动到 Windows 安装程序启动映像
if "%DriverType%" equ "Install" echo.              MSMG 工具箱 - 集成 Windows 驱动到 Windows 安装映像
if "%DriverType%" equ "Recovery" echo.              MSMG 工具箱 - 集成 Windows 驱动到 Windows 恢复映像
echo.===============================================================================
echo.

if "%DriverType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows 安装程序启动映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 安装程序启动映像……
	goto :Stop
)

if "%DriverType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows 恢复映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 恢复映像……
	goto :Stop
)

:: 获取源映像索引体系结构
if "%DriverType%" equ "Boot" (
		call :GetImageArchitecture "%BootWim%", 1 >nul
) else (
	call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul
)

:: 设置 Windows 驱动文件夹路径
if "%DriverType%" equ "Boot" set "Drivers=%Drivers%\WinPE\%SelectedSourceOS%\%ImageArchitecture%"
if "%DriverType%" equ "Install" set "Drivers=%Drivers%\Install\%SelectedSourceOS%\%ImageArchitecture%"
if "%DriverType%" equ "Recovery" set "Drivers=%Drivers%\WinPE\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查 Windows 驱动文件夹是否是空的
for /f %%i in ('dir /b /s /a:-d "%Drivers%\*.*" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		if "%DriverType%" equ "Boot" echo.Windows 驱动文件夹 ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
		if "%DriverType%" equ "Install" echo.Windows 驱动文件夹 ^<Drivers\Install\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
		if "%DriverType%" equ "Recovery" echo.Windows 驱动文件夹 ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
		echo.
		echo.请复制 Windows 驱动文件到相应的文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####正在开始集成 Windows 驱动到 Windows 启动映像###############################
if "%DriverType%" equ "Install" echo.####正在开始集成 Windows 驱动到 Windows 安装映像###############################
if "%DriverType%" equ "Recovery" echo.####正在开始集成 Windows 驱动到 Windows 恢复映像###############################
echo.-------------------------------------------------------------------------------
echo.
if "%DriverType%" equ "Boot" (
	echo.    映像文件名称             ：Boot.wim
	echo.    映像索引                 ：2
)
if "%DriverType%" equ "Install" (
	echo.    映像文件名称             ：Install.wim
	echo.    映像索引                 ：%ImageIndexNo%
)
if "%DriverType%" equ "Recovery" (
	echo.    映像文件名称             ：WinRE.wim
	echo.    映像索引                 ：1
)
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####正在集成 Windows 驱动到 Windows 启动映像###################################
if "%DriverType%" equ "Install" echo.####正在集成 Windows 驱动到 Windows 安装映像###################################
if "%DriverType%" equ "Recovery" echo.####正在集成 Windows 驱动到 Windows 恢复映像###################################
echo.-------------------------------------------------------------------------------
echo.

if "%DriverType%" equ "Boot" (
	call :AddDriver "%BootMount%\2", "%Drivers%"
)

if "%DriverType%" equ "Install" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" (
			echo.
			if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
			if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
			call :AddDriver "%InstallMount%\%%i", "%Drivers%"
		)
	)
)

if "%DriverType%" equ "Recovery" (
	call :AddDriver "%WinReMount%", "%Drivers%"
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####集成 Windows 驱动到 Windows 启动映像已完成###################################
if "%DriverType%" equ "Install" echo.####集成 Windows 驱动到 Windows 安装映像已完成###################################
if "%DriverType%" equ "Recovery" echo.####集成 Windows 驱动到 Windows 恢复映像已完成###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Drivers=
set DriverType=

endlocal

:: 返回到集成驱动菜单
goto :IntDriversMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET Framework 3.5 模组
::-------------------------------------------------------------------------------------------
:IntNetFX35

setlocal

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 集成 Microsoft .NET Framework 3.5
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据源映像体系结构设置 Microsoft .NET Framework 3.5 功能包文件夹路径
if "%SelectedSourceOS%" equ "w81" (
	if exist "%DVD%\sources\sxs" (
		set "NetFX35=%DVD%\sources\sxs"
	) else (
		set "NetFX35=%NetFX35%\%SelectedSourceOS%\%ImageArchitecture%"
	)
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	if exist "%DVD%\sources\sxs\*.cab" (
		if "%ImageBuild%" leq "16299" set "NetFX35=%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package.cab"
		if "%ImageBuild%" geq "17134" set "NetFX35=%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	) else (
		set "NetFX35=%NetFX35%\%SelectedSourceOS%\%PackageVersion%\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
)

:: 检查 Microsoft .NET Framework 3.5 功能包文件夹是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%NetFX35%\msil_system.net_b03f5f7f11d50a3a_6.3.9600.16384_none_78f2900af99c8442\system.net.dll" (
	echo.Microsoft .NET Framework 3.5 包文件夹丢失或者是空的……
	echo.
	echo.请将文件复制到 ^<Packs\NetFX35\w81\%ImageArchitecture%^> 文件夹……
	echo.
	goto :Stop
)

:: 检查 Microsoft .NET Framework 3.5 功能包文件夹是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist %NetFX35% (
	echo.Microsoft .NET Framework 3.5 包文件丢失……
	echo.
	if "%ImageBuild%" leq "16299" echo.请从源 DVD 中将文件“microsoft-windows-netfx3-ondemand-package.cab”复制到 ^<DVD\sources\sxs^> 文件夹
	if "%ImageBuild%" geq "17134" echo.请从源 DVD 中将文件“microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab”复制到 ^<DVD\sources\sxs^> 文件夹
	echo.
	echo.或者复制以下工具箱适配包文件到 ^<Packs\NetFX35\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	echo.
	echo.“Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab”
	echo.
	goto :Stop
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%NetFX35%" neq "%DVD%\sources\sxs\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" if exist %NetFX35% (
	copy /y %NetFX35% "%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
	set "NetFX35=%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Framework 3.5##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Framework 3.5######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在检查 Microsoft .NET Framework 3.5 是否已启用……
		echo.-------------------------------------------------------------------------------
		echo.
		if "%SelectedSourceOS%" equ "w81" (
			%DISM% /Image:"%InstallMount%\%%i" /Get-FeatureInfo /FeatureName:NetFX3 | findstr /c:"State : Enable Pending" >nul
			if errorlevel 1 (
				echo.Microsoft .NET Framework 3.5 尚未启用。
				echo.
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Enable-Feature /All /LimitAccess /FeatureName:NetFX3 /Source:%NetFX35%
			) else (
				echo.Microsoft .NET Framework 3.5 已经被启用。
			)
		)
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			%DISM% /Image:"%InstallMount%\%%i" /Get-FeatureInfo /FeatureName:NetFx3 | findstr /c:"State : Enabled" >nul
			if errorlevel 1 (
				echo.Microsoft .NET Framework 3.5 尚未启用。
				echo.
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-Package:%NetFX35%
			) else (
				echo.Microsoft .NET Framework 3.5 已经被启用。
			)
		)
	)
)

call :RemoveFile "%Temp%\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Framework 3.5 已完成###################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause

set NetFX35=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
::-------------------------------------------------------------------------------------------
:: 集成适用于 Windows 10 v1507 和 v1511 源操作系统的 Microsoft .NET Framework 4.6.2 模组
::-------------------------------------------------------------------------------------------
:IntNetFX462

setlocal

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Microsoft .NET Framework 4.6.2
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft .NET Framework 4.6.2 包文件是否存在
if not exist "%NetFX462%\Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft .NET Framework 4.6.2 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX462^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft .NET Framework 4.6.2 包文件是否存在
if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
	if not exist "%NetFX462%\Windows10.0-KB4051600-%ImageArchitecture%.cab" (
		echo.Microsoft .NET Framework 4.6.2 包文件夹缺少以下文件……
		echo.
		echo."Windows10.0-KB4051600-%ImageArchitecture%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\NetFX462^> 文件夹……
		goto :Stop
	)
)

:: 检查 Microsoft .NET Framework 4.6.2 包文件是否存在
if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" (
	if not exist "%NetFX462%\Windows10.0-KB4054057-%ImageArchitecture%.cab" (
		echo.Microsoft .NET Framework 4.6.2 包文件夹缺少以下文件……
		echo.
		echo."Windows10.0-KB4054057-%ImageArchitecture%.cab""
		echo.
		echo.请复制上述文件到 ^<Packs\NetFX462^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Framework 4.6.2################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Framework 4.6.2####################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft .NET Framework 4.6.2 基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if exist "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft .NET Framework 4.6.2 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
		)

		if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft .NET Framework 4.6.2 更新程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4051600-%ImageArchitecture%.cab"
		)

		if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft .NET Framework 4.6.2 更新程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4054057-%ImageArchitecture%.cab"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Framework 4.6.2 已完成#################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set NetFX462=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

:: 集成 Microsoft .NET Framework 4.8 模组
::-------------------------------------------------------------------------------------------
:IntNetFX48

setlocal

set NetFX48Pkg=
set NetFX48LpPkg=

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 集成 Microsoft .NET Framework 4.8
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Microsoft .NET Framework 4.8 包文件夹路径
set "NetFX48=%NetFX48%\%SelectedSourceOS%"

:: 设置映像程序包服务包内部版本等级
if "%SelectedSourceOS%" equ "w10" (
   if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "15063" (
      set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
      set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.14393.0.cab"
   )

   if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" (
      set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
      set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.16299.15.cab"
   )
)

:: 检查 Microsoft .NET Framework 4.8 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\Windows6.1-KB4019990-%ImageArchitecture%.cab" (
	echo.Microsoft .NET Framework 4.8 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB4019990-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX48\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft .NET Framework 4.8 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\NetFX48.tpk" (
	echo.Microsoft .NET Framework 4.8 包文件夹缺少以下文件……
	echo.
	echo."NetFX48.tpk"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX48\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft .NET Framework 4.8 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%NetFX48%\NetFX48_%ImageArchitecture%.reg" (
	echo.Microsoft .NET Framework 4.8 包文件夹缺少以下文件……
	echo.
	echo."NetFX48_%ImageArchitecture%.reg"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX48\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft .NET Framework 4.8 包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%NetFX48%\Microsoft-Windows-NetFx48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab" (
	echo.Microsoft .NET Framework 4.8 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-NetFx48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX48\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft .NET Framework 4.8 包文件是否存在
if "%SelectedSourceOS%" equ "w10" if not exist "%NetFX48%\%NetFX48Pkg%" (
	echo.Microsoft .NET Framework 4.8 包文件夹缺少以下文件……
	echo.
	echo."%NetFX48Pkg%"
	echo.
	echo.请复制上述文件到 ^<Packs\NetFX48\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Framework 4.8##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Framework 4.8######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			echo.
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft .NET Framework 4.8 先决条件更新包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Windows6.1-KB4019990-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft .NET Framework 4.8 基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%NetFX48%\NetFX48.tpk", %PackageIndex%, "%InstallMount%\%%i"

			if exist "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :ApplyImage "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
			)

			echo.-------------------------------------------------------------------------------
			echo.正在合并 Microsoft .NET Framework 4.8 注册表设置……
			echo.-------------------------------------------------------------------------------
			echo.
			echo.正在安装映像注册表……
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.正在将注册表设置合并到映像注册表……
			call :ImportRegistry2Image "%NetFX48%\NetFX48_%ImageArchitecture%.reg"

			if exist "%NetFX48%\NetFX48_%ImageArchitecture%_%ImageDefaultLanguage%.reg" call :ImportRegistry2Image "%NetFX48%\NetFX48_%ImageArchitecture%_%ImageDefaultLanguage%.reg"

			echo.正在卸载映像注册表……
			call :UnMountImageRegistry
			echo.
		)

		if "%SelectedSourceOS%" equ "w81" (
			if not exist "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
			)

			if exist "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
				echo.
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 4.8 基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			)
		)

		if "%SelectedSourceOS%" equ "w10" (
			if not exist "%NetFX48%\%NetFX48LpPkg%" call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48Pkg%"

			if exist "%NetFX48%\%NetFX48LpPkg%" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 4.8 基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48Pkg%"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48LpPkg%"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Framework 4.8 已完成###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set NetFX48=
set NetFX48Pkg=
set NetFX48LpPkg=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET 5 模组
::-------------------------------------------------------------------------------------------
:IntNET5

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Microsoft .NET 5
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft .NET 5 包文件是否存在
if not exist "%NET5%\NET5_%SelectedSourceOS%.tpk" (
	echo.Microsoft .NET 5 包文件夹缺少以下文件……
	echo.
	echo."NET5_%SelectedSourceOS%.tpk"
	echo.
	echo.请复制上述文件到 ^<Packs\NET5^> 文件夹……
	goto :Stop
)

if not exist "%NET5%\NET5_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft .NET 5 包文件夹缺少以下文件……
	echo.
	echo."NET5_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.请复制上述文件到 ^<Packs\NET5^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET 5##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET 5##################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft .NET 5 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NET5%\NET5_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft .NET 5 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%NET5%\NET5_%SelectedSourceOS%_%ImageArchitecture%.reg"

		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET 5 已完成###############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Internet Explorer 11 模组
::-------------------------------------------------------------------------------------------
:IntIE11

setlocal

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Microsoft Internet Explorer 11
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft Internet Explorer 11 包文件是否存在
if not exist "%IE11%\Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft Internet Explorer 11 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\IE11^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Internet Explorer 11 包文件是否存在
if not exist "%IE11%\Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Microsoft Internet Explorer 11 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\IE11^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Internet Explorer 11 包文件是否存在
if "%ImageDefaultLanguage%" equ "en-US" if not exist "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab" (
	echo.Microsoft Internet Explorer 11 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\IE11^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Internet Explorer 11 包文件是否存在
if "%ImageDefaultLanguage%" equ "en-US" if not exist "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab" (
	echo.Microsoft Internet Explorer 11 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\IE11^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Internet Explorer 11 包文件是否存在
if "%ImageDefaultLanguage%" neq "en-US" if not exist "%IE11%\Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
	echo.Microsoft Internet Explorer 11 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\IE11^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Internet Explorer 11################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Internet Explorer 11####################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Internet Explorer 11 先决条件包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-PlatformUpdate-Win7-SRV08R2-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Internet Explorer 11 基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if "%ImageDefaultLanguage%" equ "en-US" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Internet Explorer 11 连字符包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Internet Explorer 11 拼写包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
		) else (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Internet Explorer 11 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-InternetExplorer-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"

			if exist "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Internet Explorer 11 连字符包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Internet Explorer 11 连字符包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
			)

			if exist "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Internet Explorer 11 拼写包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Internet Explorer 11 拼写包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Internet Explorer 11 已完成###########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set IE11=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成远程桌面协议（RDP）8.0 和 8.1 模组
::-------------------------------------------------------------------------------------------
:IntRDP81

setlocal

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 集成远程桌面协议 ^(RDP^) 8.0 和 8.1
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查远程桌面协议（RDP）8.0 和 8.1 包文件是否存在
if not exist "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程桌面协议 ^(RDP^) 8.0 和 8.1 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RDP81^> 文件夹……
	goto :Stop
)

:: 检查远程桌面协议（RDP）8.0 和 8.1 包文件是否存在
if not exist "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程桌面协议 ^(RDP^) 8.0 和 8.1 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RDP81^> 文件夹……
	goto :Stop
)

:: 检查远程桌面协议（RDP）8.0 和 8.1 包文件是否存在
if not exist "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程桌面协议 ^(RDP^) 8.0 和 8.1 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RDP81^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成远程桌面协议 ^(RDP^) 8.0 和 8.1##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成远程桌面协议 ^(RDP^) 8.0 和 8.1######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成远程桌面协议 ^(RDP^) 8.0 和 8.1 先决条件包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成远程桌面协议 ^(RDP^) 8.0 和 8.1 先决条件包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成远程桌面协议 ^(RDP^) 8.0 和 8.1 程序包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成远程桌面协议 ^(RDP^) 8.0 和 8.1 已完成###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set RDP81=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows Management Framework（WMF）5.1 模组
::-------------------------------------------------------------------------------------------
:IntWMF

setlocal

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 集成 Windows Management Framework ^(WMF^) 5.1
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选源操作系统设置 Windows Management Framework（WMF）5.1 包文件夹路径
set "WMF=%WMF%\%SelectedSourceOS%"

:: 检查 Windows Management Framework（WMF）5.1 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if "%ImageArchitecture%" equ "x64" if not exist "%WMF%\Windows6.1-KB2809215-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB2809215-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMF\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows Management Framework（WMF）5.1 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB2872035-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB2872035-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMF\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows Management Framework（WMF）5.1 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB3033929-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB3033929-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMF\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows Management Framework（WMF）5.1 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%WMF%\Windows6.1-KB3191566-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB3191566-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMF\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows Management Framework（WMF）5.1 包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%WMF%\Windows8.1-KB3191564-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows8.1-KB3191564-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMF\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows Management Framework ^(WMF^) 5.1########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows Management Framework ^(WMF^) 5.1############################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			if "%ImageArchitecture%" equ "x64" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Management Framework ^(WMF^) 5.1 先决条件包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2809215-%ImageArchitecture%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Management Framework ^(WMF^) 5.1 先决条件包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2872035-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Management Framework ^(WMF^) 5.1 先决条件包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3033929-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Management Framework ^(WMF^) 5.1 功能包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3191566-%ImageArchitecture%.cab"
		)

		if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows8.1-KB3191564-%ImageArchitecture%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows Management Framework ^(WMF^) 5.1 已完成#########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set WMF=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Win32 计算器模组
::-------------------------------------------------------------------------------------------
:IntWin32Calc

setlocal

cls
echo.===============================================================================
echo.                  MSMG 工具箱 - 集成 Microsoft Win32 计算器
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft Win32 计算器包文件是否存在
if not exist "%Win32Calc%\Win32Calc.tpk" (
	echo.Microsoft Win32 计算器包文件夹缺少以下文件……
	echo.
	echo."Win32Calc.tpk"
	echo.
	echo.请复制上述文件到 ^<Packs\Win32Calc^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Win32 计算器包文件是否存在
if not exist "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft Win32 计算器包文件夹缺少以下文件……
	echo.
	echo."Win32Calc_%ImageDefaultLanguage%.tpk"
	echo.
	echo.请复制上述文件到 ^<Packs\Win32Calc^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Win32 计算器包文件是否存在
if not exist "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg" (
	echo.Microsoft Win32 计算器包文件夹缺少以下文件……
	echo.
	echo."Win32Calc_%ImageArchitecture%.reg"
	echo.
	echo.请复制上述文件到 ^<Packs\Win32Calc^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Win32 计算器########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Win32 计算器############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Win32 计算器基础数据包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Win32Calc%\Win32Calc.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Win32 计算器 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft Win32 计算器注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Win32 计算器已完成##########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Win32Calc=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 重复数据删除模组
::-------------------------------------------------------------------------------------------
:IntDedup

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows 重复数据删除
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查源操作系统是否不是 64-位
if "%ImageArchitecture%" neq "x64" (
	echo.此功能不适用于 32-位源操作系统……
	goto :Stop
)

:: 根据所选源操作系统设置 Windows 重复数据删除包文件夹路径
set "FSSMRESReg=%Dedup%\fssmres.dll.reg"
if "%SelectedSourceOS%"=="w81" set "Dedup=%Dedup%\%SelectedSourceOS%"
if "%SelectedSourceOS%"=="w10" set "Dedup=%Dedup%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
	if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 重复数据删除包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
		goto :Stop
	)

	if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 重复数据删除包文件夹缺少以下文件……
		echo.
		echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
		goto :Stop
	)
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" (
	for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
		if "%ImageDefaultLanguage%" equ "%%j" (
			if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows 重复数据删除包文件夹缺少以下文件……
				echo.
				echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
				goto :Stop
			)

			if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows 重复数据删除包文件夹缺少以下文件……
				echo.
				echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
				goto :Stop
			)
		)
	)
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 重复数据删除包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 重复数据删除包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Dedup\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 重复数据删除##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 重复数据删除##############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 文件服务器基础数据包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 文件服务器 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 重复数据删除基础数据包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 重复数据删除 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if "%ImageBuild%" equ "10586" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------

				if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
					echo.正在集成 Windows 文件服务器 [en-US] 语言包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
					if "%ImageDefaultLanguage%" equ "%%j" (
						echo.正在集成 Windows 文件服务器 [%ImageDefaultLanguage%] 语言包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)
				)

				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------

				if "%ImageDefaultLanguage%" neq "de-DE" if "%ImageDefaultLanguage%" neq "es-ES" if "%ImageDefaultLanguage%" neq "fr-FR" if "%ImageDefaultLanguage%" neq "it-IT" if "%ImageDefaultLanguage%" neq "ja-JP" if "%ImageDefaultLanguage%" neq "ko-KR" if "%ImageDefaultLanguage%" neq "pt-BR" if "%ImageDefaultLanguage%" neq "ru-RU" if "%ImageDefaultLanguage%" neq "tr-TR" if "%ImageDefaultLanguage%" neq "zh-CN" if "%ImageDefaultLanguage%" neq "zh-TW" (
					echo.正在集成 Windows 重复数据删除 [en-US] 语言包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				for %%j in (de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, zh-CN, zh-TW) do (
					if "%ImageDefaultLanguage%" equ "%%j" (
						echo.正在集成 Windows 重复数据删除 [%ImageDefaultLanguage%] 语言包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)
				)
			)

			if "%ImageBuild%" equ "14393" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if exist "%Dedup%\Updates\*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 重复数据删除更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Updates"
				)
			)

			if "%ImageBuild%" equ "15063" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心 [en-US] 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除 [en-US] 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			if "%ImageBuild%" geq "16299" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 文件服务器核心 [%ImageDefaultLanguage%] 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除 [%ImageDefaultLanguage%] 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)

			if exist "%Dedup%\Updates\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 重复数据删除更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Updates"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.正在启用 Windows 重复数据删除功能……
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w81" (
			call :EnableFeature "%InstallMount%\%%i", "Dedup-Core /All"
			echo.-------------------------------------------------------------------------------
			echo.正在启用 Windows 文件服务搜索服务功能……
			echo.-------------------------------------------------------------------------------
			call :EnableFeature "%InstallMount%\%%i", "File-Services-Search-Service /All"
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" call :EnableFeature "%InstallMount%\%%i", "Dedup-Core /All"

		echo.-------------------------------------------------------------------------------
		echo.正在合并 Windows 文件服务器 ^(fssmres.dll^) 修复注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%FSSMRESReg%"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows 重复数据删除已完成############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Dedup=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows To Go 工作区模组
::-------------------------------------------------------------------------------------------
:IntWinToGo

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows To Go 工作区
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Windows To Go 工作区包路径
if "%SelectedSourceOS%" equ "w81" set "WinToGo=%WinToGo%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "WinToGo=%WinToGo%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows To Go 工作区包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG.tpk" (
	echo.Windows To Go 工作区包文件“WTG.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\WinToGo\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows To Go 工作区包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG_%ImageDefaultLanguage%.tpk" (
	echo.Windows To Go 工作区包文件“WTG_%ImageDefaultLanguage%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\WinToGo\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows To Go 工作区包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG_%ImageArchitecture%.reg" (
	echo.Windows To Go 工作区包文件“WTG_%ImageArchitecture%.reg”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\WinToGo\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows To Go 工作区包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go 工作区包文件夹缺少以下文件……
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WinToGo\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows To Go 工作区包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go 工作区包文件夹缺少以下文件……
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WinToGo\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows To Go 工作区##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows To Go 工作区##############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows To Go 工作区基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows To Go 工作区 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在合并 Windows To Go 工作区注册表设置……
			echo.-------------------------------------------------------------------------------
			echo.
			echo.正在安装映像注册表……
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.正在将注册表设置合并到映像注册表……
			call :ImportRegistry2Image "%WinToGo%\WTG_%ImageArchitecture%.reg"
			echo.正在卸载映像注册表……
			call :UnMountImageRegistry
		)

		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows To Go 工作区基础数据包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows To Go 工作区 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows To Go 工作区已完成############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set WinToGo=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 系统恢复模组
::-------------------------------------------------------------------------------------------
:IntSystemRestore

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Windows 系统恢复
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Windows 系统恢复包路径
if "%SelectedSourceOS%" equ "w7" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 系统恢复包文件是否存在
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 系统恢复包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.请复制上述文件到 ^<Packs\SystemRestore\%SelectedSourceOS%^> 文件夹……
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.请复制上述文件到 ^<Packs\SystemRestore\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 系统恢复包文件是否存在
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 系统恢复包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.请复制上述文件到 ^<Packs\SystemRestore\%SelectedSourceOS%^> 文件夹……
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.请复制上述文件到 ^<Packs\SystemRestore\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 系统恢复##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 系统恢复##################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 系统恢复基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 系统恢复 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 系统恢复已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set SystemRestore=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Edge 经典浏览器模组
::-------------------------------------------------------------------------------------------
:IntEdgeClassic

setlocal

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 集成 Microsoft Edge 经典浏览器
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Edge 经典浏览器包路径
set "EdgeClassic=%EdgeClassic%\%PackageVersion%"

:: 检查 Microsoft Edge 经典浏览器包文件是否存在
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge 经典浏览器包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\EdgeBrowser\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft Edge 经典浏览器包文件是否存在
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge 经典浏览器包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\EdgeBrowser\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Edge 经典浏览器#####################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Edge 经典浏览器#########################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge 经典浏览器基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge 经典浏览器 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

		:: 合并注册表修复以启用集成 Windows 10 累积更新。
		if "%ImageBuild%" lss "17763" (
			for %%j in (EnterpriseS, ServerStandard, ServerDatacenter) do (
				if "%ImageEdition%" equ "%%j" if exist "%InstallMount%\%%i\Windows\servicing\packages\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~*.mum" (
					call :MountImageRegistry "%InstallMount%\%%i"
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.mum" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs.bin.%PackageArchitecture%fre.dep\mergedcomponents\images\client\packages\\" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "Visibility" /t REG_DWORD /d "1" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeHigh" /t REG_DWORD /d "30531506" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeLow" /t REG_DWORD /d "76431985" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
					call :UnMountImageRegistry
				)
			)

			if "%ImageEdition%" equ "EnterpriseSN" if exist "%InstallMount%\%%i\Windows\servicing\packages\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~*.mum" (
				call :MountImageRegistry "%InstallMount%\%%i"
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.mum" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs.bin.%PackageArchitecture%fre.dep\mergedcomponents\images\client\packages\\" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "Visibility" /t REG_DWORD /d "1" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeHigh" /t REG_DWORD /d "30531506" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallTimeLow" /t REG_DWORD /d "76431985" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
				call :UnMountImageRegistry
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Edge 浏览器已完成###########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set EdgeClassic=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Edge Chromium 浏览器模组
::-------------------------------------------------------------------------------------------
:IntEdgeChromium

setlocal

set "EdgeChrGPD=%EdgeChromium%\GroupPolicy"

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Microsoft Edge Chromium 浏览器
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Microsoft Edge Chromium 浏览器包路径
if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Microsoft Edge Chromium 浏览器包文件是否存在
if not exist "%EdgeChromium%\Windows*-%ImageArchitecture%.cab" (
	echo.Microsoft Edge Chromium 浏览器包文件夹是空的……
	echo.
	echo.请复制文件到 ^<Packs\EdgeChromium\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

if "%SelectedSourceOS%" equ "w7" (
	for %%i in (KB4474419-v3,KB4490628,KB4592510,KB5001027) do (
		if not exist "%EdgeChromium%\Windows6.1-%%i-%ImageArchitecture%.cab" (
			echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
			echo.
			echo."Windows6.1-%%i-%ImageArchitecture%.cab"
			echo.
			echo.请复制上述文件到 ^<Packs\EdgeChromium\%SelectedSourceOS%^> 文件夹……
			goto :Stop
		)
	)
)

if "%SelectedSourceOS%" equ "w81" (
	if not exist "%EdgeChromium%\Windows6.1-KB5001027-%ImageArchitecture%.cab" (
		echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
		echo.
		echo."Windows8.1-KB5001027-%ImageArchitecture%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\EdgeChromium\%SelectedSourceOS%^> 文件夹……
		goto :Stop
	)
)

if not exist "%EdgeChrGPD%\EdgeChrGPD.tpk" (
	echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
	echo.
	echo.EdgeChrGPD.tpk
	echo.
	echo.请复制上述文件到 ^<Packs\EdgeChromium\GroupPolicy^> 文件夹……
	goto :Stop
)

for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
	if "%ImageDefaultLanguage%" equ "%%k" (
		if not exist "%EdgeChrGPD%\EdgeChrGPD_%%k.tpk" (
			echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
			echo.
			echo.EdgeChrGPD_%%k.tpk
			echo.
			echo.请复制上述文件到 ^<Packs\EdgeChromium\GroupPolicy^> 文件夹……
			goto :Stop
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Edge Chromium 浏览器################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Edge Chromium 浏览器####################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 服务堆栈更新 ^(SSU^) ^(KB4490628^) 程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4490628-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 服务堆栈更新 ^(SSU^) ^(KB4592510^) 程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4592510-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows SHA-2 代码更新 ^(KB4474419^) 程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4474419-v3-%ImageArchitecture%.cab"

			set EsuFoundation=
			if "%ImageInstallationType%" equ "Client" set "EsuFoundation=windowsfoundation_31bf3856ad364e35"
			if "%ImageInstallationType%" equ "Embedded" set "EsuFoundation=windowsembe..dfoundation_31bf3856ad364e35"
			if "%ImageInstallationType:~,6%" equ "Server" set "EsuFoundation=windowsserverfoundation_31bf3856ad364e35"

			:: 应用 Windows 7 延长安全更新（ESU）抑制补丁
			echo.
			echo.-------------------------------------------------------------------------------
			echo.应用 Windows 7 延长安全更新 ^(ESU^) 抑制补丁……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%W7ESU%\ESU.tpk", %PackageIndex%, "%InstallMount%\%%i"

			call :MountImageRegistry "%InstallMount%\%%i"

			for /f "tokens=5 delims=\" %%a in ('reg query "HKLM\TK_COMPONENTS\DerivedData\Components" ^| findstr "%ImageArchitecture%_!EsuFoundation!"') do (set "EsuFoundation=%%a")

			if "%ImageArchitecture%" equ "x86" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D7838362C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "S256H" /t REG_BINARY /d "343B7E8DE2FE932E2FA1DB0CDFE69BB648BEE8E834B41728F1C83A12C1766ECB" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			if "%ImageArchitecture%" equ "x64" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D616D6436342C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "S256H" /t REG_BINARY /d "45D0AE442FD92CE32EE1DDC38EA3B875EAD9A53D6A17155A10FA9D9E16BEDEB2" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			call :UnMountImageRegistry

			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Edge Chromium 浏览器程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB5001027-%ImageArchitecture%.cab"

			call :MountImageRegistry "%InstallMount%\%%i"

			if "%ImageArchitecture%" equ "x86" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_b26c9b4c15d241fc" /f >nul 2>&1
			)

			if "%ImageArchitecture%" equ "x64" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_0e8b36cfce2fb332" /f >nul 2>&1
			)

			call :UnMountImageRegistry
		)

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Edge Chromium 浏览器程序包……
			echo.-------------------------------------------------------------------------------
			for /f %%j IN ('"dir /b %EdgeChromium%\Windows*-%ImageArchitecture%.cab" 2^>nul') do (
				call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\%%j"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge Chromium 浏览器组策略基础数据包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChrGPD%\EdgeChrGPD.tpk", 1, "%InstallMount%\%%i"

		for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
			if "%ImageDefaultLanguage%" equ "%%k" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Edge Chromium 浏览器组策略 [%%k] 程序包……
				echo.-------------------------------------------------------------------------------
				call :ApplyImage "%EdgeChrGPD%\EdgeChrGPD_%%k.tpk", 1, "%InstallMount%\%%i"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Edge Chromium 浏览器已完成##################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set EdgeChrGPD=
set EdgeChromium=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 盲文辅助功能模组
::-------------------------------------------------------------------------------------------
:IntBraille

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows 盲文辅助功能
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置盲文包路径
set "Braille=%Braille%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 盲文辅助功能包文件是否存在
if not exist "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 盲文辅助功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\Braille\%PackageVersion%^> 文件夹……
	goto :Stop
)

call :RemoveFile "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
if "%ImageBuild%" geq "17763" copy /y "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 盲文辅助功能##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 盲文辅助功能##############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	)
)

call :RemoveFile "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 盲文辅助已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Braille=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows Multimedia Restricted Codecs 模组
::-------------------------------------------------------------------------------------------
:IntMMRC

setlocal

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 集成 Windows Multimedia Restricted Codecs
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Multimedia Restricted Codecs 包路径
set "MMRC=%MMRC%\%SelectedSourceOS%\%PackageVersion%"

:: 设置 Multimedia Restricted Codecs 包路径
if not exist "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
	echo.
	echo."Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
	goto :Stop
)

if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
	echo.
	echo."Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
	goto :Stop
)

if "%ImageInstallationType%" equ "Server" (
	if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
		echo.
		echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
		goto :Stop
	)

	if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
		echo.
		echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
		goto :Stop
	)

	if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
		echo.
		echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
		goto :Stop
	)

	if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Multimedia Restricted Codecs 包文件夹缺少以下文件……
		echo.
		echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows Multimedia Restricted Codecs##########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows Multimedia Restricted Codecs##############################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows Multimedia Restricted Dolby Codec 基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows Multimedia Restricted Dolby Codec [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------

		if "%ImageArchitecture%" equ "x64" (
			echo.正在集成 Windows Multimedia Restricted Dolby Codec WOW64 基础数据包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Multimedia Restricted Dolby Codec WOW64 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsDolby-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		)

		if "%ImageInstallationType%" equ "Server" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Multimedia Restricted Extended Codecs 基础数据包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Multimedia Restricted Extended Codecs [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------

			if "%ImageArchitecture%" equ "x64" (
				echo.正在集成 Windows Multimedia Restricted Extended Codecs WOW64 基础数据包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Multimedia Restricted Extended Codecs WOW64 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows Multimedia Restricted Codecs 已完成###########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set MMRC=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成适用于 Linux 的 Windows 子系统（WSL）模组
::-------------------------------------------------------------------------------------------
:IntWSL

setlocal

cls
echo.===============================================================================
echo.            MSMG 工具箱 - 集成适用于 Linux 的 Windows 子系统 ^(WSL^)
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置适用于 Linux 的 Windows 子系统（WSL）包路径
set "WSL=%WSL%\%SelectedSourceOS%\%PackageVersion%"

:: 检查适用于 Linux 的 Windows 子系统（WSL）包文件是否存在
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Subsystem for Linux ^(WSL^) 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WSL\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查适用于 Linux 的 Windows 子系统（WSL）包文件是否存在
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Subsystem for Linux ^(WSL^) 包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WSL\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成适用于 Linux 的 Windows 子系统 ^(WSL^)###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成适用于 Linux 的 Windows 子系统 ^(WSL^)###############################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成适用于 Linux 的 Windows 子系统 ^(WSL^) 基础数据包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成适用于 Linux 的 Windows 子系统 ^(WSL^) [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在启用适用于 Linux 的 Windows 子系统 ^(WSL^) 功能……
		echo.-------------------------------------------------------------------------------
		call :EnableFeature "%InstallMount%\%%i", "Microsoft-Windows-Subsystem-Linux /All"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成适用于 Linux 的 Windows 子系统 ^(WSL^) 已完成############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set WSL=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Open Secure Shell（SSH）客户端和服务器端模组
::-------------------------------------------------------------------------------------------
:IntOpenSSH

setlocal

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 集成 Open Secure Shell^(SSH^) 客户端和服务器端
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: Setting Open Secure Shell Pack Path
set "OpenSSH=%OpenSSH%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Open Secure Shell（SSH）客户端包文件是否存在
if not exist "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH 客户端和服务器端包文件夹缺少以下文件……
	echo.
	echo."OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\OpenSSH\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Open Secure Shell（SSH）服务器端包文件是否存在
if not exist "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH 客户端和服务器端包文件夹缺少以下文件……
	echo.
	echo."OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\OpenSSH\%PackageVersion%^> 文件夹……
	goto :Stop
)

call :RemoveFile "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

if "%ImageBuild%" geq "17763" (
	copy /y "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
	copy /y "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Open Secure Shell^(SSH^) 客户端和服务器端#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Open Secure Shell^(SSH^) 客户端和服务器端###########################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 OpenSSH 客户端程序包……
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 OpenSSH 服务器端程序包……
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	)
)

call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.-------------------------------------------------------------------------------
echo.####集成 Open Secure Shell^(SSH^) 客户端和服务器端已完成#########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set OpenSSH=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 媒体功能包模组
::-------------------------------------------------------------------------------------------
:IntMediaFeaturePack

setlocal

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成 Windows 媒体功能包
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查是否存在支持 Windows 媒体功能集成的 N 版被选为源。
set /A ImageEditionCount=0
for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
   if "%ImageEdition%" equ "%%j" set /A ImageEditionCount+=1
)

if %ImageEditionCount% equ 0 (
   echo.未找到 N 版。并且不支持非 N 版。
   echo.
   goto :Stop
)

:: 根据所选源操作系统设置 Windows 媒体功能包的包文件夹路径
if "%SelectedSourceOS%" neq "w10" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 媒体功能包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 媒体功能包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 媒体功能包############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 媒体功能包############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
			if "%ImageEdition%" equ "%%j" (
				if "%SelectedSourceOS%" equ "w7" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体功能 OOB 程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体格式 OOB 程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
				)

				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"

				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体功能 OOB 程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体功能 OOB [%ImageDefaultLanguage%] 程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				)

				if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "18362" (
					call :RemoveFolder "%Temp%\Updates\MediaFeaturePack"
					call :CreateFolder "%Temp%\Updates\MediaFeaturePack"
					expand -R "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" -F:* "%Temp%\Updates\MediaFeaturePack" >nul

					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体功能程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\MediaFeaturePack"
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Windows 媒体功能 [%ImageDefaultLanguage%] 程序包
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageArchitecture%" equ "x64" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Microsoft Windows 媒体功能 WOW64 程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Microsoft Windows 媒体功能 [%ImageDefaultLanguage%] WOW64 程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					)

					call :RemoveFolder "%Temp%\Updates"
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 媒体功能包已完成##############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set MediaFeaturePack=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 混合现实模组
::-------------------------------------------------------------------------------------------
:IntWMR

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Windows 混合现实
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选源操作系统设置 Windows 混合现实文件夹路径
set "WMR=%WMR%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 混合现实包文件是否存在
if not exist "%WMR%\Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab" (
	echo.Windows 混合现实包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\WMR\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 混合现实##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 混合现实##################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		call :AddPackage "%InstallMount%\%%i", "%WMR%\Microsoft-Windows-Holographic-Desktop-FOD-Package~31bf3856ad364e35~amd64~~.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 混合现实已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set WMR=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 便携设备模组
::-------------------------------------------------------------------------------------------
:IntPortableDevices

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Windows 便携设备
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Windows 便携设备包路径
set "PortableDevices=%PortableDevices%\%SelectedSourceOS%\%PackageVersion%"

:: 检查 Windows 便携设备包文件是否存在
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 便携设备包文件是否存在
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 便携设备包文件是否存在
if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 便携设备包文件是否存在
if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 便携设备包文件是否存在
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 便携设备包文件是否存在
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows 便携设备包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PortableDevices\%PackageVersion%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 便携设备##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 便携设备##################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /d %%j in (StarterN,StarterKN,HomeBasicN,HomeBasicKN,CoreN,CloudN,ProfessionalN,ProfessionalKN,ProfessionalEducationN,ProfessionalEducationKN,EnterpriseN,EnterpriseKN,EnterpriseSN,EnterpriseGN,UltimateN,UltimateKN,EducationN,EducationKN) do (
			if "%ImageEdition%" equ "%%j" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 便携设备程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 便携设备 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"

				if "%ImageArchitecture%" equ "x64" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 便携设备 WOW64 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%PackageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 便携设备 [%ImageDefaultLanguage%] WOW64 语言包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 便携设备已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set PortableDevices=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows PowerShell 7 模组
::-------------------------------------------------------------------------------------------
:IntPowerShell7

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows PowerShell 7
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Windows PowerShell 7 包文件是否存在
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk" (
	echo.Windows PowerShell 7 包文件夹缺少以下文件……
	echo.
	echo."PowerShell7_%SelectedSourceOS%.tpk"
	echo.
	echo.请复制上述文件到 ^<Packs\PowerShell7^> 文件夹……
	goto :Stop
)

:: 检查 Windows PowerShell 7 包文件是否存在
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Windows PowerShell 7 包文件夹缺少以下文件……
	echo.
	echo."PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.请复制上述文件到 ^<Packs\PowerShell7^> 文件夹……
	goto :Stop
)

:: 检查 Windows PowerShell 7 包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%PowerShell7%\Windows6.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PowerShell7^> 文件夹……
	goto :Stop
)

:: 检查 Windows PowerShell 7 包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%PowerShell7%\Windows8.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7 包文件夹缺少以下文件……
	echo.
	echo."Windows8.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\PowerShell7^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows PowerShell 7##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows PowerShell 7##############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 通用 C 运行时 ^(CRT^) 程序包……
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%InstallMount%\%%i", "%PowerShell7%\Windows6.1-KB3118401-%ImageArchitecture%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%PowerShell7%\Windows8.1-KB3118401-%ImageArchitecture%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows PowerShell 7 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Windows PowerShell 7 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows PowerShell 7 已完成###########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set PowerShell7=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 远程服务器管理工具（RSAT）模组
::-------------------------------------------------------------------------------------------
:IntRSAT

setlocal

set RSATType=

if "%SelectedSourceOS%" equ "w10" (
	cls
	echo.===============================================================================
	echo.              MSMG 工具箱 - 集成 Windows 远程服务器管理工具 ^(RSAT^)
	echo.===============================================================================
	echo.
	echo.  [1]  适用于管理目标版本早于 Windows Server 版本 1709 的 RSAT
	echo.
	echo.  [2]  适用于管理 Windows Server 版本 1709 的 RSAT
	echo.
	echo.  [3]  适用于管理 Windows Server 版本 1803 的 RSAT
	echo.
	echo.  [X]  返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :IntegrateMenu
	if errorlevel 3 set RSATType=v1803
	if errorlevel 2 set RSATType=v1709
	if errorlevel 1 set RSATType=v1609
)

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Windows 远程服务器管理工具 ^(RSAT^)
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选源操作系统设置 Windows 远程服务器管理工具（RSAT）包文件夹路径
set "RSAT=%RSAT%\%SelectedSourceOS%"

:: 检查 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查适用于流媒体服务的 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w81" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1609" if not exist "%RSAT%\10.0.14393\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%\10.0.14393^> 文件夹……
	goto :Stop
)

:: 检查 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1709" if not exist "%RSAT%\10.0.16299\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%\10.0.16299^> 文件夹……
	goto :Stop
)

:: 检查 Windows 远程服务器管理工具（RSAT）包文件是否存在
if "%SelectedSourceOS%" equ "w10" if "%RSATType%" equ "v1803" if not exist "%RSAT%\10.0.17134\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab" (
	echo.远程服务器管理工具包文件夹缺少以下文件……
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab"
	echo.
	echo.请复制上述文件到 ^<Packs\RSAT\%SelectedSourceOS%\10.0.17134^> 文件夹……
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 远程服务器管理工具 ^(RSAT^)#############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 远程服务器管理工具 ^(RSAT^)#################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul
		
		:: 检查所选择的源操作系统是否是有效的版本
		if "%SelectedSourceOS%" equ "w7" (
			for /d %%j in (Professional,Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 远程服务器管理工具 ^(RSAT^) 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
					echo.-------------------------------------------------------------------------------
					echo.正在集成适用于流媒体服务的 Windows RSAT 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
				)
			)
		)

		if "%SelectedSourceOS%" neq "w7" (
			for /d %%j in (Professional,Enterprise) do (
				if "%ImageEdition%" equ "%%j" (
					if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"

					if "%SelectedSourceOS%" equ "w10" (
						if "%RSATType%" equ "v1609" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.14393\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
						if "%RSATType%" equ "v1709" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.16299\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
						if "%RSATType%" equ "v1803" call :AddPackage "%InstallMount%\%%i", "%RSAT%\10.0.17134\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.cab"
					)
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 远程服务器管理工具 ^(RSAT^) 已完成##############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set RSAT=
set RSATType=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 集成 Microsoft 默认内置应用
::-------------------------------------------------------------------------------------------
:IntInboxApps

setlocal

set InboxApp=

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 集成 Microsoft 默认内置应用
echo.===============================================================================
echo.

:: 集成 Windows 8.1 默认内置应用菜单
if "%SelectedSourceOS%" equ "w81" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
	echo.===============================================================================
	echo.
	echo.  [01]   闹钟和时钟
	echo.  [02]   计算器
	echo.  [03]   日历、邮件和人脉
	echo.  [04]   Bing 财经
	echo.  [05]   Bing 美食
	echo.  [06]   Bing 健康
	echo.  [07]   Bing 地图
	echo.  [08]   Bing 资讯
	echo.  [09]   Bing 体育
	echo.  [10]   Bing 旅游
	echo.  [11]   Bing 天气
	echo.  [12]   帮助和提示
	echo.  [13]   Office OneNote
	echo.  [14]   阅读器
	echo.  [15]   阅读列表
	echo.  [16]   扫描
	echo.  [17]   Skype
	echo.  [18]   录音机
	echo.  [19]   Xbox LIVE 游戏
	echo.  [20]   Zune 音乐
	echo.  [21]   Zune 视频
	echo.
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" set "InboxApp=Alarms"
	if "!MenuChoice!" equ "02" set "InboxApp=Calculator"
	if "!MenuChoice!" equ "03" set "InboxApp=CommunicationsApps"
	if "!MenuChoice!" equ "04" set "InboxApp=BingFinance"
	if "!MenuChoice!" equ "05" set "InboxApp=BingFoodDrink"
	if "!MenuChoice!" equ "06" set "InboxApp=BingHealthFitness"
	if "!MenuChoice!" equ "07" set "InboxApp=BingMaps"
	if "!MenuChoice!" equ "08" set "InboxApp=BingNews"
	if "!MenuChoice!" equ "09" set "InboxApp=BingSports"
	if "!MenuChoice!" equ "10" set "InboxApp=BingTravel"
	if "!MenuChoice!" equ "11" set "InboxApp=BingWeather"
	if "!MenuChoice!" equ "12" set "InboxApp=HelpAndTips"
	if "!MenuChoice!" equ "13" set "InboxApp=OneNote"
	if "!MenuChoice!" equ "14" set "InboxApp=Reader"
	if "!MenuChoice!" equ "15" set "InboxApp=ReadingList"
	if "!MenuChoice!" equ "16" set "InboxApp=Scan"
	if "!MenuChoice!" equ "17" set "InboxApp=Skype"
	if "!MenuChoice!" equ "18" set "InboxApp=SoundRecorder"
	if "!MenuChoice!" equ "19" set "InboxApp=XboxLiveGames"
	if "!MenuChoice!" equ "20" set "InboxApp=ZuneMusic"
	if "!MenuChoice!" equ "21" set "InboxApp=ZuneVideo"
	if /i "!MenuChoice!" equ "A" set "InboxApp=AllApps"
	if /i "!MenuChoice!" equ "X" goto :IntFeaturesMenu
)

:: 集成 Windows 10 v1809/V1903/v1909 默认内置应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
	echo.===============================================================================
	echo.
	echo.  [01]   3D 查看器
	echo.  [02]   闹钟和时钟
	echo.  [03]   AOMedia Video 1 ^(AV1^) 编解码器插件
	echo.  [04]   计算器
	echo.  [05]   相机
	echo.  [06]   桌面应用安装程序
	echo.  [07]   DirectX Runtime
	echo.  [08]   反馈中心
	echo.  [09]   电影和电视
	echo.  [10]   获取帮助
	echo.  [11]   Google 的 VP9 WebM 视频编解码器插件
	echo.  [12]   Groove 音乐
	echo.  [13]   高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [14]   高效视频编码 ^(HEVC^) 编解码器插件
	echo.  [15]   地图
	echo.  [16]   消息
	echo.  [17]   MPEG-2 视频编解码器插件
	echo.  [18]   Microsoft Pay
	if "%ImageArchitecture%" equ "x64" echo.  [19]   混合现实门户
	echo.  [20]   移动套餐
	echo.  [21]   我的 Office
	echo.  [22]   资讯 
	echo.  [23]   OneNote
	echo.  [24]   画图 3D
	echo.  [25]   人脉
	echo.  [26]   照片
	echo.  [27]   Print 3D
	echo.  [28]   截图和草图
	echo.  [29]   Skype
	echo.  [30]   Solitaire Collection
	echo.  [31]   便笺
	echo.  [32]   应用商店体验主机
	echo.  [33]   使用技巧
	echo.  [34]   Todos
	echo.  [35]   录音机
	echo.  [36]   天气
	echo.  [37]   Web 媒体编解码器插件
	echo.  [38]   WebP 图像编解码器插件
	echo.  [39]   Windows 邮件
	echo.  [40]   Windows 应用商店
	echo.  [41]   Xbox UI ^(Xbox TCUI^)
	echo.  [42]   Xbox 主机小帮手 ^(Xbox 应用^)
	echo.  [43]   Xbox Game Bar Plugin ^(Xbox Game Overlay^)
	echo.  [44]   Xbox Game Bar ^(Xbox Gaming Overlay^)
	echo.  [45]   Xbox Identity Provider
	echo.  [46]   Xbox Live 游戏内体验 ^(Xbox Speech To TextOverlay^)
	echo.  [47]   你的手机
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" set "InboxApp=MixedRealityViewer"
	if "!MenuChoice!" equ "02" set "InboxApp=Alarms"
	if "!MenuChoice!" equ "03" set "InboxApp=AV1VideoExtension"
	if "!MenuChoice!" equ "04" set "InboxApp=Calculator"
	if "!MenuChoice!" equ "05" set "InboxApp=Camera"
	if "!MenuChoice!" equ "06" set "InboxApp=DesktopAppInstaller"
	if "!MenuChoice!" equ "07" set "InboxApp=DirectXRuntime"
	if "!MenuChoice!" equ "08" set "InboxApp=FeedbackHub"
	if "!MenuChoice!" equ "09" set "InboxApp=ZuneVideo"
	if "!MenuChoice!" equ "10" set "InboxApp=GetHelp"
	if "!MenuChoice!" equ "11" set "InboxApp=VP9VideoExtensions"
	if "!MenuChoice!" equ "12" set "InboxApp=ZuneMusic"
	if "!MenuChoice!" equ "13" set "InboxApp=HEIFImageExtension"
	if "!MenuChoice!" equ "14" set "InboxApp=HEVCVideoExtension"
	if "!MenuChoice!" equ "15" set "InboxApp=Maps"
	if "!MenuChoice!" equ "16" set "InboxApp=Messaging"
	if "!MenuChoice!" equ "17" set "InboxApp=MPEG2VideoExtension"
	if "!MenuChoice!" equ "18" set "InboxApp=Wallet"
	if "!MenuChoice!" equ "19" if "%ImageArchitecture%" equ "x64" set "InboxApp=MixedRealityPortal"
	if "!MenuChoice!" equ "20" set "InboxApp=OneConnect"
	if "!MenuChoice!" equ "21" set "InboxApp=OfficeHub"
	if "!MenuChoice!" equ "22" set "InboxApp=BingNews"
	if "!MenuChoice!" equ "23" set "InboxApp=OneNote"
	if "!MenuChoice!" equ "24" set "InboxApp=Paint3D"
	if "!MenuChoice!" equ "25" set "InboxApp=People"
	if "!MenuChoice!" equ "26" set "InboxApp=Photos"
	if "!MenuChoice!" equ "27" set "InboxApp=Print3D"
	if "!MenuChoice!" equ "28" set "InboxApp=ScreenSketch"
	if "!MenuChoice!" equ "29" set "InboxApp=Skype"
	if "!MenuChoice!" equ "30" set "InboxApp=SolitaireCollection"
	if "!MenuChoice!" equ "31" set "InboxApp=StickyNotes"
	if "!MenuChoice!" equ "32" set "InboxApp=StorePurchaseApp"
	if "!MenuChoice!" equ "33" set "InboxApp=Getstarted"
	if "!MenuChoice!" equ "34" set "InboxApp=Todos"
	if "!MenuChoice!" equ "35" set "InboxApp=SoundRecorder"
	if "!MenuChoice!" equ "36" set "InboxApp=BingWeather"
	if "!MenuChoice!" equ "37" set "InboxApp=WebMediaExtensions"
	if "!MenuChoice!" equ "38" set "InboxApp=WebpImageExtension"
	if "!MenuChoice!" equ "39" set "InboxApp=CommunicationsApps"
	if "!MenuChoice!" equ "40" set "InboxApp=WindowsStore"
	if "!MenuChoice!" equ "41" set "InboxApp=XboxTCUI"
	if "!MenuChoice!" equ "42" set "InboxApp=Xbox"
	if "!MenuChoice!" equ "43" set "InboxApp=XboxGameOverlay"
	if "!MenuChoice!" equ "44" set "InboxApp=XboxGamingOverlay"
	if "!MenuChoice!" equ "45" set "InboxApp=XboxIdentityProvider"
	if "!MenuChoice!" equ "46" set "InboxApp=XboxSpeechToTextOverlay"
	if "!MenuChoice!" equ "47" set "InboxApp=YourPhone"
	if /i "!MenuChoice!" equ "A" set "InboxApp=AllApps"
	if /i "!MenuChoice!" equ "X" goto :IntFeaturesMenu
)

:: 集成 Windows 10 v2004/v20H2/v21H1/v21H2 默认内置应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
	echo.===============================================================================
	echo.  [01]   3D 查看器
	echo.  [02]   闹钟和时钟
	echo.  [03]   AOMedia Video 1 ^(AV1^) 编解码器插件
	echo.  [04]   计算器
	echo.  [05]   相机
	echo.  [06]   Cortana
	echo.  [07]   桌面应用安装程序
	echo.  [08]   DirectX Runtime
	echo.  [09]   反馈中心
	echo.  [10]   获取帮助
	echo.  [11]   Google 的 VP9 WebM 视频编解码器插件
	echo.  [12]   Groove 音乐
	echo.  [13]   高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [14]   高效视频编码 ^(HEVC^) 编解码器插件
	echo.  [15]   地图
	echo.  [16]   MPEG-2 视频编解码器插件
	echo.  [17]   Microsoft Pay
	if "%ImageArchitecture%" equ "x64" echo.  [18]   混合现实门户
	echo.  [19]   电影和电视
	echo.  [20]   我的 Office
	echo.  [21]   资讯
	echo.  [22]   OneNote
	echo.  [23]   画图 3D
	echo.  [24]   人脉
	echo.  [25]   照片
	echo.  [26]   照片媒体引擎加载项
	echo.  [27]   截图和草图
	echo.  [28]   Skype
	echo.  [29]   Solitaire Collection
	echo.  [30]   便笺
	echo.  [31]   应用商店体验主机
	echo.  [32]   终端
	echo.  [33]   使用技巧
	echo.  [34]   Todos
	echo.  [35]   录音机
	echo.  [36]   天气
	echo.  [37]   Web 媒体编解码器插件
	echo.  [38]   WebP 图像编解码器插件
	echo.  [39]   Windows 邮件
	echo.  [40]   Windows 应用商店
	echo.  [41]   Xbox UI ^(Xbox TCUI^)
	echo.  [42]   Xbox 主机小帮手 ^(Xbox 应用^)
	echo.  [43]   Xbox Game Bar Plugin ^(Xbox Game Overlay^)
	echo.  [44]   Xbox Game Bar ^(Xbox Gaming Overlay^)
	echo.  [45]   Xbox Identity Provider
	echo.  [46]   Xbox Live 游戏内体验 ^(Xbox Speech To TextOverlay^)
	echo.  [47]   你的手机
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" set "InboxApp=MixedRealityViewer"
	if "!MenuChoice!" equ "02" set "InboxApp=Alarms"
	if "!MenuChoice!" equ "03" set "InboxApp=AV1VideoExtension"
	if "!MenuChoice!" equ "04" set "InboxApp=Calculator"
	if "!MenuChoice!" equ "05" set "InboxApp=Camera"
	if "!MenuChoice!" equ "06" set "InboxApp=Cortana"
	if "!MenuChoice!" equ "07" set "InboxApp=DesktopAppInstaller"
	if "!MenuChoice!" equ "08" set "InboxApp=DirectXRuntime"
	if "!MenuChoice!" equ "09" set "InboxApp=FeedbackHub"
	if "!MenuChoice!" equ "10" set "InboxApp=GetHelp"
	if "!MenuChoice!" equ "11" set "InboxApp=VP9VideoExtensions"
	if "!MenuChoice!" equ "12" set "InboxApp=ZuneMusic"
	if "!MenuChoice!" equ "13" set "InboxApp=HEIFImageExtension"
	if "!MenuChoice!" equ "14" set "InboxApp=HEVCVideoExtension"
	if "!MenuChoice!" equ "15" set "InboxApp=Maps"
	if "!MenuChoice!" equ "16" set "InboxApp=MPEG2VideoExtension"
	if "!MenuChoice!" equ "17" set "InboxApp=Wallet"
	if "!MenuChoice!" equ "18" if "%ImageArchitecture%" equ "x64" set "InboxApp=MixedRealityPortal"
	if "!MenuChoice!" equ "19" set "InboxApp=ZuneVideo"
	if "!MenuChoice!" equ "20" set "InboxApp=OfficeHub"
	if "!MenuChoice!" equ "21" set "InboxApp=BingNews"
	if "!MenuChoice!" equ "22" set "InboxApp=OneNote"
	if "!MenuChoice!" equ "23" set "InboxApp=Paint3D"
	if "!MenuChoice!" equ "24" set "InboxApp=People"
	if "!MenuChoice!" equ "25" set "InboxApp=Photos"
	if "!MenuChoice!" equ "26" set "InboxApp=PhotosMediaEngine"
	if "!MenuChoice!" equ "27" set "InboxApp=ScreenSketch"
	if "!MenuChoice!" equ "28" set "InboxApp=Skype"
	if "!MenuChoice!" equ "29" set "InboxApp=SolitaireCollection"
	if "!MenuChoice!" equ "30" set "InboxApp=StickyNotes"
	if "!MenuChoice!" equ "31" set "InboxApp=StorePurchaseApp"
	if "!MenuChoice!" equ "32" set "InboxApp=Terminal"
	if "!MenuChoice!" equ "33" set "InboxApp=Getstarted"
	if "!MenuChoice!" equ "34" set "InboxApp=Todos"
	if "!MenuChoice!" equ "35" set "InboxApp=SoundRecorder"
	if "!MenuChoice!" equ "36" set "InboxApp=BingWeather"
	if "!MenuChoice!" equ "37" set "InboxApp=WebMediaExtensions"
	if "!MenuChoice!" equ "38" set "InboxApp=WebpImageExtension"
	if "!MenuChoice!" equ "39" set "InboxApp=CommunicationsApps"
	if "!MenuChoice!" equ "40" set "InboxApp=WindowsStore"
	if "!MenuChoice!" equ "41" set "InboxApp=XboxTCUI"
	if "!MenuChoice!" equ "42" set "InboxApp=Xbox"
	if "!MenuChoice!" equ "43" set "InboxApp=XboxGameOverlay"
	if "!MenuChoice!" equ "44" set "InboxApp=XboxGamingOverlay"
	if "!MenuChoice!" equ "45" set "InboxApp=XboxIdentityProvider"
	if "!MenuChoice!" equ "46" set "InboxApp=XboxSpeechToTextOverlay"
	if "!MenuChoice!" equ "47" set "InboxApp=YourPhone"
	if /i "!MenuChoice!" equ "A" set "InboxApp=AllApps"
	if /i "!MenuChoice!" equ "X" goto :IntFeaturesMenu
)

:: 集成 Windows 11 v21H2/v22H2 默认内置应用菜单
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
	echo.===============================================================================
	echo.  [01]   闹钟和时钟
	echo.  [02]   AOMedia Video 1 ^(AV1^) 编解码器插件
	echo.  [03]   计算器
	echo.  [04]   相机
	echo.  [05]   Cortana
	echo.  [06]   桌面应用安装程序
	echo.  [07]   DirectX Runtime
	echo.  [08]   反馈中心
	echo.  [09]   Gaming 应用 ^(Xbox 主机小帮手 - Xbox 应用^) ^| 依赖于 DirectX Runtime、游戏服务
	echo.  [10]   游戏服务
	echo.  [11]   获取帮助
	echo.  [12]   Google 的 VP9 WebM 视频编解码器插件
	echo.  [13]   Groove 音乐
	echo.  [14]   高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [15]   高效视频编码 ^(HEVC^) 编解码器插件
	echo.  [16]   地图
	echo.  [17]   MPEG-2 视频编解码器插件
	echo.  [18]   电影和电视
	echo.  [19]   我的 Office
	echo.  [20]   资讯
	echo.  [21]   记事本
	echo.  [22]   画图
	echo.  [23]   人脉
	echo.  [24]   照片
	echo.  [25]   照片媒体引擎加载项
	echo.  [26]   Power Automate Desktop
	echo.  [27]   截图和草图
	echo.  [28]   Solitaire Collection
	echo.  [29]   便笺
	echo.  [30]   应用商店体验主机
	echo.  [31]   终端
	echo.  [32]   使用技巧
	echo.  [33]   Todos
	echo.  [34]   录音机
	echo.  [35]   天气
	echo.  [36]   Web 媒体编解码器插件
	echo.  [37]   WebP 图像编解码器插件
	echo.  [38]   小工具
	echo.  [39]   Windows 邮件
	echo.  [40]   Windows 应用商店
	echo.  [41]   适用于 Android 的 Windows 子系统
	echo.  [42]   Xbox UI ^(Xbox TCUI^)
	echo.  [43]   Xbox Game Bar Plugin ^(Xbox Game Overlay^)
	echo.  [44]   Xbox Game Bar ^(Xbox Gaming Overlay^)
	echo.  [45]   Xbox Identity Provider
	echo.  [46]   Xbox Live 游戏内体验 ^(Xbox Speech To TextOverlay^)
	echo.  [47]   你的手机
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" set "InboxApp=Alarms"
	if "!MenuChoice!" equ "02" set "InboxApp=AV1VideoExtension"
	if "!MenuChoice!" equ "03" set "InboxApp=Calculator"
	if "!MenuChoice!" equ "04" set "InboxApp=Camera"
	if "!MenuChoice!" equ "05" set "InboxApp=Cortana"
	if "!MenuChoice!" equ "06" set "InboxApp=DesktopAppInstaller"
	if "!MenuChoice!" equ "07" set "InboxApp=DirectXRuntime"
	if "!MenuChoice!" equ "08" set "InboxApp=FeedbackHub"
	if "!MenuChoice!" equ "09" set "InboxApp=GamingApp"
	if "!MenuChoice!" equ "10" set "InboxApp=GamingServices"
	if "!MenuChoice!" equ "11" set "InboxApp=GetHelp"
	if "!MenuChoice!" equ "12" set "InboxApp=VP9VideoExtensions"
	if "!MenuChoice!" equ "13" set "InboxApp=ZuneMusic"
	if "!MenuChoice!" equ "14" set "InboxApp=HEIFImageExtension"
	if "!MenuChoice!" equ "15" set "InboxApp=HEVCVideoExtension"
	if "!MenuChoice!" equ "16" set "InboxApp=Maps"
	if "!MenuChoice!" equ "17" set "InboxApp=MPEG2VideoExtension"
	if "!MenuChoice!" equ "18" set "InboxApp=ZuneVideo"
	if "!MenuChoice!" equ "19" set "InboxApp=OfficeHub"
	if "!MenuChoice!" equ "20" set "InboxApp=BingNews"
	if "!MenuChoice!" equ "21" set "InboxApp=Notepad"
	if "!MenuChoice!" equ "22" set "InboxApp=Paint"
	if "!MenuChoice!" equ "23" set "InboxApp=People"
	if "!MenuChoice!" equ "24" set "InboxApp=Photos"
	if "!MenuChoice!" equ "25" set "InboxApp=PhotosMediaEngine"
	if "!MenuChoice!" equ "26" set "InboxApp=PowerAutomateDesktop"
	if "!MenuChoice!" equ "27" set "InboxApp=ScreenSketch"
	if "!MenuChoice!" equ "28" set "InboxApp=SolitaireCollection"
	if "!MenuChoice!" equ "29" set "InboxApp=StickyNotes"
	if "!MenuChoice!" equ "30" set "InboxApp=StorePurchaseApp"
	if "!MenuChoice!" equ "31" set "InboxApp=Terminal"
	if "!MenuChoice!" equ "32" set "InboxApp=Getstarted"
	if "!MenuChoice!" equ "33" set "InboxApp=Todos"
	if "!MenuChoice!" equ "34" set "InboxApp=SoundRecorder"
	if "!MenuChoice!" equ "35" set "InboxApp=BingWeather"
	if "!MenuChoice!" equ "36" set "InboxApp=WebMediaExtensions"
	if "!MenuChoice!" equ "37" set "InboxApp=WebpImageExtension"
	if "!MenuChoice!" equ "38" set "InboxApp=ClientWebExperience"
	if "!MenuChoice!" equ "39" set "InboxApp=CommunicationsApps"
	if "!MenuChoice!" equ "40" set "InboxApp=WindowsStore"
	if "!MenuChoice!" equ "41" set "InboxApp=WindowsSubsystemForAndroid"
	if "!MenuChoice!" equ "42" set "InboxApp=XboxTCUI"
	if "!MenuChoice!" equ "43" set "InboxApp=XboxGameOverlay"
	if "!MenuChoice!" equ "44" set "InboxApp=XboxGamingOverlay"
	if "!MenuChoice!" equ "45" set "InboxApp=XboxIdentityProvider"
	if "!MenuChoice!" equ "46" set "InboxApp=XboxSpeechToTextOverlay"
	if "!MenuChoice!" equ "47" set "InboxApp=YourPhone"
	if /i "!MenuChoice!" equ "A" set "InboxApp=AllApps"
	if /i "!MenuChoice!" equ "X" goto :IntFeaturesMenu
)

:: 设置默认内置应用 Appx 和许可文件路径
set "Apps=%Apps%\%SelectedSourceOS%"

set Alarms_Appx=
set AV1VideoExtension_Appx=
set BingFinance_Appx=
set BingFoodDrink_Appx=
set BingHealthFitness_Appx=
set BingMaps_Appx=
set BingNews_Appx=
set BingSports_Appx=
set BingTravel_Appx=
set BingWeather_Appx=
set Calculator_Appx=
set Camera_Appx=
set ClientWebExperience_Appx=
set CommunicationsApps_Appx=
set Cortana_Appx=
set DesktopAppInstaller_Appx=
set DirectXRuntime_Appx=
set FeedbackHub_Appx=
set GamingApp_Appx=
set GamingServices_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_Appx=
set HelpAndTips_Appx=
set HEVCVideoExtension_Appx=
set Maps_Appx=
set Messaging_Appx=
set MixedRealityPortal_Appx=
set MixedRealityViewer_Appx=
set MPEG2VideoExtension_Appx=
set Notepad_Appx=
set OfficeHub_Appx=
set OneConnect_Appx=
set OneNote_Appx=
set Paint_Appx=
set Paint3D_Appx=
set People_Appx=
set Photos_Appx=
set PhotosMediaEngine_Appx=
set PowerAutomateDesktop_Appx=
set Print3D_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set Skype_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set StorePurchaseApp_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set "Alarms_License=%Apps%\Microsoft.WindowsAlarms_8wekyb3d8bbwe.xml"
set "AV1VideoExtension_License=%Apps%\Microsoft.AV1VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "BingFinance_License=%Apps%\Microsoft.BingFinance_8wekyb3d8bbwe.xml"
set "BingFoodDrink_License=%Apps%\Microsoft.BingFoodAndDrink_8wekyb3d8bbwe.xml"
set "BingHealthFitness_License=%Apps%\Microsoft.BingHealthAndFitness_8wekyb3d8bbwe.xml"
set "BingMaps_License=%Apps%\Microsoft.BingMaps_8wekyb3d8bbwe.xml"
set "BingNews_License=%Apps%\Microsoft.BingNews_8wekyb3d8bbwe.xml"
set "BingSports_License=%Apps%\Microsoft.BingSports_8wekyb3d8bbwe.xml"
set "BingTravel_License=%Apps%\Microsoft.BingTravel_8wekyb3d8bbwe.xml"
set "BingWeather_License=%Apps%\Microsoft.BingWeather_8wekyb3d8bbwe.xml"
set "Calculator_License=%Apps%\Microsoft.WindowsCalculator_8wekyb3d8bbwe.xml"
set "Camera_License=%Apps%\Microsoft.WindowsCamera_8wekyb3d8bbwe.xml"
set "ClientWebExperience_License=%Apps%\MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy.xml"
set "CommunicationsApps_License=%Apps%\Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe.xml"
set "Cortana_License=%Apps%\Microsoft.549981c3f5f10_8wekyb3d8bbwe.xml"
set "DesktopAppInstaller_License=%Apps%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.xml"
set "DirectXRuntime_License=%Apps%\Microsoft.DirectXRuntime_8wekyb3d8bbwe.xml"
set "FeedbackHub_License=%Apps%\Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe.xml"
set "GamingApp_License=%Apps%\Microsoft.GamingApp_8wekyb3d8bbwe.xml"
set "GamingServices_License=%Apps%\Microsoft.GamingServices_8wekyb3d8bbwe.xml"
set "GetHelp_License=%Apps%\Microsoft.GetHelp_8wekyb3d8bbwe.xml"
set "Getstarted_License=%Apps%\Microsoft.Getstarted_8wekyb3d8bbwe.xml"
set "HEIFImageExtension_License=%Apps%\Microsoft.HEIFImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "HelpAndTips_License=%Apps%\Microsoft.HelpAndTips_8wekyb3d8bbwe.xml"
set "HEVCVideoExtension_License=%Apps%\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Maps_License=%Apps%\Microsoft.WindowsMaps_8wekyb3d8bbwe.xml"
set "Messaging_License=%Apps%\Microsoft.Messaging_8wekyb3d8bbwe.xml"
set "MixedRealityPortal_License=%Apps%\Microsoft.MixedReality.Portal_8wekyb3d8bbwe.xml"
set "MixedRealityViewer_License=%Apps%\Microsoft.Microsoft3DViewer_8wekyb3d8bbwe.xml"
set "MPEG2VideoExtension_License=%Apps%\Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Notepad_License=%Apps%\Microsoft.WindowsNotepad_8wekyb3d8bbwe.xml"
set "OfficeHub_License=%Apps%\Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe.xml"
set "OneConnect_License=%Apps%\Microsoft.OneConnect_8wekyb3d8bbwe.xml"
set "OneNote_License=%Apps%\Microsoft.Office.OneNote_8wekyb3d8bbwe.xml"
set "Paint_License=%Apps%\Microsoft.Paint_8wekyb3d8bbwe.xml"
set "Paint3D_License=%Apps%\Microsoft.MSPaint_8wekyb3d8bbwe.xml"
set "People_License=%Apps%\Microsoft.People_8wekyb3d8bbwe.xml"
set "Photos_License=%Apps%\Microsoft.Windows.Photos_8wekyb3d8bbwe.xml"
set "PhotosMediaEngine_License=%Apps%\Microsoft.Photos.MediaEngineDLC_8wekyb3d8bbwe.xml"
set "PowerAutomateDesktop_License=%Apps%\Microsoft.PowerAutomateDesktop_8wekyb3d8bbwe.xml"
set "Print3D_License=%Apps%\Microsoft.Print3D_8wekyb3d8bbwe.xml"
set "Reader_License=%Apps%\Microsoft.Reader_8wekyb3d8bbwe.xml"
set "ReadingList_License=%Apps%\Microsoft.WindowsReadingList_8wekyb3d8bbwe.xml"
set "Scan_License=%Apps%\Microsoft.WindowsScan_8wekyb3d8bbwe.xml"
set "ScreenSketch_License=%Apps%\Microsoft.ScreenSketch_8wekyb3d8bbwe.xml"
set "Skype_License=%Apps%\Microsoft.SkypeApp_kzf8qxf38zg5c.xml"
set "SolitaireCollection_License=%Apps%\Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe.xml"
set "SoundRecorder_License=%Apps%\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe.xml"
set "StickyNotes_License=%Apps%\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe.xml"
set "StorePurchaseApp_License=%Apps%\Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml"
set "Terminal_License=%Apps%\Microsoft.WindowsTerminal_8wekyb3d8bbwe.xml"
set "Todos_License=%Apps%\Microsoft.Todos_8wekyb3d8bbwe.xml"
set "VP9VideoExtensions_License=%Apps%\Microsoft.VP9VideoExtensions_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Wallet_License=%Apps%\Microsoft.Wallet_8wekyb3d8bbwe.xml"
set "WebMediaExtensions_License=%Apps%\Microsoft.WebMediaExtensions_8wekyb3d8bbwe.xml"
set "WebpImageExtension_License=%Apps%\Microsoft.WebpImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "WindowsStore_License=%Apps%\Microsoft.WindowsStore_8wekyb3d8bbwe.xml"
set "WindowsSubsystemForAndroid_License=%Apps%\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe.xml"
set "Xbox_License=%Apps%\Microsoft.XboxApp_8wekyb3d8bbwe.xml"
set "XboxGameOverlay_License=%Apps%\Microsoft.XboxGameOverlay_8wekyb3d8bbwe.xml"
set "XboxGamingOverlay_License=%Apps%\Microsoft.XboxGamingOverlay_8wekyb3d8bbwe.xml"
set "XboxIdentityProvider_License=%Apps%\Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml"
set "XboxLiveGames_License=%Apps%\Microsoft.XboxLIVEGames_8wekyb3d8bbwe.xml"
set "XboxSpeechToTextOverlay_License=%Apps%\Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bbwe.xml"
set "XboxTCUI_License=%Apps%\Microsoft.Xbox.TCUI_8wekyb3d8bbwe.xml"
set "YourPhone_License=%Apps%\Microsoft.YourPhone_8wekyb3d8bbwe.xml"
set "ZuneMusic_License=%Apps%\Microsoft.ZuneMusic_8wekyb3d8bbwe.xml"
set "ZuneVideo_License=%Apps%\Microsoft.ZuneVideo_8wekyb3d8bbwe.xml"

set AdvertisingXaml_Appx=
set MediaPlayReadyClient22_Appx=
set NETNativeFramework13_Appx=
set NETNativeFramework16_Appx=
set NETNativeFramework17_Appx=
set NETNativeFramework21_Appx=
set NETNativeFramework22_Appx=
set NETNativeRuntime13_Appx=
set NETNativeRuntime14_Appx=
set NETNativeRuntime16_Appx=
set NETNativeRuntime17_Appx=
set NETNativeRuntime21_Appx=
set NETNativeRuntime22_Appx=
set ServicesStoreEngagement_Appx=
set UIXaml20_Appx=
set UIXaml21_Appx=
set UIXaml22_Appx=
set UIXaml23_Appx=
set UIXaml24_Appx=
set UIXaml25_Appx=
set UIXaml26_Appx=
set UIXaml27_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibsUWPDesktop11_Appx=
set VCLibsUWPDesktop12_Appx=
set VCLibsUWPDesktop14_Appx=
set VCLibs14_Appx=
set WinJS20_Appx=

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft 默认内置应用文件夹是否是空的
if not exist "%Apps%\*.*xbundle" (
	echo.Microsoft 默认内置应用 .Appxbundle 文件丢失……
	echo.
	echo.请将丢失的文件复制到 ^<Packs\Apps\%SelectedSourceOS%^> 文件夹……
	echo.
	goto :Stop
)

if not exist "%Apps%\*.appx" (
	echo.Microsoft 默认内置应用 .Appx 文件丢失……
	echo.
	echo.请将丢失的文件复制到 ^<Packs\Apps\%SelectedSourceOS%^> 文件夹……
	echo.
	goto :Stop
)

if not exist "%Apps%\*.xml" (
	echo.Microsoft 默认内置应用 .xml 文件丢失……
	echo.
	echo.请将丢失的文件复制到 ^<Packs\Apps\%SelectedSourceOS%^> 文件夹……
	echo.
	goto :Stop
)

:: 获取 Microsoft 默认内置应用文件的完整路径
cd /d "%Apps%\"

for /f %%i IN ('"dir /b *3DView*.*xbundle" 2^>nul') do if exist %%i set "MixedRealityViewer_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Alarms*.*xbundle" 2^>nul') do if exist %%i set "Alarms_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *AV1VideoExtension*.appx" 2^>nul') do if exist %%i set "AV1VideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFinance*.*xbundle" 2^>nul') do if exist %%i set "BingFinance_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFoodAndDrink*.*xbundle" 2^>nul') do if exist %%i set "BingFoodDrink_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingHealthAndFitness*.*xbundle" 2^>nul') do if exist %%i set "BingHealthFitness_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingMaps*.*xbundle" 2^>nul') do if exist %%i set "BingMaps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingNews*.*xbundle" 2^>nul') do if exist %%i set "BingNews_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingSports*.*xbundle" 2^>nul') do if exist %%i set "BingSports_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingTravel*.*xbundle" 2^>nul') do if exist %%i set "BingTravel_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingWeather*.*xbundle" 2^>nul') do if exist %%i set "BingWeather_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Calculator*.*xbundle" 2^>nul') do if exist %%i set "Calculator_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Camera*.*xbundle" 2^>nul') do if exist %%i set "Camera_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Client.WebExperience*.*xbundle" 2^>nul') do if exist %%i set "ClientWebExperience_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommunicationsApps*.*xbundle" 2^>nul') do if exist %%i set "CommunicationsApps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.549981C3F5F10*.*xbundle" 2^>nul') do if exist %%i set "Cortana_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DesktopAppInstaller*.*xbundle" 2^>nul') do if exist %%i set "DesktopAppInstaller_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DirectXRuntime*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "DirectXRuntime_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *FeedbackHub*.*xbundle" 2^>nul') do if exist %%i set "FeedbackHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GamingApp*.*xbundle" 2^>nul') do if exist %%i set "GamingApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GamingServices*.*xbundle" 2^>nul') do if exist %%i set "GamingServices_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GetHelp*.*xbundle" 2^>nul') do if exist %%i set "GetHelp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Getstarted*.*xbundle" 2^>nul') do if exist %%i set "Getstarted_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "HEIFImageExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HelpAndTips*.*xbundle" 2^>nul') do if exist %%i set "HelpAndTips_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "HEVCVideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Maps*.*xbundle" 2^>nul') do if exist %%i set "Maps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Messaging*.*xbundle" 2^>nul') do if exist %%i set "Messaging_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MixedReality.Portal*.*xbundle" 2^>nul') do if exist %%i set "MixedRealityPortal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "MPEG2VideoExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OfficeHub*.*xbundle" 2^>nul') do if exist %%i set "OfficeHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneConnect*.*xbundle" 2^>nul') do if exist %%i set "OneConnect_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneNote*.*xbundle" 2^>nul') do if exist %%i set "OneNote_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Paint*.*xbundle" 2^>nul') do if exist %%i set "Paint_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MSPaint*.*xbundle" 2^>nul') do if exist %%i set "Paint3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *People*.*xbundle" 2^>nul') do if exist %%i set "People_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Windows.Photos*.*xbundle" 2^>nul') do if exist %%i set "Photos_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Photos.MediaEngineDLC*.*xbundle" 2^>nul') do if exist %%i set "PhotosMediaEngine_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *PowerAutomateDesktop*.*xbundle" 2^>nul') do if exist %%i set "PowerAutomateDesktop_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Print3D*.*xbundle" 2^>nul') do if exist %%i set "Print3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Reader*.*xbundle" 2^>nul') do if exist %%i set "Reader_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ReadingList*.*xbundle" 2^>nul') do if exist %%i set "ReadingList_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Scan*.*xbundle" 2^>nul') do if exist %%i set "Scan_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ScreenSketch*.*xbundle" 2^>nul') do if exist %%i set "ScreenSketch_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Skype*.*xbundle" 2^>nul') do if exist %%i set "Skype_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SolitaireCollection*.*xbundle" 2^>nul') do if exist %%i set "SolitaireCollection_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SoundRecorder*.*xbundle" 2^>nul') do if exist %%i set "SoundRecorder_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StickyNotes*.*xbundle" 2^>nul') do if exist %%i set "StickyNotes_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StorePurchaseApp*.*xbundle" 2^>nul') do if exist %%i set "StorePurchaseApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Terminal*.*xbundle" 2^>nul') do if exist %%i set "Terminal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Todos*.*xbundle" 2^>nul') do if exist %%i set "Todos_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "VP9VideoExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Wallet*.*xbundle" 2^>nul') do if exist %%i set "Wallet_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebMediaExtensions*.*xbundle" 2^>nul') do if exist %%i set "WebMediaExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "WebpImageExtension_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsNotepad*.*xbundle" 2^>nul') do if exist %%i set "Notepad_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsStore*.*xbundle" 2^>nul') do if exist %%i set "WindowsStore_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsSubsystemForAndroid*.*xbundle" 2^>nul') do if exist %%i set "WindowsSubsystemForAndroid_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Xbox.TCUI*.*xbundle" 2^>nul') do if exist %%i set "XboxTCUI_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxApp*.*xbundle" 2^>nul') do if exist %%i set "Xbox_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGameOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxGameOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGamingOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxGamingOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxIdentityProvider*.*xbundle" 2^>nul') do if exist %%i set "XboxIdentityProvider_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxLIVEGames*.*xbundle" 2^>nul') do if exist %%i set "XboxLiveGames_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxSpeechToTextOverlay*.*xbundle" 2^>nul') do if exist %%i set "XboxSpeechToTextOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *YourPhone*.*xbundle" 2^>nul') do if exist %%i set "YourPhone_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneMusic*.*xbundle" 2^>nul') do if exist %%i set "ZuneMusic_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneVideo*.*xbundle" 2^>nul') do if exist %%i set "ZuneVideo_Appx=%Apps%\%%i"

for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*%ImageArchitecture%*.Appx" 2^>nul') do set "AdvertisingXaml_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b *PlayReadyClient*%ImageArchitecture%*.appx" 2^>nul') do set "MediaPlayReadyClient22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.3*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeFramework13_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.6*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeFramework16_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.7*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeFramework17_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.1*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeFramework21_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeFramework22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.3*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime13_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.4*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.6*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime16_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.7*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime17_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.1*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime21_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*%ImageArchitecture%*.Appx" 2^>nul') do set "NETNativeRuntime22_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "arm" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*arm*.Appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "arm64" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*arm64*.Appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "x86" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*x86*.Appx" 2^>nul') do set "ServicesStoreEngagement_Appx=/DependencyPackagePath:%Apps%\%%i"
if "%ImageArchitecture%" equ "x64" for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*x64*.Appx" 2^>nul') do set "ServicesStoreEngagement_Appx=%ServicesStoreEngagement_Appx% /DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml20_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml21_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.2*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml22_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.3*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml23_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.4*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml24_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.5*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml25_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.6*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml26_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.7*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml27_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.110.00.UWPDesktop*%ImageArchitecture%*.Appx" 2^>nul') do set "VCLibsUWPDesktop11_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00.UWPDesktop*%ImageArchitecture%*.Appx" 2^>nul') do set "VCLibsUWPDesktop12_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*%ImageArchitecture%*.Appx" 2^>nul') do set "VCLibsUWPDesktop14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00_*%ImageArchitecture%*.Appx" 2^>nul') do set "VCLibs12_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00_*%ImageArchitecture%*.Appx" 2^>nul') do set "VCLibs14_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WinJS.2*.appx" 2^>nul') do set "WinJS20_Appx=/DependencyPackagePath:%Apps%\%%i"

cd /d "%ROOT%\"

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 集成 Microsoft 默认内置应用
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft 默认内置应用########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft 默认内置应用############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		:: 集成 Windows 8.1 默认内置应用到安装映像文件
		if "%SelectedSourceOS%" equ "w81" (
			if "%InboxApp%" equ "Alarms" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%VCLibs12_Appx%", "%Alarms_License%"
			if "%InboxApp%" equ "BingFinance" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 财经", "%BingFinance_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingFinance_License%"
			if "%InboxApp%" equ "BingFoodDrink" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 美食", "%BingFoodDrink_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingFoodDrink_License%"
			if "%InboxApp%" equ "BingHealthFitness" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 健康", "%BingHealthFitness%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingHealthFitness_License%"
			if "%InboxApp%" equ "BingMaps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 地图", "%BingMaps_Appx%", "%VCLibs12_Appx%", "%BingMaps_License%"
			if "%InboxApp%" equ "BingNews" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 资讯", "%BingNews_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingNews_License%"
			if "%InboxApp%" equ "BingSports" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 体育", "%BingSports_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingSports_License%"
			if "%InboxApp%" equ "BingTravel" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 旅游", "%BingTravel_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingTravel_License%"
			if "%InboxApp%" equ "BingWeather" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 天气", "%BingWeather_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingWeather_License%"
			if "%InboxApp%" equ "Calculator" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%VCLibs12_Appx%", "%Calculator_License%"
			if "%InboxApp%" equ "CommunicationsApps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "日历、邮件和人脉", "%CommunicationsApps_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%CommunicationsApps_License%"
			if "%InboxApp%" equ "HelpAndTips" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "帮助和提示", "%HelpAndTips_Appx%", "%VCLibs12_Appx%", "%HelpAndTips_License%"
			if "%InboxApp%" equ "OneNote" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs12_Appx%", "%OneNote_License%"
			if "%InboxApp%" equ "Reader" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读器", "%Reader_Appx%", "%VCLibs12_Appx%", "%Reader_License%"
			if "%InboxApp%" equ "ReadingList" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读列表", "%ReadingList_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%ReadingList_License%"
			if "%InboxApp%" equ "Scan" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "扫描", "%Scan_Appx%", "%VCLibs12_Appx%", "%Scan_License%"
			if "%InboxApp%" equ "Skype" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype 应用", "%Skype_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%Skype_License%"
			if "%InboxApp%" equ "SoundRecorder" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%VCLibs12_Appx%", "%SoundRecorder_License%"
			if "%InboxApp%" equ "XboxLiveGames" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Live 游戏", "%XboxLiveGames_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%XboxLiveGames_License%"
			if "%InboxApp%" equ "ZuneMusic" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Zune 音乐", "%ZuneMusic_Appx%", "%MediaPlayReadyClient22_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%ZuneMusic_License%"
			if "%InboxApp%" equ "ZuneVideo" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Zune 视频", "%ZuneVideo_Appx%", "%MediaPlayReadyClient22_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%ZuneVideo_License%"

			if "%InboxApp%" equ "AllApps" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%VCLibs12_Appx%", "%Alarms_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 财经", "%BingFinance_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFinance_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 美食", "%BingFoodDrink_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFoodDrink_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 健康", "%BingHealthFitness%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingHealthFitness_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 地图", "%BingMaps_Appx%", "%VCLibs12_Appx%", "%BingMaps_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 资讯", "%BingNews_Appx%", "%VCLibs12_Appx%", "%WinJS20_Appx%", "%BingNews_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 体育", "%BingSports_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingSports_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 旅游", "%BingTravel_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingTravel_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 天气", "%BingWeather_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingWeather_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%VCLibs12_Appx%", "%Calculator_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "日历、邮件和人脉", "%CommunicationsApps_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%CommunicationsApps_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "帮助和提示", "%HelpAndTips_Appx%", "%VCLibs12_Appx%", "%HelpAndTips_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs12_Appx%", "%OneNote_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读器", "%Reader_Appx%", "%VCLibs12_Appx%", "%Reader_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读列表", "%ReadingList_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%ReadingList_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "扫描", "%Scan_Appx%", "%VCLibs12_Appx%", "%Scan_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype 应用", "%Skype_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%Skype_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%VCLibs12_Appx%", "%SoundRecorder_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Live 游戏", "%XboxLiveGames_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%XboxLiveGames_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Zune 音乐", "%ZuneMusic_Appx%", "%MediaPlayReadyClient22_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%ZuneMusic_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Zune 视频", "%ZuneVideo_Appx%", "%MediaPlayReadyClient22_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%ZuneVideo_License%"
			)
		)

		:: 集成 Windows 10/11 默认内置应用到安装映像
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if "%InboxApp%" equ "Alarms" if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Alarms_License%"
			if "%InboxApp%" equ "Alarms" if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Alarms_License%"

			if "%InboxApp%" equ "AV1VideoExtension" (
				if "%ImageArchitecture%" equ "x86" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成由 AV1 视频编解码器插件提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%AV1VideoExtension_Appx%" "%VCLibs14_Appx%" /SkipLicense
					echo.
				)

				if "%ImageArchitecture%" equ "x64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " AV1 视频编解码器插件", "%AV1VideoExtension_Appx%", "%VCLibs14_Appx%", "%AV1VideoExtension_License%"
			)
			if "%InboxApp%" equ "BingNews" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "资讯", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingNews_License%"
			if "%InboxApp%" equ "BingWeather" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "天气", "%BingWeather_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingWeather_License%"
			if "%InboxApp%" equ "Calculator" if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%Calculator_License%"
			if "%InboxApp%" equ "Calculator" if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Calculator_License%"
			if "%InboxApp%" equ "Camera" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "相机", "%Camera_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Camera_License%"
			if "%InboxApp%" equ "ClientWebExperience" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "小工具", "%ClientWebExperience_Appx%", "%VCLibs14_Appx%", "%ClientWebExperience_License%"
			if "%InboxApp%" equ "CommunicationsApps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 邮件", "%UIXaml26_Appx% %CommunicationsApps_Appx%", "%VCLibs14_Appx%", "%CommunicationsApps_License%"
			if "%InboxApp%" equ "Cortana" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Cortana ", "%Cortana_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Cortana_License%"
			if "%InboxApp%" equ "DesktopAppInstaller" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用安装程序", "%DesktopAppInstaller_Appx%", "%VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"

			if "%InboxApp%" equ "DirectXRuntime" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成由 DirectX Runtime 提供的 Appx 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%DirectXRuntime_Appx%" /SkipLicense
				echo.
			)

			if "%InboxApp%" equ "FeedbackHub" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "反馈中心", "%FeedbackHub_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%FeedbackHub_License%"
			if "%InboxApp%" equ "GamingApp" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Gaming 应用", "%GamingApp_Appx%", "%UIXaml23_Appx% %VCLibsUWPDesktop11_Appx% %VCLibsUWPDesktop12_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%GamingApp_License%"

			if "%InboxApp%" equ "GamingServices" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成由游戏服务提供的 Appx 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%GamingServices_Appx%" "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%" /SkipLicense
				echo.
			)

			if "%InboxApp%" equ "GetHelp" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "获取帮助", "%GetHelp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%GetHelp_License%"
			if "%InboxApp%" equ "Getstarted" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "使用技巧", "%Getstarted_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Getstarted_License%"
			if "%InboxApp%" equ "HEIFImageExtension" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEIF 图像编解码器插件", "%HEIFImageExtension_Appx%", "%VCLibs14_Appx%", "%HEIFImageExtension_License%"
			if "%InboxApp%" equ "HEVCVideoExtension" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEVC 视频编解码器插件", "%HEVCVideoExtension_Appx%", "%VCLibs14_Appx%", "%HEVCVideoExtension_License%"
			if "%InboxApp%" equ "Maps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "地图", "%Maps_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml23_Appx% %VCLibs14_Appx%", "%Maps_License%"
			if "%InboxApp%" equ "Messaging" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "消息", "%Messaging_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Messaging_License%"
			if "%InboxApp%" equ "MixedRealityPortal" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "混合现实门户", "%MixedRealityPortal_Appx%", "%VCLibs14_Appx%", "%MixedRealityPortal_License%"
			if "%InboxApp%" equ "MixedRealityViewer" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " 3D 查看器", "%MixedRealityViewer_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MixedRealityViewer_License%"
			if "%InboxApp%" equ "MPEG2VideoExtension" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " MPEG-2 视频编解码器插件", "%MPEG2VideoExtension_Appx%", "%VCLibs14_Appx%", "%MPEG2VideoExtension_License%"
			if "%InboxApp%" equ "Notepad" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "记事本", "%Notepad_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Notepad_License%"
			if "%InboxApp%" equ "OfficeHub" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "我的 Office ", "%OfficeHub_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OfficeHub_License%"
			if "%InboxApp%" equ "OneConnect" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "移动套餐", "%OneConnect_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%OneConnect_License%"
			if "%InboxApp%" equ "OneNote" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs14_Appx%", "%OneNote_License%"
			if "%InboxApp%" equ "Paint" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图", "%Paint_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Paint_License%"
			if "%InboxApp%" equ "Paint3D" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图 3D ", "%Paint3D_Appx%", "%UIXaml20_Appx% %VCLibs14_Appx%", "%Paint3D_License%"
			if "%InboxApp%" equ "People" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "人脉", "%People_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%People_License%"
			if "%InboxApp%" equ "Photos" if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "照片", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Photos_License%"
			if "%InboxApp%" equ "Photos" if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "照片", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Photos_License%"

			if "%InboxApp%" equ "PhotosMediaEngine" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成照片媒体引擎加载项提供的 Appx 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%PhotosMediaEngine_Appx%" "%VCLibs14_Appx%" /SkipLicense
				echo.
			)

			if "%InboxApp%" equ "PowerAutomateDesktop" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Power Automate Desktop ", "%PowerAutomateDesktop_Appx%", "%VCLibsUWPDesktop14_Appx%", "%PowerAutomateDesktop_License%"
			if "%InboxApp%" equ "Print3D" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Print 3D ", "%Print3D_Appx%", "%VCLibs14_Appx%", "%Print3D_License%"
			if "%InboxApp%" equ "ScreenSketch" if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "截图和草图", "%ScreenSketch_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
			if "%InboxApp%" equ "ScreenSketch" if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "截图和草图", "%ScreenSketch_Appx%", "%UIXaml26_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
			if "%InboxApp%" equ "Skype" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype ", "%Skype_Appx%", "", "%Skype_License%"
			if "%InboxApp%" equ "SolitaireCollection" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Solitaire Collection ", "%SolitaireCollection_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%SolitaireCollection_License%"
			if "%InboxApp%" equ "SoundRecorder" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%UIXaml23_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
			if "%InboxApp%" equ "StickyNotes" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "便笺", "%StickyNotes_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StickyNotes_License%"
			if "%InboxApp%" equ "StorePurchaseApp" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用商店体验主机", "%StorePurchaseApp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StorePurchaseApp_License%"

			if "%InboxApp%" equ "Terminal" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "终端", "%Terminal_Appx%", "", "%Terminal_License%"
				call :MountImageRegistry "%InstallMount%\%%i"
				reg add "HKLM\TK_SYSTEM\ControlSet001\Services\condrv" /v "Start" /t REG_DWORD /d "2" /f >nul
				call :UnMountImageRegistry
			)

			if "%InboxApp%" equ "Todos" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Todos ", "%Todos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Todos_License%"
			if "%InboxApp%" equ "VP9VideoExtensions" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Google 的 VP9 WebM 视频编解码器插件", "%VP9VideoExtensions_Appx%", "%VCLibs14_Appx%", "%VP9VideoExtensions_License%"
			if "%InboxApp%" equ "Wallet" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Microsoft Pay ", "%Wallet_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%Wallet_License%"
			if "%InboxApp%" equ "WebMediaExtensions" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Web 媒体编解码器插件", "%WebMediaExtensions_Appx%", "%VCLibs14_Appx%", "%WebMediaExtensions_License%"
			if "%InboxApp%" equ "WebpImageExtension" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " WebP 图像编解码器插件", "%WebpImageExtension_Appx%", "%VCLibs14_Appx%", "%WebpImageExtension_License%"
			if "%InboxApp%" equ "WindowsStore" if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
			if "%InboxApp%" equ "WindowsStore" if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"

			if "%InboxApp%" equ "WindowsSubsystemForAndroid" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成由适用于 Android 的 Windows 子系统提供的 Appx 程序包……
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%WindowsSubsystemForAndroid_Appx%" "%VCLibs14_Appx%" /SkipLicense
				echo.
			)

			if "%InboxApp%" equ "Xbox" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox 主机小帮手", "%Xbox_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Xbox_License%"
			if "%InboxApp%" equ "XboxGameOverlay" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar Plugin ", "%XboxGameOverlay_Appx%", "%VCLibs14_Appx%", "%XboxGameOverlay_License%"
			if "%InboxApp%" equ "XboxGamingOverlay" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar ", "%XboxGamingOverlay_Appx%", "%UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%XboxGamingOverlay_License%"
			if "%InboxApp%" equ "XboxIdentityProvider" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Identity Provider ", "%XboxIdentityProvider_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxIdentityProvider_License%"
			if "%InboxApp%" equ "XboxSpeechToTextOverlay" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Live 游戏内体验", "%XboxSpeechToTextOverlay_Appx%", "%VCLibs14_Appx%", "%XboxSpeechToTextOverlay_License%"
			if "%InboxApp%" equ "XboxTCUI" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox UI ", "%XboxTCUI_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxTCUI_License%"
			if "%InboxApp%" equ "YourPhone" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "你的手机", "%YourPhone_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%YourPhone_License%"
			if "%InboxApp%" equ "ZuneMusic" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Groove 音乐", "%ZuneMusic_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
			if "%InboxApp%" equ "ZuneVideo" if "%ImageBuild%" geq "19041" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
			if "%InboxApp%" equ "ZuneVideo" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"

			if "%InboxApp%" equ "AllApps" (
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " 3D 查看器", "%MixedRealityViewer_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MixedRealityViewer_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Alarms_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Alarms_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用安装程序", "%DesktopAppInstaller_Appx%", "%VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"

				if "%ImageArchitecture%" equ "x86" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成由 AV1 视频编解码器插件提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%AV1VideoExtension_Appx%" "%VCLibs14_Appx%" /SkipLicense
					echo.
				)

				if "%ImageArchitecture%" equ "x64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " AV1 视频编解码器插件", "%AV1VideoExtension_Appx%", "%VCLibs14_Appx%", "%AV1VideoExtension_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%Calculator_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Calculator_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "相机", "%Camera_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Camera_License%"
				if "%ImageBuild%" geq "19041" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Cortana ", "%Cortana_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Cortana_License%"

				if "%ImageBuild%" geq "18363" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成由 DirectX Runtime 提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%DirectXRuntime_Appx%" /SkipLicense
					echo.
				)

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "反馈中心", "%FeedbackHub_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%FeedbackHub_License%"
				if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Gaming 应用", "%GamingApp_Appx%", "%UIXaml23_Appx% %VCLibsUWPDesktop11_Appx% %VCLibsUWPDesktop12_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%GamingApp_License%"

				if "%SelectedSourceOS%" equ "w11" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成由游戏服务提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%GamingServices_Appx%" "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%" /SkipLicense
					echo.
				)

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "获取帮助", "%GetHelp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%GetHelp_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Google 的 VP9 WebM 视频编解码器插件", "%VP9VideoExtensions_Appx%", "%VCLibs14_Appx%", "%VP9VideoExtensions_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Groove 音乐", "%ZuneMusic_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEIF 图像编解码器插件", "%HEIFImageExtension_Appx%", "%VCLibs14_Appx%", "%HEIFImageExtension_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEIF 视频编解码器插件", "%HEVCVideoExtension_Appx%", "%VCLibs14_Appx%", "%HEVCVideoExtension_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "地图", "%Maps_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml23_Appx% %VCLibs14_Appx%", "%Maps_License%"
				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "消息", "%Messaging_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Messaging_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " MPEG-2 视频编解码器插件", "%MPEG2VideoExtension_Appx%", "%VCLibs14_Appx%", "%MPEG2VideoExtension_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Microsoft Pay ", "%Wallet_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%Wallet_License%"
				if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "混合现实门户", "%MixedRealityPortal_Appx%", "%VCLibs14_Appx%", "%MixedRealityPortal_License%"
				if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "移动套餐", "%OneConnect_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%OneConnect_License%"
				if "%ImageBuild%" geq "19041" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "我的 Office ", "%OfficeHub_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OfficeHub_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "资讯", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingNews_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "记事本", "%Notepad_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Notepad_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs14_Appx%", "%OneNote_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图", "%Paint_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Paint_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图 3D ", "%Paint3D_Appx%", "%UIXaml20_Appx% %VCLibs14_Appx%", "%Paint3D_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "人脉", "%People_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%People_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "照片", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Photos_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "照片", "%Photos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Photos_License%"

				if "%ImageBuild%" geq "15063" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成照片媒体引擎加载项提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%PhotosMediaEngine_Appx%" "%VCLibs14_Appx%" /SkipLicense
					echo.
				)

				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Power Automate Desktop ", "%PowerAutomateDesktop_Appx%", "%VCLibsUWPDesktop14_Appx%", "%PowerAutomateDesktop_License%"
				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Print 3D ", "%Print3D_Appx%", "%VCLibs14_Appx%", "%Print3D_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "截图和草图", "%ScreenSketch_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "截图和草图", "%ScreenSketch_Appx%", "%UIXaml26_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype ", "%Skype_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Skype_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Solitaire Collection ", "%SolitaireCollection_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%SolitaireCollection_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "便笺", "%StickyNotes_Appx%", "", "%StickyNotes_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用商店体验主机", "%StorePurchaseApp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StorePurchaseApp_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "使用技巧", "%Getstarted_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml26_Appx% %VCLibs14_Appx%", "%Getstarted_License%"

				if "%ImageBuild%" geq "18362" (
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "终端", "%Terminal_Appx%", "", "%Terminal_License%"
					call :MountImageRegistry "%InstallMount%\%%i"
					reg add "HKLM\TK_SYSTEM\ControlSet001\Services\condrv" /v "Start" /t REG_DWORD /d "2" /f >nul
					call :UnMountImageRegistry
				)

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Todos ", "%Todos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Todos_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%UIXaml23_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "天气", "%BingWeather_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingWeather_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Web 媒体编解码器插件", "%WebMediaExtensions_Appx%", "%VCLibs14_Appx%", "%WebMediaExtensions_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " WebP 图像编解码器插件", "%WebpImageExtension_Appx%", "%VCLibs14_Appx%", "%WebpImageExtension_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "小工具", "%ClientWebExperience_Appx%", "%VCLibs14_Appx%", "%ClientWebExperience_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 邮件", "%CommunicationsApps_Appx%", "%UIXaml26_Appx% %VCLibs14_Appx%", "%CommunicationsApps_License%"
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"

				if "%SelectedSourceOS%" equ "w11" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成由适用于 Android 的 Windows 子系统提供的 Appx 程序包……
					echo.-------------------------------------------------------------------------------
					%DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:"%WindowsSubsystemForAndroid_Appx%" "%VCLibs14_Appx%" /SkipLicense
					echo.
				)

				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox 主机小帮手", "%Xbox_Appx% %NETNativeFramework17_Appx%", "%NETNativeRuntime17_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Xbox_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar Plugin ", "%XboxGameOverlay_Appx%", "%VCLibs14_Appx%", "%XboxGameOverlay_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar ", "%XboxGamingOverlay_Appx%", "%UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%XboxGamingOverlay_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Identity Provider ", "%XboxIdentityProvider_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxIdentityProvider_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Live 游戏内体验", "%XboxSpeechToTextOverlay_Appx%", "%VCLibs14_Appx%", "%XboxSpeechToTextOverlay_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox UI ", "%XboxTCUI_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxTCUI_License%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "你的手机", "%YourPhone_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%YourPhone_License%"
			)

			echo.-------------------------------------------------------------------------------
			echo.正在优化 Microsoft 默认内置应用……
			echo.-------------------------------------------------------------------------------
			%DISM% /Image:"%InstallMount%\%%i" /Optimize-ProvisionedAppxPackages
			echo.
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft 默认内置应用已完成##########################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause

set InboxApp=

set Apps=

set Alarms_Appx=
set AV1VideoExtension_Appx=
set BingFinance_Appx=
set BingFoodDrink_Appx=
set BingHealthFitness_Appx=
set BingMaps_Appx=
set BingNews_Appx=
set BingSports_Appx=
set BingTravel_Appx=
set BingWeather_Appx=
set Calculator_Appx=
set Camera_Appx=
set ClientWebExperience_Appx=
set CommunicationsApps_Appx=
set Cortana_Appx=
set DesktopAppInstaller_Appx=
set DirectXRuntime_Appx=
set FeedbackHub_Appx=
set GamingApp_Appx=
set GamingServices_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_Appx=
set HelpAndTips_Appx=
set HEVCVideoExtension_Appx=
set Maps_Appx=
set Messaging_Appx=
set MixedRealityPortal_Appx=
set MixedRealityViewer_Appx=
set MPEG2VideoExtension_Appx=
set Notepad_Appx=
set OfficeHub_Appx=
set OneConnect_Appx=
set OneNote_Appx=
set Paint_Appx=
set Paint3D_Appx=
set People_Appx=
set Photos_Appx=
set PhotosMediaEngine_Appx=
set PowerAutomateDesktop_Appx=
set Print3D_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set Skype_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set StorePurchaseApp_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set AdvertisingXaml_Appx=
set MediaPlayReadyClient22_Appx=
set NETNativeFramework13_Appx=
set NETNativeFramework16_Appx=
set NETNativeFramework17_Appx=
set NETNativeFramework21_Appx=
set NETNativeFramework22_Appx=
set NETNativeRuntime13_Appx=
set NETNativeRuntime14_Appx=
set NETNativeRuntime16_Appx=
set NETNativeRuntime17_Appx=
set NETNativeRuntime21_Appx=
set NETNativeRuntime22_Appx=
set ServicesStoreEngagement_Appx=
set UIXaml20_Appx=
set UIXaml21_Appx=
set UIXaml22_Appx=
set UIXaml23_Appx=
set UIXaml24_Appx=
set UIXaml25_Appx=
set UIXaml26_Appx=
set UIXaml27_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibsUWPDesktop11_Appx=
set VCLibsUWPDesktop12_Appx=
set VCLibsUWPDesktop14_Appx=
set VCLibs14_Appx=
set WinJS20_Appx=

endlocal

:: Returning to Integrate Microsoft 默认内置应用菜单
goto :IntInboxApps
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 集成 Microsoft Office 桌面通用 Windows 平台（UWP）应用
::-------------------------------------------------------------------------------------------
:IntOfficeUWPApps

setlocal

set OfficeUWPApp=
set OfficeDesktop_Appx=
set OfficeAccess_Appx=
set OfficeExcel_Appx=
set OfficeOutlook_Appx=
set OfficePowerPoint_Appx=
set OfficePublisher_Appx=
set OfficeWord_Appx=

set OfficeDesktop_License=
set OfficeAccess_License=
set OfficeExcel_License=
set OfficeOutlook_License=
set OfficePowerPoint_License=
set OfficePublisher_License=
set OfficeWord_License=

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Microsoft Office 桌面 ^(UWP^) 应用
echo.===============================================================================
echo.

:: 检查 Microsoft Office 桌面（UWP）应用文件夹是否是空的
if not exist "%OfficeUWP%\*.appxbundle" (
	echo.Microsoft Office 桌面 ^(UWP^) 应用包文件夹 ^<Packs\%OfficeUWP%^> 是空的……
	echo.
	echo.请复制 Microsoft Office 桌面 ^(UWP^) 应用包文件到相应文件夹……
	echo.
	goto :Stop
)

if not exist "%OfficeUWP%\*.xml" (
	echo.Microsoft Office 桌面 ^(UWP^) 应用包文件夹 ^<Packs\%OfficeUWP%^> 是空的……
	echo.
	echo.请复制 Microsoft Office 桌面 ^(UWP^) 应用包文件到相应文件夹……
	echo.
	goto :Stop
)

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 集成 Microsoft Office 桌面 ^(UWP^) 应用菜单
echo.===============================================================================
echo.
echo.  [1]  Microsoft Office Access 2016
echo.
echo.  [2]  Microsoft Office Excel 2016
echo.
echo.  [3]  Microsoft Office Outlook 2016
echo.
echo.  [4]  Microsoft Office PowerPoint 2016
echo.
echo.  [5]  Microsoft Office Publisher 2016
echo.
echo.  [6]  Microsoft Office Word 2016
echo.
echo.
echo.  [A]  所有应用
echo.
echo.  [X]  返回
echo.
echo.===============================================================================
echo.
choice /C:123456AX /N /M "请输入你的选项 ："

if errorlevel 8 goto :IntFeaturesMenu
if errorlevel 7 set "OfficeUWPApp=AllOfficeApps"
if errorlevel 6 set "OfficeUWPApp=OfficeWord"
if errorlevel 5 set "OfficeUWPApp=OfficePublisher"
if errorlevel 4 set "OfficeUWPApp=OfficePowerPoint"
if errorlevel 3 set "OfficeUWPApp=OfficeOutlook"
if errorlevel 2 set "OfficeUWPApp=OfficeExcel"
if errorlevel 1 set "OfficeUWPApp=OfficeAccess"

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 获取 Microsoft Office 桌面（UWP）应用文件完整路径名称
cd /d "%OfficeUWP%\"

for /f %%i IN ('"dir /b *Microsoft.Office.Desktop_*.appxbundle" 2^>nul') do if exist %%i set "OfficeDesktop_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Access_*.appxbundle" 2^>nul') do if exist %%i set "OfficeAccess_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Excel_*.appxbundle" 2^>nul') do if exist %%i set "OfficeExcel_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Outlook_*.appxbundle" 2^>nul') do if exist %%i set "OfficeOutlook_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.PowerPoint*.appxbundle" 2^>nul') do if exist %%i set "OfficePowerPoint_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Publisher_*.appxbundle" 2^>nul') do if exist %%i set "OfficePublisher_Appx=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Word_*.appxbundle" 2^>nul') do if exist %%i set "OfficeWord_Appx=%OfficeUWP%\%%i"

for /f %%i IN ('"dir /b *Microsoft.Office.Desktop_*.xml" 2^>nul') do if exist %%i set "OfficeDesktop_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Access_*.xml" 2^>nul') do if exist %%i set "OfficeAccess_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Excel_*.xml" 2^>nul') do if exist %%i set "OfficeExcel_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Outlook_*.xml" 2^>nul') do if exist %%i set "OfficeOutlook_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.PowerPoint_*.xml" 2^>nul') do if exist %%i set "OfficePowerPoint_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Publisher_*.xml" 2^>nul') do if exist %%i set "OfficePublisher_License=%OfficeUWP%\%%i"
for /f %%i IN ('"dir /b *Microsoft.Office.Desktop.Word_*.xml" 2^>nul') do if exist %%i set "OfficeWord_License=%OfficeUWP%\%%i"

cd /d "%ROOT%\"

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Microsoft Office 桌面 ^(UWP^) 应用
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Office 桌面 ^(UWP^) 应用##############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%OfficeUWPApp%" equ "AllOfficeApps" echo.####正在集成 Microsoft Office 桌面 ^(UWP^) 应用##################################
if "%OfficeUWPApp%" equ "OfficeAccess" echo.####正在集成 Microsoft Office 桌面 - Access ^(UWP^) 应用#########################
if "%OfficeUWPApp%" equ "OfficeExcel" echo.####正在集成 Microsoft Office 桌面 - Excel ^(UWP^) 应用##########################
if "%OfficeUWPApp%" equ "OfficeOutlook" echo.####正在集成 Microsoft Office 桌面 - Outlook ^(UWP^) 应用########################
if "%OfficeUWPApp%" equ "OfficePowerPoint" echo.####正在集成 Microsoft Office 桌面 - PowerPoint ^(UWP^) 应用#####################
if "%OfficeUWPApp%" equ "OfficePublisher" echo.####正在集成 Microsoft Office 桌面 - Publisher ^(UWP^) 应用###################
if "%OfficeUWPApp%" equ "OfficeWord" echo.####正在集成 Microsoft Office 桌面 - Word ^(UWP^) 应用###########################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%OfficeUWPApp%" equ "OfficeAccess" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeAccess_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeAccess_License%
		if "%OfficeUWPApp%" equ "OfficeExcel" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeExcel_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeExcel_License%
		if "%OfficeUWPApp%" equ "OfficeOutlook" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeOutlook_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeOutlook_License%
		if "%OfficeUWPApp%" equ "OfficePowerPoint" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficePowerPoint_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficePowerPoint_License%
		if "%OfficeUWPApp%" equ "OfficePublisher" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficePublisher_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficePublisher_License%
		if "%OfficeUWPApp%" equ "OfficeWord" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeWord_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeWord_License%
		if "%OfficeUWPApp%" equ "AllOfficeApps" %DISM% /Image:"%InstallMount%\%%i" /Add-ProvisionedAppxPackage /PackagePath:%OfficeDesktop_Appx% /OptionalPackagePath=%OfficeAccess_Appx% /OptionalPackagePath=%OfficeExcel_Appx% /OptionalPackagePath=%OfficeOutlook_Appx% /OptionalPackagePath=%OfficePowerPoint_Appx% /OptionalPackagePath=%OfficePublisher_Appx% /OptionalPackagePath=%OfficeWord_Appx% /LicensePath:%OfficeDesktop_License% /LicensePath:%OfficeAccess_License% /LicensePath:%OfficeExcel_License% /LicensePath:%OfficeOutlook_License% /LicensePath:%OfficePowerPoint_License% /LicensePath:%OfficePublisher_License% /LicensePath:%OfficeWord_License%
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Office 桌面 ^(UWP^) 应用已完成################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause

set OfficeUWPApp=
set OfficeDesktop_Appx=
set OfficeAccess_Appx=
set OfficeExcel_Appx=
set OfficeOutlook_Appx=
set OfficePowerPoint_Appx=
set OfficePublisher_Appx=
set OfficeWord_Appx=

set OfficeDesktop_License=
set OfficeAccess_License=
set OfficeExcel_License=
set OfficeOutlook_License=
set OfficePowerPoint_License=
set OfficePublisher_License=
set OfficeWord_License=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows Thin PC 附加功能模组
::-------------------------------------------------------------------------------------------
:IntThinPcPkgs

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                MSMG 工具箱 - 集成 Windows Thin PC 附加功能
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                              警         告
	echo.                              =============
	echo.
	echo.  在集成语言包或任何 Windows 功能之前，请不要集成任何更新。如果在集成任何
	echo.  更新、语言/功能之前集成了包含语言/功能相关资源的任何更新 ^(包括修补常规
	echo.  分发版本 [GDR]、零日修补程序 [ZDP] 或服务包 [SP] ^) ，将不会应用在更新中
	echo.  包含的特定更改，你必须重新集成更新。请始终在安装更新之前集成语言包/ 
	echo.  Windows 功能。
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set Feature=

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 集成 Windows Thin PC 附加功能
echo.===============================================================================

:: 检查多索引维护模式是否已启用
if "%ImageIndexNo:~0,2%" equ "," (
	echo.当多索引维护模式已启用时，此功能不可用……
	echo.
	echo.请使用单一索引重新选择源文件……
	goto :Stop
)

:: 检查所选择的源操作系统是否是 Windows Thin PC 操作系统
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" (
	echo.所选择的源操作系统不是 Windows Thin PC 操作系统……
	echo.
	echo.请使用 Windows Thin PC 源操作系统……
	goto :Stop
)

echo.  [A]  Microsoft .NET Framework 3.5 with Client Profile
echo.  [B]  Windows 备份和恢复
echo.  [C]  Windows 基本帮助
echo.  [D]  Windows Defender
echo.  [E]  Windows DVD Maker
echo.  [F]  Windows 传真和扫描
echo.  [G]  Windows ISO 刻录机
echo.  [H]  Windows Media Center
echo.  [I]  Windows Media Player 高级编解码器
echo.  [J]  Windows 移动中心
echo.  [K]  Windows 家长控制
echo.  [L]  Windows 照片查看器
echo.  [M]  Windows Search
echo.  [N]  Windows 语音和文本转语音美国英语包
echo.  [O]  Windows Tablet PC 支持
echo.
echo.  [1]  所有功能
echo.
echo.  [X]  返回
echo.===============================================================================
choice /C:ABCDEFGHIJKLMNo1X /N /M "请输入你的选项 ："
if errorlevel 17 goto :IntegrateMenu
if errorlevel 16 set "Feature=All"
if errorlevel 15 set "Feature=TabletPC"
if errorlevel 14 set "Feature=SpeechText"
if errorlevel 13 set "Feature=Search"
if errorlevel 12 set "Feature=PhotoViewer"
if errorlevel 11 set "Feature=ParentalControl"
if errorlevel 10 set "Feature=MobilityCenter"
if errorlevel 9  set "Feature=PremiumCodecs"
if errorlevel 8  set "Feature=MediaCenter"
if errorlevel 7  set "Feature=ISOBurner"
if errorlevel 6  set "Feature=FaxScan"
if errorlevel 5  set "Feature=DVDMaker"
if errorlevel 4  set "Feature=Defender"
if errorlevel 3  set "Feature=BasicHelp"
if errorlevel 2  set "Feature=BackupRestore"
if errorlevel 1  set "Feature=NetFx35"

cls
echo.===============================================================================
if "%Feature%" equ "NetFx35" echo.          MSMG 工具箱 - 集成 Microsoft .NET Framework 3.5 附加功能
if "%Feature%" equ "BackupRestore" echo.               MSMG 工具箱 - 集成 Windows 备份和恢复附加功能
if "%Feature%" equ "BasicHelp" echo.                MSMG 工具箱 - 集成 Windows 基本帮助附加功能
if "%Feature%" equ "Defender" echo.                MSMG 工具箱 - 集成 Windows Defender 附加功能
if "%Feature%" equ "DVDMaker" echo.                MSMG 工具箱 - 集成 Windows DVD Maker 附加功能
if "%Feature%" equ "FaxScan" echo.                MSMG 工具箱 - 集成 Windows 传真和扫描附加功能
if "%Feature%" equ "ISOBurner" echo.                MSMG 工具箱 - 集成 Windows ISO 刻录机附加功能
if "%Feature%" equ "MediaCenter" echo.               MSMG 工具箱 - 集成 Windows Media Center 附加功能
if "%Feature%" equ "PremiumCodecs" echo.           MSMG 工具箱 - 集成 Windows Media Player 高级编解码器功能
if "%Feature%" equ "MobilityCenter" echo.                  MSMG 工具箱 - 集成 Windows 移动中心附加功能
if "%Feature%" equ "ParentalControl" echo.                  MSMG 工具箱 - 集成 Windows 家长控制附加功能
if "%Feature%" equ "PhotoViewer" echo.                 MSMG 工具箱 - 集成 Windows 照片查看器附加功能
if "%Feature%" equ "Search" echo.                  MSMG 工具箱 - 集成 Windows Search 附加功能
if "%Feature%" equ "SpeechText" echo.                 MSMG 工具箱 - 集成 Windows 语音和文本附加功能
if "%Feature%" equ "TabletPC" echo.                 MSMG 工具箱 - 集成 Windows Tablet PC 附加功能
if "%Feature%" equ "All" echo.                MSMG 工具箱 - 集成 Windows Thin PC 附加功能
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Windows Thin PC 附加功能文件夹是否是空的
if not exist "%ThinPC%\*.*" (
	echo.Windows Thin PC 附加功能文件夹 ^<Packs\ThinPC^> 是空的……
	echo.
	echo.请复制 Windows Thin PC 附加功能文件到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####正在开始集成 Microsoft .NET Framework 3.5 附加功能#########################
if "%Feature%" equ "BackupRestore" echo.####正在开始集成 Windows 备份和恢复附加功能####################################
if "%Feature%" equ "BasicHelp" echo.####正在开始集成 Windows 基本帮助附加功能######################################
if "%Feature%" equ "Defender" echo.####正在开始集成 Windows Defender 附加功能#####################################
if "%Feature%" equ "DVDMaker" echo.####正在开始集成 Windows DVD Maker 附加功能####################################
if "%Feature%" equ "FaxScan" echo.####正在开始集成 Windows 传真和扫描附加功能####################################
if "%Feature%" equ "ISOBurner" echo.####正在开始集成 Windows ISO 刻录机附加功能####################################
if "%Feature%" equ "MediaCenter" echo.####正在开始集成 Windows Media Center 附加功能#################################
if "%Feature%" equ "PremiumCodecs" echo.####正在开始集成 Windows Media Player 高级编解码器功能#########################
if "%Feature%" equ "MobilityCenter" echo.####正在开始集成 Windows 移动中心附加功能######################################
if "%Feature%" equ "ParentalControl" echo.####正在开始集成 Windows 家长控制附加功能######################################
if "%Feature%" equ "PhotoViewer" echo.####正在开始集成 Windows 照片查看器附加功能####################################
if "%Feature%" equ "Search" echo.####正在开始集成 Windows Search 附加功能#######################################
if "%Feature%" equ "SpeechText" echo.####正在开始集成 Windows 语音和文本附加功能####################################
if "%Feature%" equ "TabletPC" echo.####正在开始集成 Windows Tablet PC 附加功能####################################
if "%Feature%" equ "All" echo.####正在开始集成 Windows Thin PC 附加功能######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####正在集成 Microsoft .NET Framework 3.5 附加功能#############################
if "%Feature%" equ "BackupRestore" echo.####正在集成 Windows 备份和恢复附加功能########################################
if "%Feature%" equ "BasicHelp" echo.####正在集成 Windows 基本帮助附加功能##########################################
if "%Feature%" equ "Defender" echo.####正在集成 Windows Defender 附加功能#########################################
if "%Feature%" equ "DVDMaker" echo.####正在集成 Windows DVD Maker 附加功能########################################
if "%Feature%" equ "FaxScan" echo.####正在集成 Windows 传真和扫描附加功能########################################
if "%Feature%" equ "ISOBurner" echo.####正在集成 Windows ISO 刻录机附加功能########################################
if "%Feature%" equ "MediaCenter" echo.####正在集成 Windows Media Center 附加功能#####################################
if "%Feature%" equ "PremiumCodecs" echo.####正在集成 Windows Media Player 高级编解码器功能#############################
if "%Feature%" equ "MobilityCenter" echo.####正在集成 Windows 移动中心附加功能##########################################
if "%Feature%" equ "ParentalControl" echo.####正在集成 Windows 家长控制附加功能##########################################
if "%Feature%" equ "PhotoViewer" echo.####正在集成 Windows 照片查看器附加功能########################################
if "%Feature%" equ "Search" echo.####正在集成 Windows Search 附加功能###########################################
if "%Feature%" equ "SpeechText" echo.####正在集成 Windows 语音和文本附加功能########################################
if "%Feature%" equ "TabletPC" echo.####正在集成 Windows Tablet PC 附加功能########################################
if "%Feature%" equ "All" echo.####正在集成 Windows Thin PC 附加功能##########################################
echo.---------------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageEdition%" equ "Embedded" (
			if "%Feature%" equ "NetFx35" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft IIS Windows 进程激活服务包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.0 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.0 Client Profile 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 Client Profile 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "BackupRestore" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-BackupRestore~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "BasicHelp" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-HelpEngine~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "Defender" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-AntiMalware~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "DVDMaker" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows DVD Maker 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows ISO 刻录机程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "FaxScan" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Fax-Scan~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "ISOBurner" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "MediaCenter" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MediaCenter~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "PremiumCodecs" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player DOLBY AC3 Audio Encoder Premium Codec 程序包
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-DOLBY-AC3-AudioEncoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 Decoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Decoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 Encoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Encoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 和 Dolby Decoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG3 Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG4 Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player WMV Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-WMV~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "MobilityCenter" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MobilePC~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "ParentalControl" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-ParentalControl~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			if "%Feature%" equ "PhotoViewer" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Photos-Viewer~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "Search" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 自然语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Search 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)
			
			if "%Feature%" equ "SpeechText" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 语音和文本美国英语语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 语音和文本包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)

			if "%Feature%" equ "TabletPC" call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Tablet~31bf3856ad364e35~x86~~6.1.7601.17514.cab"

			if "%Feature%" equ "All" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft IIS Windows 进程激活服务包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.0 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.0 Client Profile 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft .NET Framework 3.5 Client Profile 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 备份和恢复程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-BackupRestore~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 基本帮助程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-HelpEngine~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Defender 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-AntiMalware~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows DVD Maker 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 传真和扫描程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Fax-Scan~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows ISO 刻录机程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Center 功能……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MediaCenter~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player DOLBY AC3 Audio Encoder Premium Codec 程序包
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-DOLBY-AC3-AudioEncoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 Decoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Decoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 Encoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2-Encoder~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG2 和 Dolby Decoder Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG3 Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player MPEG4 Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Media Player WMV Premium Codec 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-WMV~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 移动中心功能……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MobilePC~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 家长控制功能……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-ParentalControl~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 照片查看器功能……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Photos-Viewer~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 自然语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Search 程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 语音和文本美国英语语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 语音和文本包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Tablet PC 支持功能……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Tablet~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)
		)

		if "%IsLogsEnabled%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			if "%Feature%" equ "NetFx35" echo.正在生成 Microsoft .NET Framework 3.5 附加功能集成日志……
			if "%Feature%" equ "BackupRestore" echo.正在生成 Windows 备份和恢复附加功能集成日志……
			if "%Feature%" equ "BasicHelp" echo.正在生成 Windows 基本帮助附加功能集成日志……
			if "%Feature%" equ "Defender" echo.正在生成 Windows Defender 附加功能集成日志……
			if "%Feature%" equ "DVDMaker" echo.正在生成 Windows DVD Maker 附加功能集成日志……
			if "%Feature%" equ "FaxScan" echo.正在生成 Windows 传真和扫描附加功能集成日志……
			if "%Feature%" equ "ISOBurner" echo.正在生成 Windows ISO 刻录机附加功能集成日志……
			if "%Feature%" equ "MediaCenter" echo.正在生成 Windows Media Center 附加功能集成日志……
			if "%Feature%" equ "PremiumCodecs" echo.正在生成 Windows Media Player 高级编解码器集成日志……
			if "%Feature%" equ "MobilityCenter" echo.正在生成 Windows 移动中心附加功能集成日志……
			if "%Feature%" equ "ParentalControl" echo.正在生成 Windows 家长控制附加功能集成日志……
			if "%Feature%" equ "PhotoViewer" echo.正在生成 Windows 照片查看器附加功能集成日志……
			if "%Feature%" equ "Search" echo.正在生成 Windows Search 附加功能集成日志……
			if "%Feature%" equ "SpeechText" echo.正在生成 Windows 语音和文本附加功能集成日志……
			if "%Feature%" equ "TabletPC" echo.正在生成 Windows Tablet PC 附加功能集成日志……
			if "%Feature%" equ "All" echo.正在生成 Thin PC 附加功能集成日志……
			echo.-------------------------------------------------------------------------------
			echo.正在写入 Thin PC 附加功能 ^<Logs\ThinPC.txt^> 日志文件。
			call :GetPackages "%InstallMount%\%%i", "ThinPC.txt"
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####集成 Microsoft .NET Framework 3.5 附加功能已完成###########################
if "%Feature%" equ "BackupRestore" echo.####集成 Windows 备份和恢复附加功能已完成######################################
if "%Feature%" equ "BasicHelp" echo.####集成 Windows 基本帮助附加功能已完成########################################
if "%Feature%" equ "Defender" echo.####集成 Windows Defender 附加功能已完成#######################################
if "%Feature%" equ "DVDMaker" echo.####集成 Windows DVD Maker 附加功能已完成######################################
if "%Feature%" equ "FaxScan" echo.####集成 Windows 传真和扫描附加功能已完成######################################
if "%Feature%" equ "ISOBurner" echo.####集成 Windows ISO 刻录机附加功能已完成######################################
if "%Feature%" equ "MediaCenter" echo.####集成 Windows Media Center 附加功能已完成##################################
if "%Feature%" equ "PremiumCodecs" echo.####集成 Windows Media Player 高级编解码器功能已完成###########################
if "%Feature%" equ "MobilityCenter" echo.####集成 Windows 移动中心附加功能已完成########################################
if "%Feature%" equ "ParentalControl" echo.####集成 Windows 家长控制附加功能已完成########################################
if "%Feature%" equ "PhotoViewer" echo.####集成 Windows 照片查看器附加功能已完成######################################
if "%Feature%" equ "Search" echo.####集成 Windows Search 附加功能已完成#########################################
if "%Feature%" equ "SpeechText" echo.####集成 Windows 语音和文本附加功能已完成######################################
if "%Feature%" equ "TabletPC" echo.####集成 Windows Tablet PC 附加功能已完成######################################
if "%Feature%" equ "All" echo.####集成 Windows Thin PC 附加功能已完成########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Feature=

endlocal

:: 返回到集成 Windows Thin PC 附加功能菜单
goto :IntThinPcPkgs
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft 诊断和恢复工具集（DaRT）7.0/8.1/10/11 模组
::-------------------------------------------------------------------------------------------
:IntDaRT

setlocal

set DartType=
set DebugTools=
set PackageLanguage=

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 7.0 工具集
if "%SelectedSourceOS%" equ "w81" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 8.1 工具集
if "%SelectedSourceOS%" equ "w10" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 10 工具集
if "%SelectedSourceOS%" equ "w11" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 11 工具集
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	echo.
	echo.
	echo.                              警         告
	echo.                              =============
	echo.
	echo. Microsoft DaRT 8.1/10/11 工具集包含允许管理员或技术工作人员远程运行 DaRT 工
	echo. 具以解决终端用户计算机上的问题的功能。此外，你可以将国际标准化组织 ^(ISO^) 
	echo. 映像保存到 USB 闪存驱动器中，或者将 ISO 映像放到网络上，以便将其内容作为恢复
	echo. 分区包含在计算机的硬盘上。这些功能提供了灵活性，但也可能产生在配置 DaRT 时应
	echo. 考虑到的潜在的安全风险。
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo. 若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 7.0 工具集
if "%SelectedSourceOS%" equ "w81" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 8.1 工具集
if "%SelectedSourceOS%" equ "w10" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 10 工具集
if "%SelectedSourceOS%" equ "w11" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 11 工具集
echo.===============================================================================
echo.
echo.  [1]  集成到 Windows 安装程序启动映像
echo.
if "%SelectedSourceOS%" neq "w7" (
	echo.  [2]  集成到 Windows 恢复映像
	echo.
)
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Embedded" (
	echo.  [2]  集成到 Windows 恢复映像
	echo.
)
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]  返回
echo.
echo.===============================================================================
echo.
choice /C:12X /N /M "请输入你的选项 ："
if errorlevel 3 goto :IntegrateMenu
if errorlevel 2 set "DartType=Recovery"
if errorlevel 1 set "DartType=Boot"

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 7.0 工具集
if "%SelectedSourceOS%" equ "w81" echo.                 MSMG 工具箱 - 集成 Microsoft DaRT 8.1 工具集
if "%SelectedSourceOS%" equ "w10" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 10 工具集
if "%SelectedSourceOS%" equ "w11" echo.                  MSMG 工具箱 - 集成 Microsoft DaRT 11 工具集
echo.===============================================================================
echo.

:: 检查源启动映像是否已选择
if "%DartType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Windows 安装程序启动映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 安装程序启动映像……
	goto :Stop
)

:: 检查源恢复映像是否已选择
if "%DartType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Windows 恢复映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 恢复映像……
	goto :Stop
)

:: 设置 Microsoft DaRT 工具集包文件夹
set "DaRT=%DaRT%\%SelectedSourceOS%"
set "DebugTools=DebugTools_%PackageVersion%.tpk"

:: 设置程序包语言
for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,el-GR,en-GB,en-US,et-EE,fi-FI,he-IL,hr-HR,hu-HU,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,ro-RO,sk-SK,sl-SI,sr-Latn-CS,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA) do (
	if "%ImageDefaultLanguage%" equ "%%i" set "PackageLanguage=en-US"
)

for /d %%l in (de-DE,es-ES,fr-FR,it-IT,ja-JP,ko-KR,pt-BR,ru-RU,zh-CN,zh-TW) do (
   if "%ImageDefaultLanguage%" equ "%%l" set "PackageLanguage=%%l"
)

if "%ImageDefaultLanguage%" equ "es-MX" set "PackageLanguage=es-ES"
if "%ImageDefaultLanguage%" equ "fr-CA" set "PackageLanguage=fr-FR"
if "%ImageDefaultLanguage%" equ "pt-PT" set "PackageLanguage=pt-BR"
if "%ImageDefaultLanguage%" equ "zh-HK" set "PackageLanguage=zh-TW"

:: 检查 Microsoft DaRT 7/8.1/10/11 工具集基础包文件是否存在
if not exist "%DaRT%\DaRT.tpk" (
	if "%SelectedSourceOS%" equ "w7" echo.Microsoft DaRT 7 工具集包文件“DaRT.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w81" echo.Microsoft DaRT 8.1 工具集包文件“DaRT.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 工具集包文件“DaRT.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 工具集包文件“DaRT.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\DaRT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft DaRT 7/8.1/10/11 工具语言包文件是否存在
if not exist "%DaRT%\DaRT_%PackageLanguage%.tpk" (
	if "%SelectedSourceOS%" equ "w7" echo.Microsoft DaRT 7 工具集包文件“DaRT_%PackageLanguage%.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w81" echo.Microsoft DaRT 8.1 工具集包文件“DaRT_%PackageLanguage%.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 工具集包文件“DaRT_%PackageLanguage%.tpk”没有找到……
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 工具集包文件“DaRT_%PackageLanguage%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\DaRT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft DaRT 10/11 调试工具包文件是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%DaRT%\%DebugTools%" (
	if "%SelectedSourceOS%" equ "w10" echo.Microsoft DaRT 10 工具集包文件夹缺少以下文件……
	if "%SelectedSourceOS%" equ "w11" echo.Microsoft DaRT 11 工具集包文件夹缺少以下文件……
	echo.
	echo."%DebugTools%"
	echo.
	echo.请复制上述文件到 ^<Packs\DaRT\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

if "%DartType%" equ "Boot" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.     MSMG 工具箱 - 集成 Microsoft DaRT 7 工具集到 Windows 安装程序启动映像
	if "%SelectedSourceOS%" equ "w81" echo.    MSMG 工具箱 - 集成 Microsoft DaRT 8.1 工具集到 Windows 安装程序启动映像
	if "%SelectedSourceOS%" equ "w10" echo.     MSMG 工具箱 - 集成 Microsoft DaRT 10 工具集到 Windows 安装程序启动映像
	if "%SelectedSourceOS%" equ "w11" echo.     MSMG 工具箱 - 集成 Microsoft DaRT 11 工具集到 Windows 安装程序启动映像
	echo.===============================================================================
	echo.

	:: 获取启动映像索引体系结构
	call :GetImageArchitecture "%BootWim%", 2 >nul

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####正在开始集成 Microsoft DaRT 7 工具集到 Windows 启动映像####################
	if "%SelectedSourceOS%" equ "w81" echo.####正在开始集成 Microsoft DaRT 8.1 工具集到 Windows 启动映像##################
	if "%SelectedSourceOS%" equ "w10" echo.####正在开始集成 Microsoft DaRT 10 工具集到 Windows 启动映像###################
	if "%SelectedSourceOS%" equ "w11" echo.####正在开始集成 Microsoft DaRT 11 工具集到 Windows 启动映像###################
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    映像文件名称             ：Boot.wim
	echo.    映像索引                 ：2
	echo.    映像体系结构             ：%ImageArchitecture%
	echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####正在集成 Microsoft DaRT 7 工具集到 Windows 启动映像########################
	if "%SelectedSourceOS%" equ "w81" echo.####正在集成 Microsoft DaRT 8.1 工具集到 Windows 启动映像######################
	if "%SelectedSourceOS%" equ "w10" echo.####正在集成 Microsoft DaRT 10 工具集到 Windows 启动映像#######################
	if "%SelectedSourceOS%" equ "w11" echo.####正在集成 Microsoft DaRT 11 工具集到 Windows 启动映像#######################
	echo.-------------------------------------------------------------------------------
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.正在集成 Microsoft DaRT 7 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w81" echo.正在集成 Microsoft DaRT 8.1 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 工具集基础数据包……
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT.tpk", %PackageIndex%, "%BootMount%\2"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%BootMount%\2\Windows\System32\fmapi.dll" (
		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" copy /y "%InstallMount%\%%i\Windows\System32\fmapi.dll" "%BootMount%\2\Windows\System32" >nul
		)
	)

	call :RemoveFile "%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.[LaunchApps]>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\wpeinit.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\netstart.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.%%systemdrive%%\setup.exe>>"%BootMount%\2\Windows\System32\winpeshl.ini"
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.正在集成 Microsoft DaRT 7 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w81" echo.正在集成 Microsoft DaRT 8.1 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 工具集 [%PackageLanguage%] 语言包……
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", %PackageIndex%, "%BootMount%\2"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 调试工具程序包……
		if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 调试工具程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DaRT%\%DebugTools%", %PackageIndex%, "%BootMount%\2"
	)

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####集成 Microsoft DaRT 7 工具集到 Windows 启动映像已完成######################
	if "%SelectedSourceOS%" equ "w81" echo.####集成 Microsoft DaRT 8.1 工具集到 Windows 启动映像已完成####################
	if "%SelectedSourceOS%" equ "w10" echo.####集成 Microsoft DaRT 10 工具集到 Windows 启动映像已完成#####################
	if "%SelectedSourceOS%" equ "w11" echo.####集成 Microsoft DaRT 11 工具集到 Windows 启动映像已完成#####################
	echo.-------------------------------------------------------------------------------
)

if "%DartType%" equ "Recovery" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.         MSMG 工具箱 - 集成 Microsoft DaRT 7 工具集到 Windows 恢复映像
	if "%SelectedSourceOS%" equ "w81" echo.        MSMG 工具箱 - 集成 Microsoft DaRT 8.1 工具集到 Windows 恢复映像
	if "%SelectedSourceOS%" equ "w10" echo.        MSMG 工具箱 - 集成 Microsoft DaRT 10 工具集到 Windows 恢复映像
	if "%SelectedSourceOS%" equ "w11" echo.        MSMG 工具箱 - 集成 Microsoft DaRT 11 工具集到 Windows 恢复映像
	echo.===============================================================================
	echo.
	:: 获取恢复映像索引体系结构
	call :GetImageArchitecture "%InstallMount%\!DefaultIndexNo!\%WinReWim%", 1 >nul
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####正在开始集成 Microsoft DaRT 7 工具集到 Windows 恢复映像####################
	if "%SelectedSourceOS%" equ "w81" echo.####正在开始集成 Microsoft DaRT 8.1 工具集到 Windows 恢复映像##################
	if "%SelectedSourceOS%" equ "w10" echo.####正在开始集成 Microsoft DaRT 10 工具集到 Windows 恢复映像###################
	if "%SelectedSourceOS%" equ "w11" echo.####正在开始集成 Microsoft DaRT 11 工具集到 Windows 恢复映像###################
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    映像文件名称             ：WinRE.wim
	echo.    映像索引                 ：1
	echo.    映像体系结构             ：%ImageArchitecture%
	echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####正在集成 Microsoft DaRT 7 工具集到 Windows 恢复映像########################
	if "%SelectedSourceOS%" equ "w81" echo.####正在集成 Microsoft DaRT 8.1 工具集到 Windows 恢复映像######################
	if "%SelectedSourceOS%" equ "w10" echo.####正在集成 Microsoft DaRT 10 工具集到 Windows 恢复映像#######################
	if "%SelectedSourceOS%" equ "w11" echo.####正在集成 Microsoft DaRT 11 工具集到 Windows 恢复映像#######################
	echo.-------------------------------------------------------------------------------
	echo.
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.正在集成 Microsoft DaRT 7 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w81" echo.正在集成 Microsoft DaRT 8.1 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 工具集基础数据包……
	if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 工具集基础数据包……
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT.tpk", %PackageIndex%, "%WinReMount%"
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" copy /y "%InstallMount%\!DefaultIndexNo!\Windows\System32\fmapi.dll" "%WinReMount%\Windows\System32" >nul

	call :RemoveFile "%WinReMount%\Windows\System32\winpeshl.ini"
	echo.[LaunchApps]>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\wpeinit.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%windir%%\system32\netstart.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"
	echo.%%systemdrive%%\sources\recovery\recenv.exe>>"%WinReMount%\Windows\System32\winpeshl.ini"

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.正在集成 Microsoft DaRT 7 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w81" echo.正在集成 Microsoft DaRT 8.1 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 工具集 [%PackageLanguage%] 语言包……
	if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 工具集 [%PackageLanguage%] 语言包……
	echo.-------------------------------------------------------------------------------
	call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", %PackageIndex%, "%WinReMount%"

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		echo.-------------------------------------------------------------------------------
		if "%SelectedSourceOS%" equ "w10" echo.正在集成 Microsoft DaRT 10 调试工具程序包……
		if "%SelectedSourceOS%" equ "w11" echo.正在集成 Microsoft DaRT 11 调试工具程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DaRT%\%DebugTools%", %PackageIndex%, "%WinReMount%"
	)

	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w7" echo.####集成 Microsoft DaRT 7 工具集到 Windows 恢复映像已完成######################
	if "%SelectedSourceOS%" equ "w81" echo.####集成 Microsoft DaRT 8.1 工具集到 Windows 恢复映像已完成####################
	if "%SelectedSourceOS%" equ "w10" echo.####集成 Microsoft DaRT 10 工具集到 Windows 恢复映像已完成#####################
	if "%SelectedSourceOS%" equ "w11" echo.####集成 Microsoft DaRT 11 工具集到 Windows 恢复映像已完成#####################
	echo.-------------------------------------------------------------------------------
)

:Stop
echo.
echo.===============================================================================
echo.
pause

set DaRT=
set DartType=
set DebugTools=
set PackageLanguage=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft DirectX 9.0c 模组
::-------------------------------------------------------------------------------------------
:IntDirectX9c

setlocal

cls
echo.===============================================================================
echo.                  MSMG 工具箱 - 集成 Microsoft DirectX 9.0c
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Microsoft DirectX 9.0c 包文件是否存在
if not exist "%DirectX9c%\DirectX9c.tpk" (
	echo.Microsoft DirectX 9.0c 包文件“DirectX9c.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\DirectX9c^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft DirectX 9.0c 包文件是否存在
if not exist "%DirectX9c%\DirectX9c_%ImageArchitecture%.reg" (
	echo.Microsoft DirectX 9.0c 包文件“DirectX9c_%ImageArchitecture%.reg”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\DirectX9c^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft DirectX 9.0c########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft DirectX 9.0c############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft DirectX 9.0c 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%DirectX9c%\DirectX9c.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft DirectX 9.0c 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%DirectX9c%\DirectX9c_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft DirectX 9.0c 已完成#########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft 游戏模组
::-------------------------------------------------------------------------------------------
:IntGames

setlocal

set Game=
set PackageLanguage=

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 集成 Microsoft 游戏
echo.===============================================================================

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查所选择的源操作系统是否是 Windows 7 客户端版本
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 集成 Microsoft 游戏菜单
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  空当接龙
	echo.  [D]  红心大战
	echo.  [E]  Hold 'Em
	echo.  [F]  墨球
	echo.  [G]  Mahjong Titans
	echo.  [H]  扫雷
	echo.  [I]  桌上弹球
	echo.  [J]  Purble Place
	echo.  [K]  纸牌
	echo.  [L]  蜘蛛纸牌
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  所有游戏
	echo.
	echo.  [X]  返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "请输入你的选项 ："
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: 检查所选择的源操作系统是否是 Windows 7 客户端版本
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "HomeBasic" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 集成 Microsoft 游戏菜单
	echo.===============================================================================
	echo.
	echo.  [1]  Carioca Rummy
	echo.  [2]  Chess Titans
	echo.  [3]  Hold 'Em
	echo.  [4]  墨球
	echo.  [5]  Mahjong Titans
	echo.  [6]  桌上弹球
	echo.  [7]  Sudoku
	echo.  [8]  Tinker
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]  所有游戏
	echo.  [X]  返回
    echo.
	echo.===============================================================================
	echo.
	choice /C:12345678AX /N /M "请输入你的选项 ："
	if errorlevel 10 goto :IntFeaturesMenu
	if errorlevel 9  set "Game=AllGames"
	if errorlevel 8  set "Game=Tinker"
	if errorlevel 7  set "Game=Sudoku"
	if errorlevel 6  set "Game=Pinball"
	if errorlevel 5  set "Game=MahjongTitans"
	if errorlevel 4  set "Game=Inkball"
	if errorlevel 3  set "Game=HoldEm"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: 检查所选择的源操作系统是否不是 a Windows 7 客户端版本
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 集成 Microsoft 游戏菜单
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  空当接龙
	echo.  [D]  红心大战
	echo.  [E]  Hold 'Em
	echo.  [F]  墨球
	echo.  [G]  Mahjong Titans
	echo.  [H]  扫雷
	echo.  [I]  桌上弹球
	echo.  [J]  Purble Place
	echo.  [K]  纸牌
	echo.  [L]  蜘蛛纸牌
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  所有游戏
	echo.
	echo.  [X]  返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "请输入你的选项 ："
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)

:: 检查所选择的源操作系统是否不是 Windows 7
if "%SelectedSourceOS%" neq "w7" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 集成 Microsoft 游戏菜单
	echo.===============================================================================
	echo.  [A]  Carioca Rummy
	echo.  [B]  Chess Titans
	echo.  [C]  空当接龙
	echo.  [D]  红心大战
	echo.  [E]  Hold 'Em
	echo.  [F]  墨球
	echo.  [G]  Mahjong Titans
	echo.  [H]  扫雷
	echo.  [I]  桌上弹球
	echo.  [J]  Purble Place
	echo.  [K]  纸牌
	echo.  [L]  蜘蛛纸牌
	echo.  [M]  Sudoku
	echo.  [N]  Tinker
	echo.
	echo.  [1]  所有游戏
	echo.
	echo.  [X]  返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "请输入你的选项 ："
	if errorlevel 16 goto :IntFeaturesMenu
	if errorlevel 15 set "Game=AllGames"
	if errorlevel 14 set "Game=Tinker"
	if errorlevel 13 set "Game=Sudoku"
	if errorlevel 12 set "Game=SpiderSolitaire"
	if errorlevel 11 set "Game=Solitaire"
	if errorlevel 10 set "Game=PurblePlace"
	if errorlevel 9  set "Game=Pinball"
	if errorlevel 8  set "Game=Minesweeper"
	if errorlevel 7  set "Game=MahjongTitans"
	if errorlevel 6  set "Game=Inkball"
	if errorlevel 5  set "Game=HoldEm"
	if errorlevel 4  set "Game=Hearts"
	if errorlevel 3  set "Game=FreeCell"
	if errorlevel 2  set "Game=ChessTitans"
	if errorlevel 1  set "Game=CariocaRummy"
)
cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 集成 Microsoft 游戏
echo.===============================================================================
echo.

:: 检查 Microsoft 游戏包文件是否存在
if not exist "%Games%\Games_%ImageArchitecture%.tpk" (
	echo.Microsoft 游戏包文件“Games_%ImageArchitecture%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Games^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft 游戏包文件是否存在
if not exist "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft 游戏包文件“Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Games^> 文件夹……
	goto :Stop
)

:: 检查 Microsoft 游戏包文件是否存在
for %%j in (ChessTitans,FreeCell,Hearts,Inkball,MahjongTitans,Minesweeper,Pinball,PurblePlace,Solitaire,SpiderSolitaire) do (
	if "%Game%" equ "%%j" if not exist "%Games%\%Game%.reg" (
		echo.Microsoft 游戏包文件“%Game%.reg”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\Games^> 文件夹……
		goto :Stop
	)
)

:: 检查 Microsoft 游戏包文件是否存在
for %%j in (AllGames,CariocaRummy,HoldEm,Sudoku,Tinker) do (
	if "%Game%" equ "%%j" if not exist "%Games%\%Game%_%ImageArchitecture%.reg" (
		echo.Microsoft 游戏包文件“%Game%_%ImageArchitecture%.reg”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\Games^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft 游戏################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft 游戏####################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft 游戏基础数据包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 1, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft 游戏基础 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 1, "%InstallMount%\%%i"

		if "%Game%" equ "CariocaRummy" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Carioca Rummy 游戏程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
		)

		if "%Game%" equ "ChessTitans" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
		)

		if "%Game%" equ "FreeCell" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Hearts" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
		)

		if "%Game%" equ "HoldEm" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Inkball" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
		)

		if "%Game%" equ "MahjongTitans" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Minesweeper" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Pinball" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
		)

		if "%Game%" equ "PurblePlace" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Solitaire" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
		)

		if "%Game%" equ "SpiderSolitaire" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Sudoku" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
		)

		if "%Game%" equ "Tinker" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Carioca Rummy 游戏程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "StarterN" if "%ImageEdition%" neq "HomeBasic" if "%ImageEdition%" neq "HomeBasicN" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Carioca Rummy 游戏程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Carioca Rummy 游戏程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		if "%Game%" equ "AllGames" if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Carioca Rummy 游戏程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Chess Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft FreeCell 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 红心大战游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Hold 'Em 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 墨球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk",8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Mahjong Titans 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 扫雷游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 桌上弹球游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Purble Place 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 10, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 11, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft 蜘蛛纸牌游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 12, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 14, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Sudoku 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 13, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏基础数据包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 15, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Tinker 游戏 [%ImageDefaultLanguage%] 语言包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 14, "%InstallMount%\%%i"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft 游戏注册表项……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"

		echo.正在将注册表设置合并到映像注册表……
		if "%Game%" equ "CariocaRummy" call :ImportRegistry2Image "%Games%\CariocaRummy_%ImageArchitecture%.reg"
		if "%Game%" equ "ChessTitans" call :ImportRegistry2Image "%Games%\ChessTitans.reg"
		if "%Game%" equ "FreeCell" call :ImportRegistry2Image "%Games%\FreeCell.reg"
		if "%Game%" equ "Hearts" call :ImportRegistry2Image "%Games%\Hearts.reg"
		if "%Game%" equ "HoldEm" call :ImportRegistry2Image "%Games%\HoldEm_%ImageArchitecture%.reg"
		if "%Game%" equ "Inkball" call :ImportRegistry2Image "%Games%\Inkball.reg"
		if "%Game%" equ "MahjongTitans" call :ImportRegistry2Image "%Games%\MahjongTitans.reg"
		if "%Game%" equ "Minesweeper" call :ImportRegistry2Image "%Games%\Minesweeper.reg"
		if "%Game%" equ "Pinball" call :ImportRegistry2Image "%Games%\Pinball.reg"
		if "%Game%" equ "PurblePlace" call :ImportRegistry2Image "%Games%\PurblePlace.reg"
		if "%Game%" equ "Solitaire" call :ImportRegistry2Image "%Games%\Solitaire.reg"
		if "%Game%" equ "SpiderSolitaire" call :ImportRegistry2Image "%Games%\SpiderSolitaire.reg"
		if "%Game%" equ "Sudoku" call :ImportRegistry2Image "%Games%\Sudoku_%ImageArchitecture%.reg"
		if "%Game%" equ "Tinker" call :ImportRegistry2Image "%Games%\Tinker_%ImageArchitecture%.reg"
		if "%Game%" equ "AllGames" (

			if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" (
				if "%ImageEdition%" neq "HomePremium" if "%ImageEdition%" neq "HomePremiumN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "Ultimate" if "%ImageEdition%" neq "UltimateN" (
					call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
				)
				if "%ImageEdition%" neq "Starter" if "%ImageEdition%" neq "StarterN" if "%ImageEdition%" neq "HomeBasic" if "%ImageEdition%" neq "HomeBasicN" (
					call :ImportRegistry2Image "%Games%\CariocaRummy_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\HoldEm_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\Inkball.reg"
					call :ImportRegistry2Image "%Games%\Sudoku_%ImageArchitecture%.reg"
					call :ImportRegistry2Image "%Games%\Tinker_%ImageArchitecture%.reg"
        		)
				if "%ImageInstallationType%" neq "Client" call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
			)

			if "%SelectedSourceOS%" neq "w7" call :ImportRegistry2Image "%Games%\AllGames_%ImageArchitecture%.reg"
		)

		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft 游戏已完成##################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Game=

endlocal

:: 返回到集成 Microsoft 游戏菜单
goto :IntGames
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 边栏模组
::-------------------------------------------------------------------------------------------
:IntSidebar

setlocal

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 集成 Windows 边栏
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 检查 Windows 边栏包文件是否存在
if not exist "%Sidebar%\Sidebar.tpk" (
	echo.Windows 边栏包文件“Sidebar.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Sidebar^> 文件夹……
	goto :Stop
)

:: 检查 Windows 边栏包文件是否存在
if not exist "%Sidebar%\Sidebar_%ImageDefaultLanguage%.tpk" (
	echo.Windows 边栏包文件“Sidebar_%ImageDefaultLanguage%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Sidebar^> 文件夹……
	goto :Stop
)

:: 检查 Windows 边栏包文件是否存在
if not exist "%Sidebar%\Sidebar_%ImageArchitecture%.reg" (
	echo.Windows 边栏包文件“Sidebar_%ImageArchitecture%.reg”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Sidebar^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 边栏##################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 边栏######################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 边栏基础数据包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Sidebar%\Sidebar.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 边栏 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Sidebar%\Sidebar_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Windows 边栏注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在取得映像注册表所有权……
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%Sidebar%\Sidebar_%ImageArchitecture%.reg"
		call :ImportRegistry2Image "%Sidebar%\3rdPartyGadgets_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		echo.

		:: 如果源版本不是 Media Center 版则删除 Microsoft 边栏 Media Center 文件
		if /i not exist "%InstallMount%\%%i\Windows\ehome" call :RemoveFolder "%InstallMount%\%%i\Program Files\Windows Sidebar\Gadgets\MediaCenter.Gadget"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows 边栏已完成####################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Visual C++ Runtime 模组
::-------------------------------------------------------------------------------------------
:IntVCRuntime

setlocal

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Microsoft Visual C++ Runtime
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Microsoft Visual C++ Runtime 包文件夹路径
set "VCRuntime=%VCRuntime%\%SelectedSourceOS%"

:: 检查 Microsoft Visual C++ Runtime 包文件是否存在
if not exist "%VCRuntime%\VC.tpk" (
	echo.Microsoft Visual C++ Runtime 包文件“VC.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\VCRuntime\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

if "%SelectedSourceOS%" equ "w7" if not exist "%VCRuntime%\Windows6.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Microsoft Visual C++ Runtime 包文件“Windows6.1-KB3118401-%ImageArchitecture%.cab”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\VCRuntime\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

if "%SelectedSourceOS%" equ "w81" if not exist "%VCRuntime%\Windows8.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Microsoft Visual C++ Runtime 包文件“Windows8.1-KB3118401-%ImageArchitecture%.cab”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\VCRuntime\%SelectedSourceOS%^> 文件夹……
	goto :Stop
)

for %%i in (Certificates, VC_2005, VC_2008, VC_2010, VC_2012, VC_2013, VC_2022, VC_Legacy) do (
	if not exist "%VCRuntime%\%%i_%ImageArchitecture%.reg" (
		echo.Microsoft Visual C++ Runtime 包文件“%%i_%ImageArchitecture%.reg”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\VCRuntime\%SelectedSourceOS%^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Visual C++ Runtime##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Visual C++ Runtime######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		:: 获取映像索引信息
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Microsoft Visual C++ 先决条件更新程序包……
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%InstallMount%\%%i", "%VCRuntime%\Windows6.1-KB3118401-%ImageArchitecture%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%InstallMount%\%%i", "%VCRuntime%\Windows8.1-KB3118401-%ImageArchitecture%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Visual C++ Runtime 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%VCRuntime%\VC.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft Visual C++ Runtime 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……

		for %%i in (Certificates, VC_2005, VC_2008, VC_2010, VC_2012, VC_2013, VC_2022, VC_Legacy) do (
			call :ImportRegistry2Image "%VCRuntime%\%%i_%ImageArchitecture%.reg"
		)

		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Visual C++ Runtime 已完成###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set VCRuntime=

endlocal

:: 返回到集成功能菜单
goto :IntFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 更新菜单模组
::-------------------------------------------------------------------------------------------
:IntUpdatesMenu

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                      MSMG 工具箱 - 集成 Windows 更新
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                              警         告
	echo.                              =============
	echo.
	echo.  在集成语言包或任何 Windows 功能之前，请不要集成任何更新。如果在集成任何
	echo.  更新、语言/功能之前集成了包含语言/功能相关资源的任何更新 ^(包括修补常规
	echo.  分发版本 [GDR]、零日修补程序 [ZDP] 或服务包 [SP] ^) ，将不会应用在更新中
	echo.  包含的特定更改，你必须重新集成更新。请始终在安装更新之前集成语言包/ 
	echo.  Windows 功能。
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows 更新菜单
echo.===============================================================================
echo.
echo.  [1]   集成 Windows 更新
echo.
echo.  [2]   集成 WHD 更新包
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.

choice /C:12X /N /M "请输入你的选项 ："
if errorlevel 3 goto :IntegrateMenu
if errorlevel 2 goto :IntWHDUpdatesMenu
if errorlevel 1 call :IntUpdates WUpdates

:IntWHDUpdatesMenu
cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 WHD 更新包菜单
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   集成 WHD 更新包 ^(含 Service Pack 2^)
	echo.
	echo.  [2]   集成 WHD 更新包 ^(不含 Service Pack 2^)
	echo.
	echo.  [3]   集成 Windows 安装程序媒介更新
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w81" (
	echo.  [1]   集成 WHD 基线更新
	echo.
	echo.  [2]   集成 WHD 常规更新
	echo.
	echo.  [3]   集成 WHD 热修复更新
	echo.
	echo.  [4]   集成 WHD 安全更新
	echo.
	echo.  [5]   集成 WHD 附加更新
	echo.
	echo.  [6]   集成 Windows 安装程序媒介更新
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	echo.  [1]   集成 WHD 常规更新
	echo.
	echo.  [2]   集成 Windows 安装程序媒介更新
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" (
	choice /C:123X /N /M "请输入你的选项 ："
	if errorlevel 4 goto :IntegrateMenu
	if errorlevel 3 goto :IntWindowsSetupMediaUpdates
	if errorlevel 2 (
		set "IsW7SP1CRUSelected=No"
		goto :IntW7WHDUpdatesMenu
	)
	if errorlevel 1 (
		set "IsW7SP1CRUSelected=Yes"
		goto :IntW7WHDUpdatesMenu
	)
)

if "%SelectedSourceOS%" equ "w81" (
	choice /C:123456X /N /M "请输入你的选项 ："
	if errorlevel 7 goto :IntegrateMenu
	if errorlevel 6 goto :IntWindowsSetupMediaUpdates
	if errorlevel 5 goto :IntWHDAdditionalMenu
	if errorlevel 4 call :IntUpdates Security
	if errorlevel 3 call :IntUpdates Hotfix
	if errorlevel 2 call :IntUpdates General
	if errorlevel 1 goto :IntWHDBaselineMenu
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :IntegrateMenu
	if errorlevel 2 goto :IntWindowsSetupMediaUpdates
	if errorlevel 1 goto :IntWHDBaselineMenu
)

:IntW7WHDUpdatesMenu
if "%IsDialogsEnabled%" equ "Yes" if "%IsW7SP1CRUSelected%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.               MSMG 工具箱 - 集成 WHD 更新 ^(含 Service Pack 2^)
	echo.===============================================================================
	echo.      ## 适用于 Windows 7 SP1 的便捷汇总更新，又被称为 Service Pack 2 ##
	echo.
	echo.KB3125574 是一个全面的汇总更新，包含几乎所有在 Windows 7 SP1 发布之后所发布
	echo.的修复程序，时间截止到 2016 年 4 月。
	echo.
	echo.如果你打算集成以下所列的任何功能包，请将它们 * 优先 * ^(在 KB3125574 之前^)
	echo.集成，以便汇总更新可以在以后集成其更新的组件：
	echo.
	echo.DCA2.0、AD LDS、VirtualPC、WorkFolders、在 WHD 附加中找到的 Server Essentials 
	echo.连接器额外更新部分。
	echo.
	echo.此更新旨在于简化 Windows 7 的更新过程，但它完全是可选的，请注意，出于尽职调查
	echo.的目的，它确实包含一些遥测更新组件 ^(3068708、3075249^)。
	echo.因此，如果你不想使用遥测更新，则应选择集成 WHD 更新菜单中的“集成 WHD 更新 ^(
	echo.不含 Service Pack 2^) ”选项。
	echo.
	echo.你还可以在阻止这些遥测效果的同时集成汇总。
	echo.
	echo.
	echo.请参考此主题以获取详细信息：http://forums.mydigitallife.info/threads/68131
	echo.===============================================================================
	pause
)
cls
echo.===============================================================================
echo.                       MSMG 工具箱 - 集成 WHD 更新菜单
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   集成 WHD 附加更新
	echo.
	echo.  [2]   集成 WHD 额外更新
	echo.
	echo.  [3]   集成 WHD 常规更新
	echo.
	echo.  [4]   集成 WHD 热修复更新
	echo.
	echo.  [5]   集成 WHD 安全更新
	echo.
	echo.  [6]   集成 WHD 延长安全更新
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" (
	choice /C:123456X /N /M "请输入你的选项 ："
	if errorlevel 7 goto :IntegrateMenu
	if errorlevel 6 call :IntUpdates "ESU"
	if errorlevel 5 call :IntUpdates "Security"
	if errorlevel 4 call :IntUpdates "Hotfix"
	if errorlevel 3 call :IntUpdates "General"
	if errorlevel 2 goto :IntWHDExtraMenu
	if errorlevel 1 goto :IntWHDAdditionalMenu
)

:IntWHDBaselineMenu
cls

echo.===============================================================================
if "%SelectedSourceOS%" equ "w81" echo.                     MSMG 工具箱 - 集成 WHD 基线更新菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.                     MSMG 工具箱 - 集成 WHD 常规更新菜单
echo.===============================================================================
echo.
echo.  [1]   集成到 Windows 安装程序启动映像
echo.
echo.  [2]   集成到 Windows 安装程序安装映像
echo.
echo.  [3]   集成到 Windows 安装程序安装和恢复映像
echo.
echo.  [4]   集成到 Windows 安装程序启动、安装和恢复映像
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:1234X /N /M "请输入你的选项 ："
if errorlevel 5 goto :IntUpdatesMenu
if errorlevel 4 call :IntWHDBaseLine BootInstallRecovery
if errorlevel 3 call :IntWHDBaseLine InstallRecovery
if errorlevel 2 call :IntWHDBaseLine Install
if errorlevel 1 call :IntWHDBaseLine Boot

:IntWHDAdditionalMenu
cls

echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 WHD 附加更新菜单
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   集成 Windows 激活技术 ^(WAT^)
	echo.
	echo.  [2]   集成 Windows 10 升级先决条件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

if "%SelectedSourceOS%" equ "w81" (
	echo.  [1]   集成 Microsoft .NET Framework 3.5 更新
	echo.
	echo.  [2]   集成 Windows 10 升级先决条件
	echo.
	echo.  [3]   集成 Windows PE 更新
	echo.
	echo.  [4]   集成 Windows Update Satisfy Updates
	echo.
	echo.
	echo.
	echo.
)

echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :IntW7WHDUpdatesMenu
	if errorlevel 2 call :IntUpdates "Windows10"
	if errorlevel 1 call :IntUpdates "WAT"
)

if "%SelectedSourceOS%" equ "w81" (
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :IntWHDUpdatesMenu
	if errorlevel 4 call :IntUpdates "WUSatisfy"
	if errorlevel 3 call :IntUpdates "WinPE"
	if errorlevel 2 call :IntUpdates "Windows10"
	if errorlevel 1 call :IntUpdates "NET35"
)

:IntWHDExtraMenu
cls

echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 WHD 额外更新菜单
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
	echo.  [1]   Active Directory 轻型目录服务 ^(ADLDS^)
	echo.
	echo.  [2]   文件管理 API
	echo.
	echo.  [3]   Microsoft Virtual PC
	echo.
	echo.  [4]   Windows 功能更新
	echo.
	echo.  [5]   适用于域环境的同步代理 ^(工作文件夹^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
	echo.
	echo.  [1]   Active Directory 轻型目录服务 ^(ADLDS^)
	echo.
	echo.  [2]   文件管理 API
	echo.
	echo.  [3]   Microsoft Virtual PC
	echo.
	echo.  [4]   适用于域环境的同步代理 ^(工作文件夹^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
	choice /C:12345X /N /M "请输入你的选项 ："
	if errorlevel 6 goto :IntW7WHDUpdatesMenu
	if errorlevel 5 call :IntUpdates "WorkFolders"
	if errorlevel 4 call :IntUpdates "Features"
	if errorlevel 3 call :IntUpdates "VirtualPC"
	if errorlevel 2 call :IntUpdates "FMApi"
	if errorlevel 1 call :IntUpdates "ADLDS"
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
	choice /C:1234X /N /M "请输入你的选项 ："
	if errorlevel 5 goto :IntW7WHDUpdatesMenu
	if errorlevel 4 call :IntUpdates "WorkFolders"
	if errorlevel 3 call :IntUpdates "VirtualPC"
	if errorlevel 2 call :IntUpdates "FMApi"
	if errorlevel 1 call :IntUpdates "ADLDS"
)

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 WHD 基线/常规更新到 Windows 安装程序启动、安装和恢复映像模组
::-------------------------------------------------------------------------------------------
:IntWHDBaseline

setlocal

:: 设置 WHD 更新类型
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "Boot" (
    if "%SelectedSourceOS%" equ "w81" echo.          MSMG 工具箱 - 集成 WHD 基线更新到 Windows 安装程序启动映像
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.          MSMG 工具箱 - 集成 WHD 常规更新到 Windows 安装程序启动映像
)

if "%UpdateType%" equ "Install" (
    if "%SelectedSourceOS%" equ "w81" echo.          MSMG 工具箱 - 集成 WHD 基线更新到 Windows 安装程序安装映像
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.          MSMG 工具箱 - 集成 WHD 常规更新到 Windows 安装程序安装映像
)

if "%UpdateType%" equ "InstallRecovery" (
    if "%SelectedSourceOS%" equ "w81" echo.                       MSMG 工具箱 - 集成 WHD 基线更新
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.                       MSMG 工具箱 - 集成 WHD 常规更新
    echo.                      到 Windows 安装程序安装和恢复映像
)

if "%UpdateType%" equ "BootInstallRecovery" (
    if "%SelectedSourceOS%" equ "w81" echo.                       MSMG 工具箱 - 集成 WHD 基线更新
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.                       MSMG 工具箱 - 集成 WHD 常规更新
    echo.                   到 Windows 安装程序启动、安装和恢复映像
)
echo.===============================================================================
echo.

if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" if "%IsBootImageSelected%" equ "No" (
	echo.Windows 安装程序启动映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 安装程序启动映像……
	goto :Stop
)

if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" if "%IsRecoveryImageSelected%" equ "No" (
    echo.Windows 恢复映像尚未选择……
    echo.
    echo.请在选择源文件时选择 Windows 恢复映像……
    goto :Stop
)

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置程序包的体系结构
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: 设置 WHD 基线更新文件夹路径
if "%SelectedSourceOS%" equ "w81" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\Baseline"
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\%PackageVersion%"

:: 检查 WHD 基线更新文件夹是否是空的
if "%SelectedSourceOS%" equ "w81" (
	:: Windows 8.1 RTM（内部版本 ：6.3.9600.16384）
	if %ImageServicePackBuild% equ 16384 if not exist "%Updates%\RTM\*.msu" if not exist "%Updates%\RTM\*.cab" (
		echo.WHD 基线更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline\RTM^> 是空的……
		echo.
		echo.请复制 WHD 基线更新到相应文件夹……
		goto :Stop
	)

	:: Windows 8.1 包括 Post-RTM 在内的所有内部版本
	if "%ImageServicePackBuild%" neq "16384" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
       echo.WHD 基线更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline^> 是空的……
       echo.
       echo.请复制 WHD 基线更新到相应文件夹……
       goto :Stop
	)
)

:: Windows 10
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
	echo.WHD 常规更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\%PackageVersion%^> 是空的……
	echo.
	echo.请复制 WHD 常规更新到相应文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.##########################正在开始集成 WHD 基线更新############################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.##########################正在开始集成 WHD 常规更新############################
if "%UpdateType%" equ "Boot" echo.#########################到 Windows 安装程序启动映像###########################
if "%UpdateType%" equ "Install" echo.#########################到 Windows 安装程序安装映像###########################
if "%UpdateType%" equ "InstallRecovery" echo.####################到 Windows 安装程序安装和恢复映像##########################
if "%UpdateType%" equ "BootInstallRecovery" echo.#################到 Windows 安装程序启动、安装和恢复映像#######################
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" equ "Boot" (
	echo.    映像文件名称             ：Boot.wim
	echo.    映像索引                 ：1、2
)

if "%UpdateType%" equ "Install" (
	echo.    映像文件名称             ：Install.wim	
	echo.    映像索引                 ：%ImageIndexNo%
)

if "%UpdateType%" equ "InstallRecovery" (
	echo.    映像文件名称             ：Install.wim        ^|  WinRE.wim
	echo.    映像索引                 ：%ImageIndexNo%                  ^|      1
)

if "%UpdateType%" equ "BootInstallRecovery" (
	echo.    映像文件名称             ：Boot.wim         ^|  Install.wim   ^|  WinRE.wim
	echo.    映像索引                 ：1、2             ^|      %ImageIndexNo%         ^|      1
)

echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.####正在处理 WHD 基线更新包####################################################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####正在处理 WHD 常规更新包####################################################
echo.-------------------------------------------------------------------------------
echo.
:: 创建 WHD 基线更新临时文件夹
if "%SelectedSourceOS%" equ "w81" echo.正在创建 WHD 基线更新临时文件夹……
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.正在创建 WHD 常规更新临时文件夹……
call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"
echo.

:: 从 .MSU 包文件解压 .CAB 文件到 CAB 临时文件夹
echo.正在将 .CAB 程序包文件解压到临时文件夹……

:: Windows 8.1 RTM（内部版本 ：6.3.9600.16384）
if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update（IR3 内部版本 ：6.3.9600.17031）
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh（IR4 内部版本 ：6.3.9600.17056）
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh（IR5 内部版本 ：6.3.9600.17415）
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5001403-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 10
if "%SelectedSourceOS%" equ "w10" (
	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul

		if "%ImageBuild%" geq "19041" if exist "%Temp%\Updates\*.cab" (
			call :RemoveFolder "%Temp%\Updates\Temp"
			call :CreateFolder "%Temp%\Updates\Temp"

   			for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
				expand -R "%Temp%\Updates\%%i" -F:Win*.cab "%Temp%\Updates\Temp" >nul
				expand -R "%Temp%\Updates\%%i" -F:SSU*.cab "%Temp%\Updates\Temp" >nul
				if exist "%Temp%\Updates\Temp\*.cab" move /y "%Temp%\Updates\Temp\*.cab" "%Temp%\Updates" >nul
			)

			call :RemoveFolder "%Temp%\Updates\Temp"
		)

    	for /f %%i in ('"dir /b %Temp%\Updates\*.cab" 2^>nul') do (
        	set Update=%%i
        	set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Temp%\Updates\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)

		call :RemoveFile "%Temp%\Updates\*.cab" >nul
	)

	if exist "%Updates%\*.cab" (
    	for /f %%i in ('"dir /b %Updates%\*.cab" 2^>nul') do (
        	set Update=%%i
        	set Update=!Update:~0,-4!
			call :CreateFolder "%Temp%\Updates\!Update!"
			expand -R "%Updates%\%%i" -F:* "%Temp%\Updates\!Update!" >nul
			if exist "%Temp%\Updates\!Update!\Cab_*.cab" expand -R "%Temp%\Updates\!Update!\Cab_*.cab" -F:* "%Temp%\Updates\!Update!" >nul
			call :RemoveFile "%Temp%\Updates\!Update!\Cab_*.cab"
		)
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		%Zip% x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: 重命名 Windows 更新文件夹名称匹配它们各自的更新类型
	cd /d "%Temp%\Updates\"

	for /f %%i in ('"dir /b *.*" 2^>nul') do (
    	if exist "%%i\update.mum" (
        	findstr /c:"Package_for_RollupFix" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "Cumulative" >nul
    	)

    	if exist "%%i\update.mum" (
        	findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
    	)

    	if exist "%%i\update.mum" (
        	findstr /c:"Update for Removal of Adobe Flash Player" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "RemoveFlashPlayer" >nul
    	)

    	if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
    	if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
    	if exist "%%i\setuphost.exe" ren "%%i" "DVDMedia" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" ren "%%i" "Enablement" >nul
		if not exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" ren "%%i" "EdgeChromium" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" ren "%%i" "Enablement" >nul
    	if exist "%%i\%PackageArchitecture%_adobe-flash-for-*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" ren "%%i" "FlashPlayer" >nul
    	if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.*.mum" ren "%%i" "NET35" >nul
    	if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.*.mum" ren "%%i" "NET35LP" >nul
    	if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp_31bf3856ad364e35_*.manifest" ren "%%i" "NET48" >nul
    	if exist "%%i\%PackageArchitecture%_netfx4clientcorecomp.resources_*%ImageDefaultLanguage%*.manifest" ren "%%i" "NET48LP" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-s..boot-firmwareupdate_*.manifest" ren "%%i" "SecureBoot" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-servicingstack_*.manifest" ren "%%i" "ServicingStack" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsExperienceFeature" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-sysreset_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

:: Windows 11
if "%SelectedSourceOS%" equ "w11" (
	cd /d "%Temp%\Updates\"
	copy %PSFExtractor% "%Temp%\Updates" >nul

	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	)

	if exist "%Updates%\*.cab" (
		set CU=
		for /f %%i in ('"dir /b %Updates%\*.psf" 2^>nul') do (
			set CU=%%i
			set CU=!CU:~0,-4!
			%XCopy% "%Updates%\!CU!.*" "%Temp%\Updates" >nul
			PSFExtractor.exe !CU!.cab >nul
			ren !CU! "Cumulative" >nul
			call :RemoveFile "%Temp%\Updates\Cumulative\express.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\!CU!.cab"
			call :RemoveFile "%Temp%\Updates\!CU!.psf"
			call :RemoveFile "%Temp%\Updates\PSFExtractor.exe"
		)

		for /f %%j in ('"dir /b %Updates%\*.cab" 2^>nul') do (
			if "%%j" neq "!CU!.cab" (
				set Update=%%j
	        	set Update=!Update:~0,-4!
				call :CreateFolder "%Temp%\Updates\!Update!"
				expand -R "%Updates%\%%j" -F:* "%Temp%\Updates\!Update!" >nul
			)
		)
	)

	if exist "%Updates%\defender-update-kit-%ImageArchitecture%.zip" (
		%Zip% x -y "%Updates%\defender-update-kit-%ImageArchitecture%.zip" -o"%Temp%\Updates\Defender" >nul
		expand -R "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab" -F:* "%Temp%\Updates\Defender" >nul
		call :RemoveFile "%Temp%\Updates\Defender\defender-dism-%ImageArchitecture%.cab"
		call :RemoveFile "%Temp%\Updates\Defender\DefenderUpdateWinImage.ps1"
		call :RemoveFile "%Temp%\Updates\Defender\license.txt"
	)

	:: 重命名 Windows 更新文件夹名称匹配它们各自的更新类型
	for /f %%i in ('"dir /b *.*" 2^>nul') do (
    	if exist "%%i\update.mum" (
        	findstr /c:"Package_for_DotNetRollup" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NetCumulative" >nul
    	)

    	if exist "%%i\%PackageArchitecture%_microsoft-windows-m..update-genuineintel_*.manifest" ren "%%i" "CPUMicroCode" >nul
    	if exist "%%i\package-defender.xml" ren "%%i" "Defender" >nul
    	if exist "%%i\setuphost.exe" ren "%%i" "DVDMedia" >nul
    	if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.*.mum" ren "%%i" "NET35" >nul
    	if exist "%%i\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.*.mum" ren "%%i" "NET35LP" >nul
    	if exist "%%i\%PackageArchitecture%_microsoft-windows-servicingstack_*.manifest" ren "%%i" "ServicingStack" >nul
    	if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-i..dsetup-rejuvenation_*.manifest" ren "%%i" "SafeOS" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-r..-commandline-editor_*.manifest" ren "%%i" "General" >nul
	)

	cd /d "%ROOT%\"
)

echo.
echo.解压 .CAB 程序包文件到临时文件夹已完成……
echo.
if "%UpdateType%" neq "Boot" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" if exist "%Temp%\Updates\Enablement\Update.mum" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-e..-firsttimeinstaller_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" (
	choice /C:YN /N /M "你想要跳过集成 Microsoft Edge Chromium 吗 ？ [是‘Y’/否‘N’] ："
	if !errorlevel! equ 1 (
		del /f /q "%Temp%\Updates\Enablement\Update.mum" >nul
		del /f /q "%Temp%\Updates\Enablement\Update.cat" >nul

		if "%ImageArchitecture%" equ "x86" (
			rd /q /s "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_d4e678d60dbf374c" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_88ed58c8b45ef5b335c7e00f1d272a1c_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.cat" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			rd /q /s "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051459c61ca882" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_84b67765c88012e177d65b696e48302e_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)

		if "%ImageArchitecture%" equ "arm64" (
			rd /q /s "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051c93c61c9d1e" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_d29030e5eb1fbfc0c65c0cd08e617938_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)
	)
	echo.
)

if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####正在集成 WHD 基线更新到 Windows 安装程序启动映像###########################
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####正在集成 WHD 常规更新到 Windows 安装程序启动映像###########################
    echo.-------------------------------------------------------------------------------
	echo.

    for /l %%i in (1, 1, 2) do (
	    echo.==============================[Boot.wim，索引：%%i]==============================
	    echo.
	    :: Windows 8.1 RTM（内部版本 ：6.3.9600.16384）
	    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线先决条件更新 ^(KB3021910^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线更新 ^(KB2919355^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB2932046^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB2937592^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB2938439^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB2938772^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
	    )

		:: Windows 8.1 with Update（IR3 内部版本 ：6.3.9600.17031）
		if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	    )

	    :: Windows 8.1 with Update（IR4 内部版本 ：6.3.9600.17056）
	    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	    )

	    :: Windows 8.1 with Update Refresh（IR5 内部版本 ：6.3.9600.17415）
	    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
			if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
	    )

        :: Windows 10
		if "%SelectedSourceOS%" equ "w10" (
			if exist "%Temp%\Updates\ServicingStack\Update.mum" (
				if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
					echo.-------------------------------------------------------------------------------
					echo.正在应用 Windows 10 v1507 累积更新集成修复……
					echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", %PackageIndex%, "%BootMount%\%%i"
    				call :MountImageRegistry "%BootMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\TH1CUFix_%ImageArchitecture%.reg" 2>nul
					call :UnMountImageRegistry
    			)

				if "%ImageArchitecture%" equ "x86" if "%ImageBuild%" equ "14393" if "%ImageServicePackBuild%" equ "0" (
					echo.-------------------------------------------------------------------------------
					echo.正在应用 Windows 10 v1607 累积更新集成修复……
    				echo.-------------------------------------------------------------------------------
					call :ApplyImage "%W10CUFix%\RS1CUFix.tpk", %PackageIndex%, "%BootMount%\%%i"
					call :MountImageRegistry "%BootMount%\%%i"
					call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
					call :UnMountImageRegistry
			    )
		    )
	    )

        :: Windows 10/11
		if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			if exist "%Temp%\Updates\ServicingStack\Update.mum" (
			    echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows %OSID% 服务堆栈更新……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\ServicingStack"
		    )

			if exist "%Temp%\Updates\General\Update.mum" (
			    echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 11 常规更新……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\General"
		    )

		    if exist "%Temp%\Updates\Cumulative\Update.mum" (
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 Windows %OSID% 累积更新……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Cumulative"
		    )

		    if "%SelectedSourceOS%" equ "w10" if exist "%Temp%\Updates\Enablement\Update.mum" (
			    echo.-------------------------------------------------------------------------------
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v1909 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v20H2 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v21H1 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
				)
				echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Enablement"
		    )
	    )
	)

	:: Windows 8.1
	if "%SelectedSourceOS%" equ "w81" if exist "%Temp%\Updates\WinPE\*.cab" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 Windows 8.1 WinPE 更新……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%BootMount%\2", "%Temp%\Updates\WinPE"
	)

	:: Windows 10/11
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
		if exist "%Temp%\Updates\SafeOS\Update.mum" (
		   	echo.-------------------------------------------------------------------------------
		   	echo.正在集成 Windows %OSID% Safe OS 动态更新……
		   	echo.-------------------------------------------------------------------------------
		   	call :AddPackage "%BootMount%\2", "%Temp%\Updates\SafeOS"
		)

		if exist "%Temp%\Updates\DVDMedia\*.exe" if exist "%Temp%\Updates\DVDMedia\*.dll" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows %OSID% 适用于 Sources 的动态更新……
			echo.-------------------------------------------------------------------------------
			echo.
			echo.正在复制 Windows %OSID% 适用于 Sources 的动态更新到 ^<DVD^> 文件夹。
			%XCopy% "%Temp%\Updates\DVDMedia\*.*" "%DVD%\sources" >nul
			cd /d "%DVD%\sources\" >nul
			
			for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
				if "%ImageDefaultLanguage%" neq "%%i" rd /q /s "%DVD%\sources\%%i" >nul 2>&1
			)

			cd /d "%ROOT%\" >nul
			echo.
		)
	)
)

if "%UpdateType%" neq "Boot" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####正在集成 WHD 基线更新到 Windows 安装程序安装映像###########################
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####正在集成 WHD 常规更新到 Windows 安装程序安装映像###########################
    echo.-------------------------------------------------------------------------------

    for /l %%i in (1, 1, %ImageCount%) do (
	    if exist "%InstallMount%\%%i" (
		    echo.
		    if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		    if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		    echo.

		    :: Windows 8.1 RTM（内部版本 ：6.3.9600.16384）
		    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线先决条件更新 ^(KB3021910^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线更新 ^(KB2919355^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2932046^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2937592^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2938439^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2938772^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3014442^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update（IR3 内部版本 ：6.3.9600.17031）
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3014442^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update（IR4 内部版本 ：6.3.9600.17056）
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB3014442^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update Refresh（IR5 内部版本 ：6.3.9600.17415）
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
			    if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    )

			    echo.-------------------------------------------------------------------------------
			    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
		    )

		    :: Windows 10
		    if "%SelectedSourceOS%" equ "w10" (
			    :: 合并注册表修复以启用集成 Windows 10 更新到终止支持的版本。
			    if "%ImageBuild%" equ "10240" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, Education, Enterprise, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, EducationN, EnterpriseN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "10586" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\th2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "14393" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, Education, Enterprise, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, EducationN, EnterpriseN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs1.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "15063" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs2.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.15063.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "16299" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, Education, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs3.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, EducationN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs3.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "17134" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, Professional, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs4.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs4.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17134.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "17763" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs5.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs5.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseSNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.17763.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)

			    if "%ImageBuild%" equ "18362" if "%ImageBuild%" equ "18363" (
					call :GetImageEdition "%InstallWim%", %%i >nul

                    for %%j in (Core, CoreSingleLanguage, ProfessionalEducation, ProfessionalWorkstation) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs6.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )

                    for %%j in (CoreN, ProfessionalEducationN, ProfessionalWorkstationN) do (
						if "%ImageEdition%" equ "%%j" (
							call :MountImageRegistry "%InstallMount%\%%i"
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallClient" /t REG_SZ /d "DISM Package Manager Provider" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1.mum" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallLocation" /t REG_SZ /d "\\?\d:\rs6.bin.%PackageArchitecture%fre\csi\pkgs\\" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "CurrentState" /t REG_DWORD /d "112" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "SelfUpdate" /t REG_DWORD /d "0" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "Visibility" /t REG_DWORD /d "1" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeHigh" /t REG_DWORD /d "30649479" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallTimeLow" /t REG_DWORD /d "1431244152" /f >nul
							reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.18362.1" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
							call :UnMountImageRegistry
						)
                    )
				)
			)

			:: Windows 10/11
			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
			    if exist "%Temp%\Updates\ServicingStack\Update.mum" (
					if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
						echo.-------------------------------------------------------------------------------
						echo.正在应用 Windows 10 v1507 累积更新集成修复……
						echo.-------------------------------------------------------------------------------
						call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
						call :MountImageRegistry "%InstallMount%\%%i"
						call :ImportRegistry2Image "%W10CUFix%\TH1CUFix_%ImageArchitecture%.reg" 2>nul
						call :UnMountImageRegistry
					)

					if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x86" if "%ImageBuild%" equ "14393" if "%ImageServicePackBuild%" equ "0" (
						echo.-------------------------------------------------------------------------------
						echo.正在应用 Windows 10 v1607 累积更新集成修复……
						echo.-------------------------------------------------------------------------------
						call :ApplyImage "%W10CUFix%\RS1CUFix.tpk", %PackageIndex%, "%InstallMount%\%%i"
						call :MountImageRegistry "%InstallMount%\%%i"
						call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
						call :UnMountImageRegistry
					)

					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows %OSID% 服务堆栈更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\ServicingStack"
			    )

				if exist "%Temp%\Updates\General\Update.mum" (
			    	echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 11 常规更新……
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\General"
		    	)

			    if exist "%Temp%\Updates\WindowsExperienceFeature\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows Experience Feature Pack 更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\WindowsExperienceFeature"
			    )

			    if exist "%Temp%\Updates\CPUMicroCode\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Intel CPU 微码动态更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\CPUMicroCode"
			    )

			    if exist "%Temp%\Updates\SecureBoot\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 安全启动 DBX 更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\SecureBoot"
			    )

			    if exist "%Temp%\Updates\FlashPlayer\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Adobe Flash Player 安全更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\FlashPlayer"
			    )

			    if exist "%Temp%\Updates\RemoveFlashPlayer\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成移除 Adobe Flash Player 更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\RemoveFlashPlayer"
			    )

			    if exist "%Temp%\Updates\Cumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows %OSID% 累积更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
			    )

			    if exist "%Temp%\Updates\NET35\Update.mum" (
					if "%ImageBuild%" lss "19041" if not exist "%InstallMount%\%%i\Windows\WinSxS\pending.xml" (
						echo.-------------------------------------------------------------------------------
						echo.正在执行对 [Install.wim，索引 ：%%i] 的映像清理……
						echo.-------------------------------------------------------------------------------
						call :CleanupImage "%InstallMount%\%%i", "ComponentCleanupResetBase"
					)
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET Framework 3.5 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35"
			    )

			    if exist "%Temp%\Updates\NET35LP\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET Framework 3.5 [%ImageDefaultLanguage%] 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35LP"
			    )

			    if exist "%Temp%\Updates\NET48\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET Framework 4.8 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48"
			    )

			    if exist "%Temp%\Updates\NET48LP\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] 程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET48LP"
			    )

			    if exist "%Temp%\Updates\NetCumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET 累积更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NetCumulative"
			    )

			    if exist "%Temp%\Updates\EdgeChromium\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft Edge Chromium 浏览器程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\EdgeChromium"
			    )

			    if exist "%Temp%\Updates\Enablement\Update.mum" (
					echo.-------------------------------------------------------------------------------
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v1909 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v20H2 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v21H1 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
					)
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Enablement"
			    )

			    if exist "%Temp%\Updates\Cumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.Re-正在集成 Windows %OSID% 累积更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
			    )

			    if exist "%Temp%\Updates\Defender\package-defender.xml" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows Defender 定义更新到安装映像……
					echo.-------------------------------------------------------------------------------
					echo.
					for /f %%x IN ('"dir /b %Temp%\Updates\Defender\Platform" 2^>nul') do (set "DefenderVersion=%%x")

					echo.正在复制 Windows Defender 定义更新 ^(v!DefenderVersion!^)。
					%XCopy% "%Temp%\Updates\Defender\Definition Updates\Updates" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Definition Updates\Updates" >nul

					echo.正在复制 Windows Defender 平台更新。
					%XCopy% /s "%Temp%\Updates\Defender\Platform" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform" >nul

				    echo.正在复制 MpAsDesc.dll 文件。
				    Copy "%InstallMount%\%%i\Program Files\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!" >nul
				    if "%ImageArchitecture%" equ "x64" Copy "%InstallMount%\%%i\Program Files (x86)\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86" >nul

					echo.正在复制 MpAsDesc.dll.mui 文件。
					for /d %%y in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
						if exist "%InstallMount%\%%i\Program Files\Windows Defender\%%y" (
							call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y"
							Copy "%InstallMount%\%%i\Program Files\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y\mpasdesc.dll.mui" >nul

							if "%ImageArchitecture%" equ "x64" (
								call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y"
								Copy "%InstallMount%\%%i\Program Files (x86)\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y\mpasdesc.dll.mui" >nul
							)
						)
					)

					echo.正在复制 Package-defender.xml 到 Windows 临时文件夹。
					Copy "%Temp%\Updates\Defender\package-defender.xml" "%InstallMount%\%%i\Windows\Temp" >nul
					echo.
			    )
		    )
	    )
    )
)

if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####正在集成 WHD 基线更新到 Windows 安装程序恢复映像###########################
    if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.####正在集成 WHD 常规更新到 Windows 安装程序恢复映像###########################
    echo.-------------------------------------------------------------------------------
    echo.
    :: Windows 8.1 RTM（内部版本 ：6.3.9600.16384）
    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线先决条件更新 ^(KB3021910^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线更新 ^(KB2919355^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2932046^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2937592^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2938439^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2938772^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
    )

    :: Windows 8.1 with Update（IR3 内部版本 ：6.3.9600.17031）
    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB2934018^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
    )

    :: Windows 8.1 with Update Refresh（IR4 内部版本 ：6.3.9600.17056）
    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3000850^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB3003057^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
    )

    :: Windows 8.1 with Update Refresh（IR5 内部版本 ：6.3.9600.17415）
    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
	    if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 WHD 基线功能包更新 ^(KB3021910^)……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
	    )

	    echo.-------------------------------------------------------------------------------
	    echo.正在集成 WHD 基线功能包更新 ^(KB5001403^)……
	    echo.-------------------------------------------------------------------------------
	    call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5001403-%ImageArchitecture%.cab"
	)

   	:: Windows 8.1
	if "%SelectedSourceOS%" equ "w81" if exist "%Temp%\Updates\WinPE\*.cab" (
    	echo.-------------------------------------------------------------------------------
    	echo.正在集成 Windows 10 WinPE 更新……
    	echo.-------------------------------------------------------------------------------
    	call :AddPackage "%WinReMount%", "%Temp%\Updates\WinPE"
   	)

	:: Windows 10/11
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	    if exist "%Temp%\Updates\ServicingStack\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows %OSID% 服务堆栈更新程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\ServicingStack"
	    )

		if exist "%Temp%\Updates\General\Update.mum" (
		    echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 11 常规更新……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%Temp%\Updates\General"
		)

	    if exist "%Temp%\Updates\SafeOS\Update.mum" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 Windows %OSID% Safe OS 动态更新……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%Temp%\Updates\SafeOS"
	    )

		if not exist "%Temp%\Updates\SafeOS\Update.mum" if exist "%Temp%\Updates\Cumulative\Update.mum" (
		    echo.-------------------------------------------------------------------------------
		    echo.正在集成 Windows %OSID% 累积更新程序包……
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%WinReMount%", "%Temp%\Updates\Cumulative"
	    )

	    if exist "%Temp%\Updates\Enablement\Update.mum" (
			echo.-------------------------------------------------------------------------------
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-19h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v1909 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v20H2 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v21H1 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-21h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
			)
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Enablement"
	    )
    )
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.正在生成 WHD 基线更新集成日志文件……
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.正在生成 WHD 常规更新集成日志文件……
	echo.-------------------------------------------------------------------------------
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.正在写入 WHD 基线更新集成日志。
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.正在写入 WHD 常规更新集成日志。
	echo.

	if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" (
		for /l %%k in (1, 1, 2) do (
			call :GetPackages "%BootMount%\%%k", "Boot-%%k.txt"
		)
	)

	if "%UpdateType%" neq "Boot" (
	    for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" (
    			call :GetPackages "%InstallMount%\%%i", "Install-%%i.txt"
    		)
		)
	)

	if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" (
		call :GetPackages "%WinReMount%", "Install_WinRE.txt"
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在清理临时文件和文件夹###################################################
echo.-------------------------------------------------------------------------------
echo.
if "%SelectedSourceOS%" equ "w81" echo.正在清理 WHD 基线更新临时文件夹。
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.正在清理 WHD 基线更新临时文件夹。
call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.#############################集成 WHD 基线更新#################################
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" echo.#############################集成 WHD 常规更新#################################
if "%UpdateType%" equ "Boot" echo.#########################到 Windows 安装程序启动映像###########################
if "%UpdateType%" equ "Install" echo.#########################到 Windows 安装程序安装映像###########################
if "%UpdateType%" equ "InstallRecovery" echo.####################到 Windows 安装程序安装和恢复映像###########################
if "%UpdateType%" equ "BootInstallRecovery" echo.#################到 Windows 安装程序启动、安装和恢复映像#######################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set PackageArchitecture=
set UpdateType=
set Updates=

endlocal

:: 读取已更新的映像信息
call :GetUpdatedImageInformation >nul

:: 返回到集成菜单
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成更新模组
:: 输入参数 [%~1 ：更新类型 ]
::-------------------------------------------------------------------------------------------
:IntUpdates

setlocal

:: 设置 WHD 更新类型
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "WUpdates" echo.                       MSMG 工具箱 - 集成 Windows 更新
if "%UpdateType%" equ "General" echo.                       MSMG 工具箱 - 集成 WHD 常规更新
if "%UpdateType%" equ "Hotfix" echo.                      MSMG 工具箱 - 集成 WHD 热修复更新
if "%UpdateType%" equ "Security" echo.                       MSMG 工具箱 - 集成 WHD 安全更新
if "%UpdateType%" equ "ESU" echo.                     MSMG 工具箱 - 集成 WHD 延长安全更新
if "%UpdateType%" equ "NET35" echo.              MSMG 工具箱 - 集成 Microsoft .NET Framework 3.5 更新
if "%UpdateType%" equ "WAT" echo.                    MSMG 工具箱 - 集成 Windows 激活技术 ^(WAT^)
if "%UpdateType%" equ "Windows10" echo.                   MSMG 工具箱 - 集成 Windows 10 升级准备更新
if "%UpdateType%" equ "WinPE" echo.                       MSMG 工具箱 - 集成 Windows PE 更新
if "%UpdateType%" equ "WUSatisfy" echo.               MSMG 工具箱 - 集成 Windows Update Satisfy Updates
if "%UpdateType%" equ "ADLDS" echo.               MSMG 工具箱 - 集成 Active Directory 轻型目录服务
if "%UpdateType%" equ "FMApi" echo.                        MSMG 工具箱 - 集成文件管理 API
if "%UpdateType%" equ "Features" echo.                       MSMG 工具箱 - 集成 Windows 功能
if "%UpdateType%" equ "VirtualPC" echo.                 MSMG 工具箱 - 集成 Microsoft Virtual PC 功能
if "%UpdateType%" equ "WorkFolders" echo.             MSMG 工具箱 - 集成适用于域环境的同步代理 ^(工作文件夹^)
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Windows/WHD 更新菜单文件夹路径
if "%UpdateType%" equ "WUpdates" set "Updates=%Updates%\%SelectedSourceOS%\%ImageArchitecture%"
if "%UpdateType%" neq "WUpdates" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查 Windows/WHD 更新文件夹是否是空的
if "%UpdateType%" equ "WUpdates" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
	echo.Windows 更新文件夹 ^<Updates\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
	echo.
	echo.请复制 Windows 更新文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "General" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.cab" (
		echo.WHD 常规更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#General^> 是空的……
		echo.
		echo.请复制 WHD 常规更新文件到相应的文件夹……
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD 常规更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> 是空的……
		echo.
		echo.请复制 WHD 常规更新文件到相应的文件夹……
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD 常规更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> 是空的……
		echo.
		echo.请复制 WHD 常规更新文件到相应的文件夹……
		goto :Stop
	)
)

if "%UpdateType%" equ "Hotfix" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.cab" (
		echo.WHD 热修复更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Hotfix^> 是空的……
		echo.
		echo.请复制 WHD 热修复更新文件到相应的文件夹……
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD 热修复更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> 是空的……
		echo.
		echo.请复制 WHD 热修复更新文件到相应的文件夹……
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD 热修复更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> 是空的……
		echo.
		echo.请复制 WHD 热修复更新文件到相应的文件夹……
		goto :Stop
	)
)

if "%UpdateType%" equ "Security" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.cab" (
		echo.WHD 安全更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Security^> 是空的……
		echo.
		echo.请复制 WHD 安全更新文件到相应的文件夹……
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD 安全更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> 是空的……
		echo.
		echo.请复制 WHD 安全更新文件到相应的文件夹……
		goto :Stop
	)
	
	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD 安全更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> 是空的……
		echo.
		echo.请复制 WHD 安全更新文件到相应的文件夹……
		goto :Stop
	)
)

if "%UpdateType%" equ "ESU" (
	if "%SelectedSourceOS%" equ "w7" if not exist "%Updates%\Security\ESU\*.msu" if not exist "%Updates%\Security\ESU\*.cab" (
		echo.WHD 延长安全更新 ^(ESU^) 文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security\ESU^> 是空的……
		echo.
		echo.请复制 WHD 延长安全更新 ^(ESU^) 文件到相应的文件夹……
		goto :Stop
	)
)

if "%UpdateType%" equ "NET35" if not exist "%Updates%\Additional\NET35\*.msu" if not exist "%Updates%\Additional\NET35\*.cab" (
	echo.	         Microsoft .NET Framework 3.5 更新文件夹
	echo.	       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\NET35^> 是空的……
	echo.
	echo.  请复制 Microsoft .NET Framework 3.5 更新文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "WAT" (
	if not exist "%Updates%\Additional\WAT\*.msu" if not exist "%Updates%\Additional\WAT\*.cab" (
		echo.                    Windows 激活技术文件夹
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WAT^> 是空的……
		echo.
		echo.          请复制 Windows 激活技术文件到相应的文件夹……
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows 激活技术需要客户端/服务器端版本……
		goto :Stop
	)
)

if "%UpdateType%" equ "Windows10" (
	if not exist "%Updates%\Additional\Windows10\*.msu" if not exist "%Updates%\Additional\Windows10\*.cab" (
		echo.                  Windows 10 升级准备更新文件夹
		echo.               ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\Windows10^> 是空的……
		echo.
		echo.        请复制 Windows 10 升级准备更新文件到相应的文件夹……
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.cab" (
		echo.                  Windows 10 升级准备更新文件夹
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Windows10^> 是空的……
		echo.
		echo.        请复制 Windows 10 升级准备更新文件到相应的文件夹……
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows 10 升级准备更新需要客户端版本……
		goto :Stop
	)
)

if "%UpdateType%" equ "WinPE" if not exist "%Updates%\Additional\WinPE\*.msu" if not exist "%Updates%\Additional\WinPE\*.cab" (
	echo.Windows PE 更新文件夹 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WinPE^> 是空的……
	echo.
	echo.请复制 Windows PE 更新文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "WUSatisfy" if not exist "%Updates%\Additional\WU.Satisfy\*.msu" if not exist "%Updates%\Additional\WU.Satisfy\*.cab" (
	echo.                      Windows Update Satisfy Updates 文件夹
	echo.              ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WU.Satisfy^> 是空的……
	echo.
	echo.           请复制 Windows Update Satisfy Updates 文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "ADLDS" (
	if not exist "%Updates%\Extra\AD_LDS\*.msu" if not exist "%Updates%\Extra\AD_LDS\*.cab" (
		echo.                   Active Directory 轻型目录服务功能文件夹
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS^> 是空的……
		echo.
		echo.                     请复制 ADLDS 功能文件到相应的文件夹……
		goto :Stop
	)

	if not exist "%Updates%\Extra\AD_LDS\Updates\*.msu" if not exist "%Updates%\Extra\AD_LDS\Updates\*.cab" (
		echo.                 Active Directory 轻型目录服务功能更新文件夹
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS\Updates^> 是空的……
		echo.
		echo.                  请复制 ADLDS 功能更新文件到相应的文件夹……
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.cab" (
		echo.                 Active Directory 轻型目录服务功能更新文件夹
		echo.         ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\AD_LDS^> 是空的……
		echo.
		echo.                  请复制 ADLDS 功能更新文件到相应的文件夹……
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.                     Active Directory 轻型目录服务功能
		echo.                         需要专业版/企业版/旗舰版……
		goto :Stop
	) else (
		goto :Continue
	)
)

if "%UpdateType%" equ "FMApi" if not exist "%Updates%\Extra\Addons\FM.Api\*.msu" if not exist "%Updates%\Extra\Addons\FM.Api\*.cab" (
	echo.                        文件管理 API 文件夹
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\FM.Api^> 是空的……
	echo.
	echo.               请复制文件管理 API 文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "Features" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.cab" (
	echo.                           Windows 功能文件夹
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Features^> 是空的……
	echo.
	echo.                请复制 Windows 功能文件到相应的文件夹……
	goto :Stop
)

if "%UpdateType%" equ "VirtualPC" (
	if not exist "%Updates%\Extra\VirtualPC\*.msu" if not exist "%Updates%\Extra\VirtualPC\*.cab" (
		echo.                     Microsoft Virtual PC 功能文件夹
		echo.                ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\VirtualPC^> 是空的……
		echo.
		echo.           请复制 Microsoft Virtual PC 功能文件到相应的文件夹……
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.cab" (
		echo.                   Microsoft Virtual PC 功能更新文件夹
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\VirtualPC^> 是空的……
		echo.
		echo.         请复制 Microsoft Virtual PC 功能更新文件到相应的文件夹……
		goto :Stop
	)
)

if "%UpdateType%" equ "WorkFolders" (
	if not exist "%Updates%\Extra\Addons\WorkFolders\*.msu" if not exist "%Updates%\Extra\Addons\WorkFolders\*.cab" (
		echo.             适用于域环境的同步代理 ^(工作文件夹^) 功能文件夹
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\WorkFolders^> 是空的……
		echo.
		echo.                  请复制适用于域环境的同步代理 ^(工作文件夹^)
		echo.                        功能文件到相应的文件夹……
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "No" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.cab" (
		echo.            适用于域环境的同步代理 ^(工作文件夹^) 功能更新文件夹
		echo.      ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\WorkFolders^> 是空的……
		echo.
		echo.                  请复制适用于域环境的同步代理 ^(工作文件夹^)
		echo.                       功能更新文件到相应的文件夹……
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.                 适用于域环境的同步代理 ^(工作文件夹^) 功能
		echo.                         需要专业版/企业版/旗舰版……
		goto :Stop
	) else (
		goto :Continue
	)
)

:Continue
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "WUpdates" echo.####正在开始集成 Windows 更新##################################################
if "%UpdateType%" equ "General" echo.####正在开始集成 WHD 常规更新##################################################
if "%UpdateType%" equ "Hotfix" echo.####正在开始集成 WHD 热修复更新################################################
if "%UpdateType%" equ "Security" echo.####正在开始集成 WHD 安全更新##################################################
if "%UpdateType%" equ "ESU" echo.####正在开始集成 WHD 延长安全更新##############################################
if "%UpdateType%" equ "NET35" echo.####正在开始集成 Microsoft .NET Framework 3.5 更新#############################
if "%UpdateType%" equ "WAT" echo.####正在开始集成 Windows 激活技术 ^(WAT^)########################################
if "%UpdateType%" equ "Windows10" echo.####正在开始集成 Windows 10 升级准备更新#######################################
if "%UpdateType%" equ "WinPE" echo.####正在开始集成 Windows PE 更新###############################################
if "%UpdateType%" equ "WUSatisfy" echo.####正在开始集成 Windows Update Satisfy Updates################################
if "%UpdateType%" equ "ADLDS" echo.####正在开始集成 Active Directory 轻型目录服务#################################
if "%UpdateType%" equ "FMApi" echo.####正在开始集成文件管理 API###################################################
if "%UpdateType%" equ "Features" echo.####正在开始集成 Windows 功能##################################################
if "%UpdateType%" equ "VirtualPC" echo.####正在开始集成 Microsoft Virtual PC 功能#####################################
if "%UpdateType%" equ "WorkFolders" echo.####正在开始集成适用于域环境的同步代理 ^(工作文件夹^)############################
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" neq "WinPE" (
	echo.    映像文件名称             ：Install.wim
	echo.    映像索引                 ：%ImageIndexNo%
) else (
	echo.    映像文件名称             ：Boot.wim         ^|  WinRE.wim
	echo.    映像索引范围             ：   2             ^|    1
)
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "WUpdates" echo.####正在处理 Windows 更新包####################################################
if "%UpdateType%" equ "General" echo.####正在处理 WHD 常规更新包####################################################
if "%UpdateType%" equ "Hotfix" echo.####正在处理 WHD 热修复更新包##################################################
if "%UpdateType%" equ "Security" echo.####正在处理 WHD 安全更新包####################################################
if "%UpdateType%" equ "ESU" echo.####正在处理 WHD 延长安全更新包################################################
if "%UpdateType%" equ "NET35" echo.####正在处理 Microsoft .NET Framework 3.5 更新包###############################
if "%UpdateType%" equ "WAT" echo.####正在处理 Windows 激活技术 ^(WAT^) 包#########################################
if "%UpdateType%" equ "Windows10" echo.####正在处理 Windows 10 升级准备更新包#########################################
if "%UpdateType%" equ "WinPE" echo.####正在处理 Windows PE 更新包#################################################
if "%UpdateType%" equ "WUSatisfy" echo.####正在处理 Windows Update Satisfy Updates 包#####################################
if "%UpdateType%" equ "ADLDS" echo.####正在处理Active Directory 轻型目录服务包###########################################
if "%UpdateType%" equ "FMApi" echo.####正在处理文件管理 API 包###########################################################
if "%UpdateType%" equ "Features" echo.####正在处理 Windows 功能包####################################################
if "%UpdateType%" equ "VirtualPC" echo.####正在处理 Microsoft Virtual PC 功能包#######################################
if "%UpdateType%" equ "WorkFolders" echo.####正在处理适用于域环境的同步代理 ^(工作文件夹^) 包#############################
echo.-------------------------------------------------------------------------------
echo.
:: 创建 Windows/WHD 更新临时文件夹
if "%UpdateType%" equ "WUpdates" echo.正在创建 Windows 更新包临时文件夹……
if "%UpdateType%" equ "General" echo.正在创建 WHD 常规更新包临时文件夹……
if "%UpdateType%" equ "Hotfix" echo.正在创建 WHD 热修复更新包临时文件夹……
if "%UpdateType%" equ "Security" echo.正在创建 WHD 安全更新包临时文件夹……
if "%UpdateType%" equ "ESU" echo.正在创建 WHD 延长安全更新包临时文件夹……
if "%UpdateType%" equ "NET35" echo.正在创建 Microsoft .NET Framework 3.5 更新包临时文件夹……
if "%UpdateType%" equ "WAT" echo.正在创建 Windows 激活技术包临时文件夹……
if "%UpdateType%" equ "Windows10" echo.正在创建 Windows 10 升级准备更新包临时文件夹……
if "%UpdateType%" equ "WinPE" echo.正在创建 Windows PE 更新包临时文件夹……
if "%UpdateType%" equ "WUSatisfy" echo.正在创建 Windows Update Satisfy Update 包临时文件夹……
if "%UpdateType%" equ "ADLDS" echo.正在创建 ADLDS 包临时文件夹……
if "%UpdateType%" equ "FMApi" echo.正在创建文件管理 API 包临时文件夹……
if "%UpdateType%" equ "Features" echo.正在创建 Windows 功能包临时文件夹……
if "%UpdateType%" equ "VirtualPC" echo.正在创建 Microsoft Virtual PC 功能包临时文件夹……
if "%UpdateType%" equ "WorkFolders" echo.正在创建适用于域环境的同步代理包临时文件夹……
echo.

call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"

if "%UpdateType%" equ "General" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "Hotfix" call :CreateFolder "%Temp%\Updates\%UpdateType%"

if "%UpdateType%" equ "Security" (
	call :CreateFolder "%Temp%\Updates\%UpdateType%" >nul
	if "%SelectedSourceOS%" equ "w81" call :CreateFolder "%Temp%\Updates\%UpdateType%\ProWMC"
)

if "%UpdateType%" equ "ESU" (
	call :CreateFolder "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "NET35" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WAT" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "Windows10" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WinPE" call :CreateFolder "%Temp%\Updates\%UpdateType%"
if "%UpdateType%" equ "WUSatisfy" call :CreateFolder "%Temp%\Updates\%UpdateType%\ProfessionalWMC"
if "%UpdateType%" equ "ADLDS" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
if "%UpdateType%" equ "FMApi" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
if "%UpdateType%" equ "Features" call :CreateFolder "%Temp%\Updates\%UpdateType%"

if "%UpdateType%" equ "VirtualPC" (
	if "%IsW7SP1CRUSelected%" equ "Yes" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "No" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

if "%UpdateType%" equ "WorkFolders" (
	if "%IsW7SP1CRUSelected%" equ "Yes" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "No" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

echo.正在将 .CAB 程序包文件解压到临时文件夹……
echo.

:: 解压/复制 Windows/WHD 更新 .CAB 文件到临时文件夹
if "%UpdateType%" equ "WUpdates" (
	if exist "%Updates%\*%ImageArchitecture%*.msu" expand "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\*.cab" "%Temp%\Updates" >nul
)

if "%UpdateType%" equ "General" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#General\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#General\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#General\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#General\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\WUClient*.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\WUClient"
			move /y "%Temp%\Updates\%UpdateType%\WUClient*.cab" "%Temp%\Updates\%UpdateType%\WUClient" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\SP2"
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2670838-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB3125574-v4-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul
		move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB3172605-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\SP2" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\Client"
		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB917607-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows6.1-KB917607-%ImageArchitecture%.cab" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB3140185-%ImageArchitecture%.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\Upgrade"
			move /y "%Temp%\Updates\%UpdateType%\Windows8.1-KB3140185-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\Upgrade" >nul
		)

		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB917607-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows8.1-KB917607-%ImageArchitecture%.cab" >nul
		if exist "%Temp%\Updates\%UpdateType%\Windows8.1-KB4486105-%ImageArchitecture%.cab" del /f /q "%Temp%\Updates\%UpdateType%\Windows8.1-KB4486105-%ImageArchitecture%.cab" >nul
	)
)

if "%UpdateType%" equ "Hotfix" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB2780124-%ImageArchitecture%*.cab" (
			call :CreateFolder "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
			move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2780124-%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%\Ent_Ultimate" >nul
		)
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		call :CreateFolder "%Temp%\Updates\%UpdateType%\Client"
		if exist "%Temp%\Updates\%UpdateType%\Windows6.1-KB2727994-v3-%ImageArchitecture%.cab" move /y "%Temp%\Updates\%UpdateType%\Windows6.1-KB2727994-v3-%ImageArchitecture%.cab" "%Temp%\Updates\%UpdateType%\Client" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "Security" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\#Security\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\#Security\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\#Security\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\#Security\*.cab" "%Temp%\Updates\%UpdateType%" >nul

		if exist "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\Windows6.1-KB4490628-%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)

	if "%SelectedSourceOS%" equ "w81" (
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\*.cab" "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\NET452\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\NET452\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\NET452\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\NET452\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "ESU" (
	if exist "%Updates%\Security\ESU\*%ImageArchitecture%*.msu" expand "%Updates%\Security\ESU\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Security\ESU\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Security\ESU\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "NET35" (
	if exist "%Updates%\Additional\NET35\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\NET35\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\NET35\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\NET35\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "WAT" (
	if exist "%Updates%\Additional\WAT\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WAT\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WAT\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WAT\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "Windows10" (
	if exist "%Updates%\Additional\Windows10\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\Windows10\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\Windows10\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\Windows10\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\_Windows10\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\_Windows10\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	)
)

if "%UpdateType%" equ "WinPE" (
	if exist "%Updates%\Additional\WinPE\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WinPE\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WinPE\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WinPE\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if exist "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.msu" expand "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.cab" %XCopy% "%Updates%\General\Windows8.1-KB3084905*%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.msu" expand "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.cab" %XCopy% "%Updates%\General\Windows8.1-KB3115224*%ImageArchitecture%*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "WUSatisfy" (
	if exist "%Updates%\Additional\WU.Satisfy\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WU.Satisfy\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WU.Satisfy\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WU.Satisfy\*.cab" "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*%ImageArchitecture%*.msu" expand "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\ProfessionalWMC" >nul
	if exist "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Additional\WU.Satisfy\ProfessionalWMC\*.cab" "%Temp%\Updates\%UpdateType%\ProfessionalWMC" >nul
)

if "%UpdateType%" equ "ADLDS" (
	if exist "%Updates%\Extra\AD_LDS\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\AD_LDS\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\AD_LDS\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\AD_LDS\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if exist "%Updates%\Extra\AD_LDS\Updates\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\AD_LDS\Updates\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
	if exist "%Updates%\Extra\AD_LDS\Updates\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\AD_LDS\Updates\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

if "%UpdateType%" equ "FMApi" (
	if exist "%Updates%\Extra\Addons\FM.Api\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\Addons\FM.Api\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\Addons\FM.Api\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\Addons\FM.Api\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "Features" (
	if exist "%Updates%\Extra\WithoutKB3125574\_Features\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\_Features\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\WithoutKB3125574\_Features\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\_Features\*.cab" "%Temp%\Updates\%UpdateType%" >nul
)

if "%UpdateType%" equ "VirtualPC" (
	if exist "%Updates%\Extra\VirtualPC\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\VirtualPC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\VirtualPC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\VirtualPC\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

if "%UpdateType%" equ "WorkFolders" (
	if exist "%Updates%\Extra\Addons\WorkFolders\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\Addons\WorkFolders\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
	if exist "%Updates%\Extra\Addons\WorkFolders\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\Addons\WorkFolders\*.cab" "%Temp%\Updates\%UpdateType%" >nul

	if "%IsW7SP1CRUSelected%" equ "No" (
		if exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*%ImageArchitecture%*.msu" expand "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%\Updates" >nul
		if exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.cab" "%Temp%\Updates\%UpdateType%\Updates" >nul
	)
)

echo.解压 .CAB 程序包文件到临时文件夹已完成……
echo.
echo.-------------------------------------------------------------------------------
:: 集成 Windows/WHD 更新包到 WIM 映像
if "%UpdateType%" equ "WUpdates" echo.####正在集成 Windows 更新######################################################
if "%UpdateType%" equ "General" echo.####正在集成 WHD 一般更新######################################################
if "%UpdateType%" equ "Hotfix" echo.####正在集成 WHD 热修复更新####################################################
if "%UpdateType%" equ "Security" echo.####正在集成 WHD 安全更新######################################################
if "%UpdateType%" equ "ESU" echo.####正在集成 WHD 延长安全更新##################################################
if "%UpdateType%" equ "NET35" echo.####正在集成 Microsoft .NET Framework 3.5 更新#################################
if "%UpdateType%" equ "WAT" echo.####正在集成 Windows 激活技术 ^(WAT^) ###########################################
if "%UpdateType%" equ "Windows10" echo.####正在集成 Windows 10 升级准备更新###########################################
if "%UpdateType%" equ "WinPE" echo.####正在集成 Windows PE 更新###################################################
if "%UpdateType%" equ "WUSatisfy" echo.####正在集成 Windows Update Satisfy Updates####################################
if "%UpdateType%" equ "ADLDS" echo.####正在集成 Active Directory 轻型目录服务功能#####################################
if "%UpdateType%" equ "FMApi" echo.####正在集成文件管理 API 功能##################################################
if "%UpdateType%" equ "Features" echo.####正在集成 Windows 功能更新##################################################
if "%UpdateType%" equ "VirtualPC" echo.####正在集成 Microsoft Virtual PC 功能#########################################
if "%UpdateType%" equ "WorkFolders" echo.####正在集成适用于域环境的同步代理 ^(工作文件夹^)################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================

		if "%UpdateType%" equ "WUpdates" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates"

		if "%UpdateType%" equ "General" (
			call :GetImageEdition "%InstallWim%", %%i

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" (
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if exist "%Temp%\Updates\%UpdateType%\WUClient\WUClient*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 7 - Windows 更新客户端更新包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-Core-%ImageArchitecture%-7.6.7600.320.cab"
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-Aux-%ImageArchitecture%-7.6.7600.320.cab"
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\WUClient\WUClient-SelfUpdate-ActiveX-%ImageArchitecture%-7.6.7600.320.cab"
				)
			)

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" (
				echo.
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 7 SP1 便捷汇总先决条件更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB4490628-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 7 SP1 便捷汇总平台更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB2670838-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 7 SP1 便捷汇总更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB3125574-v4-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 7 SP1 2016 年 7 月汇总更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\SP2\Windows6.1-KB3172605-%ImageArchitecture%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WHD 常规更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if "%ImageInstallationType%" neq "Embedded" if exist "%Temp%\Updates\%UpdateType%\Client\*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 7 客户端更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Client"
				)
			)

			if "%SelectedSourceOS%" equ "w81" (
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if exist "%Temp%\Updates\%UpdateType%\Upgrade\*.cab" (
					if "%ImageEdition%" equ "Core" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Windows 8.1 可升级版更新程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "CoreSingleLanguage" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Windows 8.1 可升级版更新程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "CoreCountrySpecific" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Windows 8.1 可升级版更新程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)

					if "%ImageEdition%" equ "Professional" if not exist "%InstallMount%\%%i\Windows\Servicing\Packages\Microsoft-Windows-Security-SPP-Component-SKU-Professional-GVLK-Package*.mum" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Windows 8.1 可升级版更新程序包……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Upgrade"
					)
				)
			)
		)

		if "%UpdateType%" equ "Hotfix" (
			call :GetImageEdition "%InstallWim%", %%i

			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "No" if exist "%Temp%\Updates\%UpdateType%\Ent_Ultimate\*.cab" (
				if "%ImageEdition%" equ "Enterprise" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 7 企业版更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)

				if "%ImageEdition%" equ "Ultimate"  (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 7 旗舰版更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)
			)

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "Yes" if "%ImageInstallationType%" neq "Embedded" if exist "%Temp%\Updates\%UpdateType%\Client\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows 7 客户端更新程序包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Client"
			)
		)

		if "%UpdateType%" equ "Security" (
			call :GetImageEdition "%InstallWim%", %%i >nul
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			:: 应用反 Microsoft 遥测客户端补丁
			call :MountImageRegistry "%InstallMount%\%%i"
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\DiagTrack" /v "Start" /t REG_DWORD /d "4" /f >nul
			Reg delete "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener" /f >nul 2>&1
			Reg delete "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\AutoLogger\SQMLogger" /f >nul 2>&1
			Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f >nul 2>&1
			call :UnMountImageRegistry
		)

		if "%UpdateType%" equ "ESU" (
			set EsuFoundation=
			if "%ImageInstallationType%" equ "Client" set "EsuFoundation=windowsfoundation_31bf3856ad364e35"
			if "%ImageInstallationType%" equ "Embedded" set "EsuFoundation=windowsembe..dfoundation_31bf3856ad364e35"
			if "%ImageInstallationType:~,6%" equ "Server" set "EsuFoundation=windowsserverfoundation_31bf3856ad364e35"

			:: 应用 Windows 7 延长安全更新（ESU）抑制补丁
			echo.
			echo.-------------------------------------------------------------------------------
			echo.应用 Windows 7 延长安全更新 ^(ESU^) 抑制补丁……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%W7ESU%\ESU.tpk", %PackageIndex%, "%InstallMount%\%%i"

			call :MountImageRegistry "%InstallMount%\%%i"

			for /f "tokens=5 delims=\" %%a in ('reg query "HKLM\TK_COMPONENTS\DerivedData\Components" ^| findstr "%ImageArchitecture%_!EsuFoundation!"') do (set "EsuFoundation=%%a")

			if "%ImageArchitecture%" equ "x86" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D7838362C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "S256H" /t REG_BINARY /d "343B7E8DE2FE932E2FA1DB0CDFE69BB648BEE8E834B41728F1C83A12C1766ECB" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_b26c9b4c15d241fc\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			if "%ImageArchitecture%" equ "x64" (
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "identity" /t REG_BINARY /d "4D6963726F736F66742D57696E646F77732D534C432D436F6D706F6E656E742D457874656E64656453656375726974795570646174657341492C2043756C747572653D6E65757472616C2C2056657273696F6E3D362E312E373630332E32353030302C205075626C69634B6579546F6B656E3D333162663338353661643336346533352C2050726F636573736F724172636869746563747572653D616D6436342C2076657273696F6E53636F70653D4E6F6E537853" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "S256H" /t REG_BINARY /d "45D0AE442FD92CE32EE1DDC38EA3B875EAD9A53D6A17155A10FA9D9E16BEDEB2" >nul
				reg add "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /v "c^!!EsuFoundation!" /t REG_BINARY /d "" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /ve /t REG_SZ /d "6.1" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /v "6.1.7603.25000" /t REG_BINARY /d "01" >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228\6.1" /ve /t REG_SZ /d "6.1.7603.25000" >nul
			)

			call :UnMountImageRegistry

			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 7 服务堆栈更新程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB4592510-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 7 延长安全更新许可证准备包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB4575903-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成适用于 .NET Framework 3.5.1 安全和质量汇总程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB4578952-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows 7 安全月度质量汇总更新程序包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Windows6.1-KB5003233-%ImageArchitecture%.cab"

			call :MountImageRegistry "%InstallMount%\%%i"

			if "%ImageArchitecture%" equ "x86" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_6eb019927ae880f2" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\x86_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_b26c9b4c15d241fc" /f >nul 2>&1
			)

			if "%ImageArchitecture%" equ "x64" (
				del /f /q "%InstallMount%\%%i\Windows\WinSxS\Manifests\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228.manifest" > nul
				reg delete "HKLM\TK_COMPONENTS\DerivedData\Components\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_6.1.7603.25000_none_caceb5163345f228" /f >nul 2>&1
				reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners\amd64_microsoft-windows-s..edsecurityupdatesai_31bf3856ad364e35_none_0e8b36cfce2fb332" /f >nul 2>&1
			)

			call :UnMountImageRegistry
		)

		if "%UpdateType%" equ "NET35" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "WAT" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "Windows10" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

		if "%UpdateType%" equ "WinPE" (
			if "%IsBootImageSelected%" equ "Yes" (
				echo.-------------------------------------------------------------------------------
				echo.                  正在集成 Windows PE 更新到 Boot.wim 映像……
				echo.---------------------------------[索引 ：2]------------------------------------
				call :AddPackage "%BootMount%\2", "%Temp%\Updates\%UpdateType%"
			)

			if "%IsRecoveryImageSelected%" equ "Yes" (
				echo.-------------------------------------------------------------------------------
				echo.                  正在集成 Windows PE 更新到 WinRE.wim 映像……
				echo.---------------------------------[索引 ：1]------------------------------------
				call :AddPackage "%WinReMount%", "%Temp%\Updates\%UpdateType%"
			)
		)

		if "%UpdateType%" equ "WUSatisfy" (
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if exist "%Temp%\Updates\%UpdateType%\ProfessionalWMC\*.cab" (
				call :GetImageEdition "%InstallWim%", %%i >nul

				if "%ImageEdition%" equ "ProfessionalWMC" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows 8.1 专业版 ^(含 Media Center^) - Windows Update Satisfy Updates……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\ProfessionalWMC"
				)
			)
		)

		if "%UpdateType%" equ "ADLDS" (
			call :GetImageEdition "%InstallWim%", %%i

			for /d %%j in (Professional, Enterprise, Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

					echo.-------------------------------------------------------------------------------
					echo.正在集成 Active Directory 轻型目录服务更新包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
				)
			)
		)

		if "%UpdateType%" equ "FMApi" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"
		if "%UpdateType%" equ "Features" call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

		if "%UpdateType%" equ "VirtualPC" (
			call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

			if "%IsW7SP1CRUSelected%" equ "No"  if exist "%Temp%\Updates\%UpdateType%\Updates\*.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Microsoft Virtual PC 功能更新……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
			)
		)

		if "%UpdateType%" equ "WorkFolders" (
			call :GetImageEdition "%InstallWim%", %%i

			for /d %%j in (Professional, Enterprise, Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

					if "%IsW7SP1CRUSelected%" equ "No" if exist "%Temp%\Updates\%UpdateType%\Updates\*.cab" (
						echo.-------------------------------------------------------------------------------
						echo.正在集成 Microsoft 工作文件夹功能更新……
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Updates"
					)
				)
			)
		)
	)
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	if "%UpdateType%" equ "WUpdates" echo.正在生成 Windows 更新集成日志文件……
	if "%UpdateType%" equ "General" echo.正在生成 WHD 常规更新集成日志文件……
	if "%UpdateType%" equ "Hotfix" echo.正在生成 WHD 热修复更新集成日志文件……
	if "%UpdateType%" equ "Security" echo.正在生成 WHD 安全更新集成日志文件……
	if "%UpdateType%" equ "ESU" echo.正在生成 WHD 延长安全更新集成日志文件……
	if "%UpdateType%" equ "NET35" echo.正在生成 Microsoft .NET Framework 3.5 更新集成日志文件……
	if "%UpdateType%" equ "WAT" echo.正在生成 Windows 激活技术 ^(WAT^) 集成日志……
	if "%UpdateType%" equ "Windows10" echo.正在生成 Windows 10 升级准备更新集成日志……
	if "%UpdateType%" equ "WinPE" echo.正在生成 Windows PE 更新集成日志……
	if "%UpdateType%" equ "WUSatisfy" echo.正在生成 Windows Update Satisfy Update 集成日志文件……
	if "%UpdateType%" equ "ADLDS" echo.正在生成 Active Directory 轻型目录服务集成日志……
	if "%UpdateType%" equ "FMApi" echo.正在生成文件管理 API 集成日志……
	if "%UpdateType%" equ "Features" echo.正在生成 Windows 功能包集成日志文件……
	if "%UpdateType%" equ "VirtualPC" echo.正在生成 Microsoft Virtual PC 功能集成日志文件……
	if "%UpdateType%" equ "WorkFolders" echo.正在生成工作文件夹集成日志文件……
	echo.-------------------------------------------------------------------------------
	echo.
	if "%UpdateType%" equ "WUpdates" echo.正在写入 Windows 更新集成日志文件。
	if "%UpdateType%" equ "General" echo.正在写入 WHD 常规更新集成日志文件。
	if "%UpdateType%" equ "Hotfix" echo.正在写入 WHD 热修复更新集成日志文件。
	if "%UpdateType%" equ "Security" echo.正在写入 WHD 安全更新集成日志文件。
	if "%UpdateType%" equ "ESU" echo.正在写入 WHD 延长安全更新集成日志文件。
	if "%UpdateType%" equ "NET35" echo.正在写入 Microsoft .NET Framework 3.5 更新集成日志文件。
	if "%UpdateType%" equ "WAT" echo.正在写入 Windows 激活技术集成日志文件。
	if "%UpdateType%" equ "Windows10" echo.正在写入 Windows 10 升级准备更新集成日志文件。
	if "%UpdateType%" equ "WinPE" echo.正在写入 Windows PE 更新集成日志文件。
	if "%UpdateType%" equ "WUSatisfy" echo.正在写入 Windows Update Satisfy Updates 集成日志文件。
	if "%UpdateType%" equ "ADLDS" echo.正在写入 Active Directory 轻型目录服务集成日志文件。
	if "%UpdateType%" equ "FMApi" echo.正在写入文件管理 API 集成日志文件。
	if "%UpdateType%" equ "Features" echo.正在写入 Windows 功能包集成日志文件。
	if "%UpdateType%" equ "VirtualPC" echo.正在写入 Microsoft Virtual PC 功能集成日志文件。
	if "%UpdateType%" equ "WorkFolders" echo.正在写入工作文件夹集成日志文件。

	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" call :GetPackages "%InstallMount%\%%i", "Updates-%%i.txt"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.正在清理临时文件和文件夹……
echo.-------------------------------------------------------------------------------
echo.
:: 清理 Windows/WHD 更新临时文件夹。
if "%UpdateType%" equ "WUpdates" echo.正在清理 Windows 更新临时文件夹。
if "%UpdateType%" equ "General" echo.正在清理 WHD 基线更新临时文件夹。
if "%UpdateType%" equ "Hotfix" echo.正在清理 WHD 热修复更新临时文件夹。
if "%UpdateType%" equ "Security" echo.正在清理 WHD 安全更新临时文件夹。
if "%UpdateType%" equ "ESU" echo.正在清理 WHD 延长安全更新临时文件夹。
if "%UpdateType%" equ "NET35" echo.正在清理 Microsoft .NET Framework 3.5 更新临时文件夹。
if "%UpdateType%" equ "WAT" echo.正在清理 Windows 激活技术临时文件夹。
if "%UpdateType%" equ "Windows10" echo.正在清理 Windows 10 升级准备更新临时文件夹。
if "%UpdateType%" equ "WinPE" echo.正在清理 Windows PE 更新临时文件夹。
if "%UpdateType%" equ "WUSatisfy" echo.正在清理 Windows Update Satisfy Updates 临时文件夹。
if "%UpdateType%" equ "ADLDS" echo.正在清理 Active Directory 轻型目录服务临时文件夹。
if "%UpdateType%" equ "FMApi" echo.正在清理文件管理 API 临时文件夹。
if "%UpdateType%" equ "Features" echo.正在清理 Windows 功能更新临时文件夹。
if "%UpdateType%" equ "VirtualPC" echo.正在清理 Microsoft Virtual PC 功能临时文件夹。
if "%UpdateType%" equ "WorkFolders" echo.正在清理适用于域环境的同步代理临时文件夹。

call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "WUpdates" echo.####集成 Windows 更新已完成####################################################
if "%UpdateType%" equ "General" echo.####集成 WHD 常规更新已完成####################################################
if "%UpdateType%" equ "Hotfix" echo.####集成 WHD 热修复更新已完成##################################################
if "%UpdateType%" equ "Security" echo.####集成 WHD 安全更新已完成####################################################
if "%UpdateType%" equ "ESU" echo.####集成 WHD 延长安全更新已完成################################################
if "%UpdateType%" equ "NET35" echo.####集成 Microsoft .NET Framework 3.5 更新已完成###############################
if "%UpdateType%" equ "WAT" echo.####集成 Windows 激活技术 ^(WAT^) 已完成#########################################
if "%UpdateType%" equ "Windows10" echo.####集成 Windows 10 升级准备更新已完成#########################################
if "%UpdateType%" equ "WinPE" echo.####集成 Windows PE 更新已完成#################################################
if "%UpdateType%" equ "WUSatisfy" echo.####集成 Windows Update Satisfy Updates 已完成#################################
if "%UpdateType%" equ "ADLDS" echo.####集成 Active Directory 轻型目录服务功能#####################################
if "%UpdateType%" equ "FMApi" echo.####集成文件管理 API 功能已完成################################################
if "%UpdateType%" equ "Features" echo.####集成 Windows 功能更新已完成################################################
if "%UpdateType%" equ "VirtualPC" echo.####集成 Microsoft Virtual PC 功能已完成#######################################
if "%UpdateType%" equ "WorkFolders" echo.####集成适用于域环境的同步代理 ^(工作文件夹^) 已完成#############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set IsW7SP1CRUSelected=
set Updates=
set UpdateType=

endlocal

:: 读取已更新的映像信息
call :GetUpdatedImageInformation >nul

:: 返回到集成菜单
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 安装媒介更新模组
::-------------------------------------------------------------------------------------------
:IntWindowsSetupMediaUpdates

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 更新 Windows 安装媒介
echo.===============================================================================
echo.

if "%IsBootImageSelected%" equ "No" (
   echo.Windows 安装程序启动映像尚未选择……
   echo.
   echo.请在选择源文件时选择 Windows 安装程序启动映像……
   pause
   goto :IntWHDUpdatesMenu
)

echo.-------------------------------------------------------------------------------
echo.####正在开始更新 Windows 安装媒介##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在获取 Windows 安装媒介语言设置……
echo.
for /f "tokens=* delims=" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%BootWim%" /Index:2 ^| findstr /i Default') do (set "ImageDefaultLanguage=%%a")
set "ImageDefaultLanguage=%ImageDefaultLanguage:~1,-10%"
echo.已找到 Windows 安装程序媒介语言 ：[%ImageDefaultLanguage%]
echo.
echo.正在复制 Windows 安装媒介更新文件到 ^<DVD^> 文件夹……

:: 创建目录布局
call :CreateFolder "%DVD%"
call :CreateFolder "%DVD%\boot"
call :CreateFolder "%DVD%\efi"
call :CreateFolder "%DVD%\sources"
call :CreateFolder "%DVD%\boot\%ImageDefaultLanguage%"
call :CreateFolder "%DVD%\boot\fonts"
call :CreateFolder "%DVD%\boot\resources"
call :CreateFolder "%DVD%\efi\boot"
call :CreateFolder "%DVD%\efi\microsoft"
call :CreateFolder "%DVD%\efi\microsoft\boot"
call :CreateFolder "%DVD%\efi\microsoft\boot\fonts"
call :CreateFolder "%DVD%\efi\microsoft\boot\resources"
call :CreateFolder "%DVD%\sources\%ImageDefaultLanguage%"
call :CreateFolder "%DVD%\sources\inf"

Copy /Y "%BootMount%\2\Windows\Boot\PCAT\bootmgr" "%DVD%\bootmgr" >nul
Copy /Y "%BootMount%\2\Windows\Boot\EFI\bootmgr.efi" "%DVD%\bootmgr.efi" >nul
Copy /Y "%BootMount%\2\setup.exe" "%DVD%\setup.exe" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\bcd" "%DVD%\boot\bcd" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\boot.sdi" "%DVD%\boot\boot.sdi" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\%ImageDefaultLanguage%\bootfix.bin" "%DVD%\boot\bootfix.bin" >nul
Copy /Y "%BootMount%\2\Windows\System32\bootsect.exe" "%DVD%\boot\bootsect.exe" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\PCAT\etfsboot.com" "%DVD%\boot\etfsboot.com" >nul
Copy /Y "%BootMount%\2\Windows\Boot\PCAT\memtest.exe" "%DVD%\boot\memtest.exe" >nul
Copy /Y "%BootMount%\2\Windows\System32\%ImageDefaultLanguage%\bootsect.exe.mui" "%DVD%\boot\%ImageDefaultLanguage%\bootsect.exe.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\wgl4_boot.ttf" "%DVD%\boot\fonts\wgl4_boot.ttf" >nul
Copy /Y "%BootMount%\2\Windows\Boot\Resources\bootres.dll" "%DVD%\boot\resources\bootres.dll" >nul
rem "%DVD%\efi\boot\bootia32.efi" >nul
rem "%DVD%\efi\microsoft\boot\cdboot.efi" >nul
rem "%DVD%\efi\microsoft\boot\cdboot_noprompt.efi" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\EFI\%ImageDefaultLanguage%\efisys.bin" "%DVD%\efi\microsoft\boot\efisys.bin" >nul
Copy /Y "%BootMount%\2\Windows\Boot\DVD\EFI\%ImageDefaultLanguage%\efisys_noprompt.bin" "%DVD%\efi\microsoft\boot\efisys_noprompt.bin" >nul
Copy /Y "%BootMount%\2\Windows\Boot\EFI\memtest.efi" "%DVD%\efi\microsoft\boot\memtest.efi" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Boot\Fonts\wgl4_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\wgl4_boot.ttf" >nul
rem "%DVD%\efi\microsoft\boot\resources\bootres.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\apppatch\acres.dll" "%DVD%\sources\acres.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\actionqueue.dll" "%DVD%\sources\actionqueue.dll" >nul
rem "%DVD%\sources\adfscomp.dll" >nul
rem "%DVD%\sources\admtv3check.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\aeinv.dll" "%DVD%\sources\aeinv.dll" >nul
rem "%DVD%\sources\alert.gif" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l2-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l2-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l2-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l2-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l3-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l3-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-advapi32-l4-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-advapi32-l4-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-kernel32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-kernel32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-kernel32-l2-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-kernel32-l2-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-ole32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-ole32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-ole32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-ole32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-shlwapi-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-shlwapi-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-shlwapi-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-shlwapi-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-user32-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-user32-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-user32-l1-1-1.dll" "%DVD%\sources\api-ms-win-downlevel-user32-l1-1-1.dll" >nul
Copy /Y "%BootMount%\2\sources\api-ms-win-downlevel-version-l1-1-0.dll" "%DVD%\sources\api-ms-win-downlevel-version-l1-1-0.dll" >nul
Copy /Y "%BootMount%\2\sources\appcompat.xsl" "%DVD%\sources\appcompat.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_bidi.xsl" "%DVD%\sources\appcompat_bidi.xsl" >nul
rem "%DVD%\sources\appcompat_detailed.xsl" >nul
rem "%DVD%\sources\appcompat_detailed_bidi.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_detailed_bidi_txt.xsl" "%DVD%\sources\appcompat_detailed_bidi_txt.xsl" >nul
Copy /Y "%BootMount%\2\sources\appcompat_detailed_txt.xsl" "%DVD%\sources\appcompat_detailed_txt.xsl" >nul
Copy /Y "%BootMount%\2\sources\arunimg.dll" "%DVD%\sources\arunimg.dll" >nul
Copy /Y "%BootMount%\2\sources\arunres.dll" "%DVD%\sources\arunres.dll" >nul
Copy /Y "%BootMount%\2\sources\autorun.dll" "%DVD%\sources\autorun.dll" >nul
rem "%DVD%\sources\background_cli.bmp" >nul
rem "%DVD%\sources\cdplib.mof" >nul
rem "%DVD%\sources\cdplibuninstall.mof" >nul
rem "%DVD%\sources\clustercompliance.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\cmi2migxml.dll" "%DVD%\sources\cmi2migxml.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\cmifw.dll" "%DVD%\sources\cmifw.dll" >nul
Copy /Y "%BootMount%\2\sources\cmisetup.dll" "%DVD%\sources\cmisetup.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\compatctrl.dll" "%DVD%\sources\compatctrl.dll" >nul
Copy /Y "%BootMount%\2\sources\compatprovider.dll" "%DVD%\sources\compatprovider.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\compatresources.dll" "%DVD%\sources\compatresources.dll" >nul
Copy /Y "%BootMount%\2\sources\compliance.ini" "%DVD%\sources\compliance.ini" >nul
rem "%DVD%\sources\compres.dll" >nul
Copy /Y "%BootMount%\2\sources\cryptosetup.dll" "%DVD%\sources\cryptosetup.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\csiagent.dll" "%DVD%\sources\csiagent.dll" >nul
rem "%DVD%\sources\cversion.ini" >nul
rem "%DVD%\sources\db_msftproductionwindowssigningca.cer" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\devinv.dll" "%DVD%\sources\devinv.dll" >nul
Copy /Y "%BootMount%\2\sources\diager.dll" "%DVD%\sources\diager.dll" >nul
Copy /Y "%BootMount%\2\sources\diagnostic.dll" "%DVD%\sources\diagnostic.dll" >nul
Copy /Y "%BootMount%\2\sources\dism.exe" "%DVD%\sources\dism.exe" >nul
Copy /Y "%BootMount%\2\Windows\System32\dismapi.dll" "%DVD%\sources\dismapi.dll" >nul
Copy /Y "%BootMount%\2\sources\dismcore.dll" "%DVD%\sources\dismcore.dll" >nul
Copy /Y "%BootMount%\2\sources\dismcoreps.dll" "%DVD%\sources\dismcoreps.dll" >nul
Copy /Y "%BootMount%\2\sources\dismprov.dll" "%DVD%\sources\dismprov.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\apppatch\drvmain.sdb" "%DVD%\sources\drvmain.sdb" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\drvmain32.sdb" "%DVD%\sources\drvmain32.sdb" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\drvmain64.sdb" "%DVD%\sources\drvmain64.sdb" >nul
rem "%DVD%\sources\drvmainarm.sdb" >nul
Copy /Y "%BootMount%\2\sources\drvmgrtn.dll" "%DVD%\sources\drvmgrtn.dll" >nul
Copy /Y "%BootMount%\2\sources\du.dll" "%DVD%\sources\du.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\WinSxS\x86_microsoft-windows-servicingstack-net_31bf3856ad364e35_6.3.9600.17031_none_d358249e46914d92\firewallofflineapi.dll" "%DVD%\sources\firewallofflineapi.dll" >nul
Copy /Y "%BootMount%\2\sources\folderprovider.dll" "%DVD%\sources\folderprovider.dll" >nul
rem "%DVD%\sources\fveupg.dll" >nul
Copy /Y "%BootMount%\2\sources\hwcompat.dll" "%DVD%\sources\hwcompat.dll" >nul
Copy /Y "%BootMount%\2\sources\hwcompat.txt" "%DVD%\sources\hwcompat.txt" >nul
rem "%DVD%\sources\hwcompatPE.txt" >nul
Copy /Y "%BootMount%\2\sources\hwexclude.txt" "%DVD%\sources\hwexclude.txt" >nul
rem "%DVD%\sources\hwexcludePE.txt" >nul
rem "%DVD%\sources\hypervcomplcheck.dll" >nul
Copy /Y "%BootMount%\2\sources\idwbinfo.txt" "%DVD%\sources\idwbinfo.txt" >nul
rem "%DVD%\sources\iiscomp.dll" >nul
Copy /Y "%BootMount%\2\sources\imagingprovider.dll" "%DVD%\sources\imagingprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\input.dll" "%DVD%\sources\input.dll" >nul
rem "%DVD%\sources\install.exe" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\oobe\installeventres.dll" "%DVD%\sources\installeventres.dll" >nul
rem "%DVD%\sources\installprep.exe" >nul
rem "%DVD%\sources\itgtupg.dll" >nul
Copy /Y "%BootMount%\2\sources\lang.ini" "%DVD%\sources\lang.ini" >nul
Copy /Y "%BootMount%\2\sources\locale.nls" "%DVD%\sources\locale.nls" >nul
Copy /Y "%BootMount%\2\sources\logprovider.dll" "%DVD%\sources\logprovider.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\luainstall.dll" "%DVD%\sources\luainstall.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\migapp.xml" "%DVD%\sources\migapp.xml" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\migcore.dll" "%DVD%\sources\migcore.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\mighost.exe" "%DVD%\sources\mighost.exe" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migisol.dll" "%DVD%\sources\migisol.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\migres.dll" "%DVD%\sources\migres.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\migstore.dll" "%DVD%\sources\migstore.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\migsys.dll" "%DVD%\sources\migsys.dll" >nul
rem "%DVD%\sources\migtestplugin.dll" >nul
Copy /Y "%BootMount%\2\sources\msxml6.dll" "%DVD%\sources\msxml6.dll" >nul
Copy /Y "%BootMount%\2\sources\msxml6r.dll" "%DVD%\sources\msxml6r.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\mxeagent.dll" "%DVD%\sources\mxeagent.dll" >nul
Copy /Y "%BootMount%\2\sources\ndiscompl.dll" "%DVD%\sources\ndiscompl.dll" >nul
Copy /Y "%BootMount%\2\sources\nlsbres.dll" "%DVD%\sources\nlsbres.dll" >nul
Copy /Y "%BootMount%\2\sources\ntdsupg.dll" "%DVD%\sources\ntdsupg.dll" >nul
rem "%DVD%\sources\ntfrsupg.dll" >nul
rem "%DVD%\sources\nxquery.cat" >nul
rem "%DVD%\sources\nxquery.inf" >nul
rem "%DVD%\sources\nxquery.sys" >nul
Copy /Y "%BootMount%\2\sources\offline.xml" "%DVD%\sources\offline.xml" >nul
rem "%DVD%\sources\oscomps.woa.xml" >nul
rem "%DVD%\sources\oscomps.xml" >nul
rem "%DVD%\sources\osfilter.inf" >nul
rem "%DVD%\sources\outofbox_windows_db.bin" >nul
Copy /Y "%BootMount%\2\sources\pnpibs.dll" "%DVD%\sources\pnpibs.dll" >nul
rem "%DVD%\sources\postrollback.exe" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\queryappblock.exe" "%DVD%\sources\queryappblock.exe" >nul
rem "%DVD%\sources\quirks.ait" >nul
rem "%DVD%\sources\rdsupgcheck.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\PolicyDefinitions\reagent.admx" "%DVD%\sources\reagent.admx" >nul
Copy /Y "%BootMount%\2\sources\reagent.dll" "%DVD%\sources\reagent.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\Recovery\reagent.xml" "%DVD%\sources\reagent.xml" >nul
rem "%DVD%\sources\reportgen.dll" >nul
rem "%DVD%\sources\rmsupg.dll" >nul
Copy /Y "%BootMount%\2\sources\rollback.exe" "%DVD%\sources\rollback.exe" >nul
Copy /Y "%BootMount%\2\sources\schema.dat" "%DVD%\sources\schema.dat" >nul
Copy /Y "%BootMount%\2\sources\sdbapiu.dll" "%DVD%\sources\sdbapiu.dll" >nul
Copy /Y "%BootMount%\2\sources\segoeui.ttf" "%DVD%\sources\segoeui.ttf" >nul
Copy /Y "%BootMount%\2\sources\setup.exe" "%DVD%\sources\setup.exe" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\setupcompat.dll" "%DVD%\sources\setupcompat.dll" >nul
rem "%DVD%\sources\setuperror.exe" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.cfg" "%DVD%\sources\setupplatform.cfg" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.dll" "%DVD%\sources\setupplatform.dll" >nul
Copy /Y "%BootMount%\2\sources\setupplatform.exe" "%DVD%\sources\setupplatform.exe" >nul
rem "%DVD%\sources\setupresume.exe" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sfcn.dat" "%DVD%\sources\sfcn.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflcid.dat" "%DVD%\sources\sflcid.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflistw7.dat" "%DVD%\sources\sflistw7.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflistw8.dat" "%DVD%\sources\sflistw8.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflistw8.woa.dat" "%DVD%\sources\sflistw8.woa.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflistwb.dat" "%DVD%\sources\sflistwb.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sflistwb.woa.dat" "%DVD%\sources\sflistwb.woa.dat" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sfpat.inf" "%DVD%\sources\sfpat.inf" >nul
rem "%DVD%\sources\sfpatpg.inf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sfpatw7.inf" "%DVD%\sources\sfpatw7.inf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sfpatw8.inf" "%DVD%\sources\sfpatw8.inf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\sfpatwb.inf" "%DVD%\sources\sfpatwb.inf" >nul
Copy /Y "%BootMount%\2\sources\smiengine.dll" "%DVD%\sources\smiengine.dll" >nul
Copy /Y "%BootMount%\2\sources\spflvrnt.dll" "%DVD%\sources\spflvrnt.dll" >nul
Copy /Y "%BootMount%\2\sources\spprgrss.dll" "%DVD%\sources\spprgrss.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizeng.dll" "%DVD%\sources\spwizeng.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizimg.dll" "%DVD%\sources\spwizimg.dll" >nul
Copy /Y "%BootMount%\2\sources\spwizres.dll" "%DVD%\sources\spwizres.dll" >nul
Copy /Y "%BootMount%\2\sources\sqmapi.dll" "%DVD%\sources\sqmapi.dll" >nul
Copy /Y "%BootMount%\2\sources\ssshim.dll" "%DVD%\sources\ssshim.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\apppatch\sysmain.sdb" "%DVD%\sources\sysmain.sdb" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\sysmain32.sdb" "%DVD%\sources\sysmain32.sdb" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\sysmain64.sdb" "%DVD%\sources\sysmain64.sdb" >nul
rem "%DVD%\sources\telemetry.xsd" >nul
rem "%DVD%\sources\uddicomp.dll" >nul
Copy /Y "%BootMount%\2\sources\unattend.dll" "%DVD%\sources\unattend.dll" >nul
Copy /Y "%BootMount%\2\sources\unbcl.dll" "%DVD%\sources\unbcl.dll" >nul
rem "%DVD%\sources\upgcompat.inf" >nul" >nul
rem "%DVD%\sources\upgdriver.dll" >nul" >nul
Copy /Y "%BootMount%\2\sources\upgloader.dll" "%DVD%\sources\upgloader.dll" >nul
rem "%DVD%\sources\upgradeagent.dll" >nul
rem "%DVD%\sources\upgradeagent.xml" >nul
rem "%DVD%\sources\upgrade_bulk.xml" >nul
rem "%DVD%\sources\upgrade_data.xml" >nul
Copy /Y "%BootMount%\2\sources\upgrade_frmwrk.xml" "%DVD%\sources\upgrade_frmwrk.xml" >nul
Copy /Y "%BootMount%\2\sources\upgreport.dll" "%DVD%\sources\upgreport.dll" >nul
rem "%DVD%\sources\upgwow_bulk.xml" >nul
Copy /Y "%BootMount%\2\sources\uxlib.dll" "%DVD%\sources\uxlib.dll" >nul
Copy /Y "%BootMount%\2\sources\uxlibres.dll" "%DVD%\sources\uxlibres.dll" >nul
Copy /Y "%BootMount%\2\sources\vhdprovider.dll" "%DVD%\sources\vhdprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\w32uiimg.dll" "%DVD%\sources\w32uiimg.dll" >nul
Copy /Y "%BootMount%\2\sources\w32uires.dll" "%DVD%\sources\w32uires.dll" >nul
Copy /Y "%BootMount%\2\sources\warning.gif" "%DVD%\sources\warning.gif" >nul
Copy /Y "%BootMount%\2\sources\wdsclient.dll" "%DVD%\sources\wdsclient.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsclientapi.dll" "%DVD%\sources\wdsclientapi.dll" >nul
Copy /Y "%BootMount%\2\sources\wdscore.dll" "%DVD%\sources\wdscore.dll" >nul
Copy /Y "%BootMount%\2\sources\wdscsl.dll" "%DVD%\sources\wdscsl.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsimage.dll" "%DVD%\sources\wdsimage.dll" >nul
Copy /Y "%BootMount%\2\sources\wdstptc.dll" "%DVD%\sources\wdstptc.dll" >nul
rem "%DVD%\sources\wdsupgcompl.dll" >nul
Copy /Y "%BootMount%\2\sources\wdsutil.dll" "%DVD%\sources\wdsutil.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\wica.dll" "%DVD%\sources\wica.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\wica.ini" "%DVD%\sources\wica.ini" >nul
rem "%DVD%\sources\wicadevicefilters.xml" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\CompatTel\wicainventory.exe" "%DVD%\sources\wicainventory.exe" >nul
rem "%DVD%\sources\wicatel.dll" >nul
Copy /Y "%BootMount%\2\sources\wimprovider.dll" "%DVD%\sources\wimprovider.dll" >nul
Copy /Y "%BootMount%\2\sources\win32ui.dll" "%DVD%\sources\win32ui.dll" >nul
Copy /Y "%BootMount%\2\sources\winsetup.dll" "%DVD%\sources\winsetup.dll" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\apppatch\%ImageDefaultLanguage%\acres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\acres.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\%ImageDefaultLanguage%\actionqueue.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\actionqueue.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\arunres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\arunres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\cmisetup.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\cmisetup.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compatctrl.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\compatprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\compatprovider.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compatresources.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\compres.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\Help\%ImageDefaultLanguage%\credits.rtf" "%DVD%\sources\%ImageDefaultLanguage%\credits.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dism.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\dism.exe.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\%ImageDefaultLanguage%\dismapi.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismapi.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dismcore.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismcore.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\dismprov.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\dismprov.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\%ImageDefaultLanguage%\erofflps.txt" "%DVD%\sources\%ImageDefaultLanguage%\erofflps.txt" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\folderprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\folderprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\imagingprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\imagingprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\input.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\input.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\install.exe.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\oobe\%ImageDefaultLanguage%\installeventres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\installeventres.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\installprep.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\logprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\logprovider.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\%ImageDefaultLanguage%\migcore.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\migcore.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\migwiz\%ImageDefaultLanguage%\migres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\migres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\msxml6r.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\msxml6r.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\nlsbres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\nlsbres.dll.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\oobe\%ImageDefaultLanguage%\oobe_help_opt_in_details.rtf" "%DVD%\sources\%ImageDefaultLanguage%\oobe_help_opt_in_details.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\pnpibs.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\pnpibs.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\postrollback.exe.mui" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\oobe\%ImageDefaultLanguage%\privacy.rtf" "%DVD%\sources\%ImageDefaultLanguage%\privacy.rtf" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\PolicyDefinitions\%ImageDefaultLanguage%\reagent.adml" "%DVD%\sources\%ImageDefaultLanguage%\reagent.adml" >nul
Copy /Y "%InstallMount%\!DefaultIndexNo!\Windows\System32\%ImageDefaultLanguage%\reagent.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\reagent.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\rollback.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\rollback.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\setup.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupcompat.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setuperror.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupplatform.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupresume.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" "%DVD%\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setup_help_whattokeep.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\smiengine.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\smiengine.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\spwizres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\spwizres.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgdriver.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\upgloader.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\upgloader.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgreport.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vofflps.rtf" "%DVD%\sources\%ImageDefaultLanguage%\vofflps.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\w32uires.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\w32uires.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\winsetup.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\winsetup.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\inf\setup.cfg" "%DVD%\sources\inf\setup.cfg" >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####更新 Windows 安装媒介已完成################################################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到集成菜单
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 8.1 Media Center 通用激活令牌到安装映像模组
::-------------------------------------------------------------------------------------------
:IntWMCGActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.           MSMG 工具箱 - 集成 Windows 8.1 Media Center 通用激活令牌
	echo.===============================================================================
	echo.
	echo.
	echo.                            信                 息
	echo.                            =====================
	echo.
	echo.  Windows 8.1 Media Center 通用激活令牌是从未激活的 Windows 8.0 专业版 ^(含 
	echo.  Media Center^) 操作系统通过 Windows 应用商店升级方法升级到的 Windows 8.1 专业
	echo.  版 ^(含 Media Center^) 操作系统中解压的通用令牌数据文件。
	echo.
	echo.  由于 Windows 8.1 专业版操作系统不接受 Windows 8.0 专业版 ^(含 Media Center^) 
	echo.  或 Media Center 附加密钥来安装操作系统，因此这些通用令牌有助于使 Windows 安装
	echo.  程序接受并安装 Windows 8.0 专业版 ^(含 Media Center^) 或 Media Center 附加密钥
	echo.  以进行安装。
	echo.
	echo.  之后，可以通过在线或电话激活的方式直接激活已安装的操作系统。
	echo.
	echo.
	echo.  若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntCustomFeaturesMenu
)

setlocal

cls
echo.===============================================================================
echo.           MSMG 工具箱 - 集成 Windows 8.1 Media Center 通用激活令牌
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 8.1 Media Center 通用激活令牌#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 8.1 Media Center 通用激活令牌#############################
echo.-------------------------------------------------------------------------------
echo.

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if "%ImageEdition%" equ "ProfessionalWMC" call :ApplyImage "%WMCGActTokens%", 1, "%InstallMount%\%%i"
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Windows 8.1 Media Center 通用激活令牌已完成###########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 8.1 预激活数据模组
::-------------------------------------------------------------------------------------------
:IntPreActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                  MSMG 工具箱 - 集成 Windows 8.1 预激活数据
	echo.===============================================================================
	echo.
	echo. MSMG 工具箱允许你将系统激活详细信息集成到 Windows 安装光盘镜像中，以执行系统
	echo. 自动激活，而无需联机激活或电话激活。
	echo.
	echo. 注：当对系统硬件进行任何更改时，此激活状态都将会丢失。
	echo.
	echo.
	echo.
	echo. 要       求：
	echo. -------------
	echo. 1^) Windows 产品密钥
	echo.
	echo. 2^) 来自 Windows 激活系统驱动器的最新预激活令牌文件
	echo.
	echo.    - 文件“data.dat”来自“<%SytemDrive%\Windows\System32\spp\store>”文件夹
	echo.    - 文件“tokens.dat”来自“<%SytemDrive%\Windows\System32\spp\store>”文件夹
	echo.    - 文件“cache.dat”来自“<%SytemDrive%\Windows\System32\spp\store>”文件夹
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :IntCustomFeaturesMenu
)

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows 8.1 预激活数据
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 设置 Windows 预激活详细信息文件夹路径
set "PreActTokens=%PreActTokens%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查 Windows 预激活令牌数据文件是否存在
if not exist "%PreActTokens%\data.dat" if not exist "%PreActTokens%\cache.dat" if not exist "%PreActTokens%\tokens.dat" (
	echo.Windows 预激活令牌数据文件文件夹 ^<Packs\PreActTokens\%SelectedSourceOS%\%ImageArchitecture%^> 是空的
	echo.
	choice /C:YN /N /M "你想要从系统文件夹复制激活文件吗？ [是‘Y’/否‘N’] ："
	if errorlevel 2 (
		echo.
		echo.请复制预激活令牌文件到相应的文件夹……
		goto :Stop
	)
	if errorlevel 1 (
		echo.
		echo.正在从 ^<System32\Spp\store\2.0^> 复制预激活令牌文件
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\data.dat" %PreActTokens% >nul
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\tokens.dat" %PreActTokens% >nul
		Xcopy /O /H /R /K /Y "%SystemRoot%\System32\spp\store\2.0\cache\cache.dat" %PreActTokens% >nul
	)
)

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成 Windows 8.1 预激活数据
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 8.1 预激活数据########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 Windows 8.1 激活产品密钥详细信息##################################
echo.-------------------------------------------------------------------------------
echo.
set /p ProductKey=请输入产品密钥 ^(含‘-’^) ：
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 8.1 预激活数据############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 8.1 产品密钥 [%ProductKey%]……
		echo.-------------------------------------------------------------------------------
		%DISM% /Image:"%InstallMount%\%%i" /Set-ProductKey:%ProductKey%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Windows 8.1 预激活令牌文件……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在复制 Windows 8.1 预激活令牌文件……
		Xcopy /O /H /R /K /Y %PreActTokens%\tokens.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\data.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\cache.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0\cache"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows 8.1 预激活数据已完成##########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set PreActTokens=
set ProductKey=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成终端服务器修补程序模组
::-------------------------------------------------------------------------------------------
:IntCustomTerminalServer

setlocal

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 集成 Microsoft 终端服务器修补程序
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选择的源操作系统设置终端服务器修补程序
set "CustomTerminalServer=%CustomTerminalServer%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查 Microsoft 终端服务器修补程序包文件是否存在
if not exist "%CustomTerminalServer%\termsrv.dll" (
	echo.Microsoft 终端服务器修补程序文件“termsrv.dll”没有找到……
	echo.
	echo.请复制上述文件到 ^<Custom\TerminalServer\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft 终端服务器修补程序##################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft 终端服务器修补程序######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在复制已修补的 Microsoft 终端服务器 [termsrv.dll] 文件……
		echo.-------------------------------------------------------------------------------
		echo.
		%XCopy% %CustomTerminalServer%\*.* "%InstallMount%\%%i\Windows\System32"
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft 终端服务器修补程序注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d "0" /f >nul
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fSingleSessionPerUser" /t REG_DWORD /d "0" /f >nul
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft 终端服务器修补程序已完成####################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomTerminalServer=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成自定义 UxTheme 补丁模组
::-------------------------------------------------------------------------------------------
:IntCustomUxTheme

setlocal

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成自定义 UxTheme 补丁
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选择的源操作系统设置自定义 UxTheme 补丁包文件路径
set "CustomUxTheme=%CustomUxTheme%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查自定义 UxTheme 补丁包文件是否存在
if "%SelectedSourceOS%" equ "w7" (
	for %%i in (themeservice.dll, themeui.dll, uxtheme.dll) do (
		if not exist "%CustomUxTheme%\%%i" (
			echo.自定义 UxTheme 补丁文件“%%i”没有找到……
			echo.
			echo.请复制上述文件到 ^<Custom\UxTheme\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
			goto :Stop
		)
	)
)

:: 检查自定义 UxTheme 补丁包文件是否存在
if "%SelectedSourceOS%" neq "w7" (
	for %%i in (themeui.dll, UXInit.dll, uxtheme.dll) do (
		if not exist "%CustomUxTheme%\%%i" (
			echo.自定义 UxTheme 补丁文件“%%i”没有找到……
			echo.
			echo.请复制上述文件到 ^<Custom\UxTheme\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
			goto :Stop
		)
	)
)
echo.-------------------------------------------------------------------------------
echo.####正在开始集成自定义 UxTheme 补丁############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成自定义 UxTheme 补丁################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制自定义 UxTheme 补丁文件……
		echo.
		%XCopy% %CustomUxTheme%\*.* "%InstallMount%\%%i\Windows\System32"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成自定义 UxTheme 补丁已完成##############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomUxTheme=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成自定义 Windows 恢复映像模组
::-------------------------------------------------------------------------------------------
:IntCustomRecoveryImage

setlocal

cls
echo.===============================================================================
echo.                  MSMG 工具箱 - 集成自定义 Windows 恢复映像
echo.===============================================================================
echo.

:: 检查源 Windows 恢复映像是否已被选择
if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.Windows 恢复映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 恢复映像……
	goto :Stop
)

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选源操作系统设置自定义 Windows 恢复映像文件路径
set "RecoveryImage=%CustomRecoveryImage%\%SelectedSourceOS%\%ImageArchitecture%\winre.wim"

:: 检查自定义 Windows 恢复映像文件是否存在
if not exist "%RecoveryImage%" (
	echo.自定义 Windows 恢复映像文件“winre.wim”没有找到……
	echo.
	echo.请复制上述文件到 ^<Custom\RecoveryImage\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####正在开始集成自定义 Windows 恢复映像########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在卸载已安装的 Windows 恢复映像##########################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.======================[Install.wim，索引 ：%%i -> WinRE.wim]=====================
		if %%i gtr 9 echo.======================[Install.wim，索引 ：%%i -> WinRE.wim]====================
		echo.
		echo.正在复制自定义 Windows 恢复环境 ^(WinRE^) 映像……
		copy /y "%RecoveryImage%" "%InstallMount%\%%i\Windows\System32\Recovery" >nul
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成自定义 Windows 恢复映像已完成##########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set RecoveryImage=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成自定义默认用户帐户图片模组
::-------------------------------------------------------------------------------------------
:IntUAP

setlocal

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 集成自定义默认用户帐户图片
echo.===============================================================================
echo.

:: 根据所选择的源操作系统设置自定义默认用户帐户图片路径
set "UAP=%UAP%\%SelectedSourceOS%"

:: 检查自定义默认用户帐户图片包是否存在
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.自定义默认用户帐户图片包文件“user.bmp”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\UAP\%SelectedSourceOS%^> 文件夹……
		goto :Stop
	)
)

:: 检查自定义默认用户帐户图片包是否存在
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.自定义默认用户帐户图片包文件“user.bmp”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\UAP\%SelectedSourceOS%^> 文件夹……
		goto :Stop
	)
)

:: 检查自定义默认用户帐户图片包是否存在
if "%SelectedSourceOS%" equ "w81" (
	for %%i in (guest.bmp, guest.png, user.bmp, user.png, user-40.png, user-200.png) do (
		if not exist "%UAP%\%%i" (
			echo.自定义默认用户帐户图片包文件“%%i”没有找到……
			echo.
			echo.请复制上述文件到 ^<Packs\UAP\%SelectedSourceOS%^> 文件夹……
			goto :Stop
		)
	)
)

:: 检查自定义默认用户帐户图片包是否存在
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	for %%i in (guest.bmp, guest.png, user.bmp, user.png, user-32.png, user-40.png, user-48.png, user-192.png, user-200.png) do (
		if not exist "%UAP%\%%i" (
			echo.自定义默认用户帐户图片包文件“%%i”没有找到……
			echo.
			echo.请复制上述文件到 ^<Packs\UAP\%SelectedSourceOS%^> 文件夹……
			goto :Stop
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成自定义默认用户帐户图片#########################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成自定义默认用户帐户图片#############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制自定义默认用户帐户图片文件……
		echo.

		if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server Core" (
			if "%ImageInstallationType%" neq "Server" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
			if "%ImageInstallationType%" equ "Server" %XCopy% %UAP%\user.bmp "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
		)

		if "%SelectedSourceOS%" neq "w7" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成自定义默认用户帐户图片已完成###########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set UAP=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成自定义系统文件模组
::-------------------------------------------------------------------------------------------
:IntCustomFiles

setlocal

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 集成自定义系统文件
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

:: 根据所选择的源操作系统设置自定义系统文件路径
set "CustomFiles=%CustomFiles%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查自定义系统文件包文件是否存在
for /f %%i in ('dir /b /s /a:-d "%CustomFiles%\*.*" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.自定义系统文件包文件夹是空的……
		echo.
		echo.请复制上述文件到 ^<Custom\Files\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成自定义系统文件#################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成自定义系统文件#####################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制自定义系统文件……
		echo.
		%XCopy% %CustomFiles%\*.* "%InstallMount%\%%i"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成自定义系统文件已完成###################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomFiles=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成自定义字体模组
::-------------------------------------------------------------------------------------------
:IntCustomFonts

cls
echo.===============================================================================
echo.                         MSMG 工具箱 - 集成自定义字体
echo.===============================================================================
echo.

:: 检查自定义字体包文件是否存在
for /f %%i in ('dir /b /s /a:-d "%CustomFonts%\*.ttf" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.自定义字体包文件夹是空的……
		echo.
		echo.请复制字体文件到 ^<Custom\Fonts^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成自定义字体#####################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成自定义字体#########################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		call :MountImageRegistry "%InstallMount%\%%i"
		PowerShell -Executionpolicy Bypass -File "%Bin%\AddFonts.ps1" -mountPath "%InstallMount%\%%i\Windows\Fonts" -fontsPath "%CustomFonts%"
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成自定义字体已完成#######################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Win32 计算器 Metro 皮肤模组
::-------------------------------------------------------------------------------------------
:IntWin32CalcMetroSkin

setlocal

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Microsoft Win32 计算器 Metro 皮肤
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\Win32Calc"

:: 检查 Microsoft Win32 计算器 Metro 皮肤包文件是否存在
if not exist "%Skins%\Win32Calc.exe.res" (
	echo.Microsoft Win32 计算器 Metro 皮肤包文件“Win32Calc.exe.res”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\Skins\Win32Calc^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Win32 计算器 Metro 皮肤#############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Win32 计算器 Metro 皮肤#################################
echo.-------------------------------------------------------------------------------

copy /y %ResourceHacker% %Temp% >nul

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制 Microsoft Win32 计算器文件到临时文件夹……
		if "%ImageArchitecture%" equ "x86" copy "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc_x.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc64_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" "%Temp%\Win32Calc32_x.exe" >nul
		)

		echo.
		echo.正在应用 Microsoft Win32 计算器 Metro 皮肤到 [Win32Calc.exe] 文件……
		if "%ImageArchitecture%" equ "x86" (
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc_x.exe", "%Temp%\Win32Calc.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc_x.exe"
		)

		if "%ImageArchitecture%" equ "x64" (
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc32_x.exe", "%Temp%\Win32Calc32.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc32_x.exe"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\Win32Calc64_x.exe", "%Temp%\Win32Calc64.exe", "%Skins%\Win32Calc.exe.res" ,,,
			call :RemoveFile "%Temp%\Win32Calc64_x.exe"
		)

		echo.
		echo.正在复制已修复的 Microsoft Win32 计算器文件……
		if "%ImageArchitecture%" equ "x86" move /y "%Temp%\Win32Calc.exe" "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			move /y "%Temp%\Win32Calc64.exe" "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" >nul
			move /y "%Temp%\Win32Calc32.exe" "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" >nul
		)
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"
echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Win32 计算器 Metro 皮肤已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Skins=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 图标皮肤模组
::-------------------------------------------------------------------------------------------
:IntWIconsSkin

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 集成 Windows 图标皮肤
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\Icons"

:: 检查 Windows 图标皮肤包文件是否存在
for %%i in (cmd.exe.res, imageres.dll.res, imagesp1.dll.res, mydocs.dll.res, snippingtool.exe.res, shell32.dll.res, taskmgr.exe.res, win32calc.exe.res, zipfldr.dll.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows 图标皮肤包文件“%%i”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\Skins\Icons^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 图标皮肤##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在处理 Windows 图标皮肤资源##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在复制 Windows 图标资源文件……
copy /y %ResourceHacker% %Temp% >nul

copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\cmd.exe" "%Temp%\cmd.bak" >nul
copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\SnippingTool.exe" "%Temp%\SnippingTool.bak" >nul
if exist "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" "%Temp%\win32calc.bak" >nul

if "%ImageArchitecture%" equ "x64" (
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\cmd.exe" "%Temp%\cmd_wow64.bak" >nul
	if exist "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" "%Temp%\win32calc_wow64.bak" >nul
)

if "%ImageBuild%" leq "17763" (
	copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\imageres.dll" "%Temp%\imageres.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\imagesp1.dll" "%Temp%\imagesp1.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\mydocs.dll" "%Temp%\mydocs.bak" >nul
	rem copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\shell32.dll" "%Temp%\shell32.bak" >nul
	rem copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\taskmgr.exe" "%Temp%\taskmgr.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\System32\zipfldr.dll" "%Temp%\zipfldr.bak" >nul
	
	if "%ImageArchitecture%" equ "x64" (
		copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imageres.dll" "%Temp%\imageres_wow64.bak" >nul
		copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imagesp1.dll" "%Temp%\imagesp1_wow64.bak" >nul
		copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\mydocs.dll" "%Temp%\mydocs_wow64.bak" >nul
		rem copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\taskmgr.exe" "%Temp%\taskmgr_wow64.bak" >nul
		copy "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\zipfldr.dll" "%Temp%\zipfldr_wow64.bak" >nul
	)
	echo.
	echo.正在修补 [\Windows\System32\imageres.dll] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres.bak", "%Temp%\imageres.dll", "%Skins%\imageres.dll.res" ,,,
	call :RemoveFile "%Temp%\imageres.bak"
	echo.正在修补 [\Windows\System32\imagesp1.dll] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1.bak", "%Temp%\imagesp1.dll", "%Skins%\imagesp1.dll.res" ,,,
	call :RemoveFile "%Temp%\imagesp1.bak"
	echo.正在修补 [\Windows\System32\mydocs.dll] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs.bak", "%Temp%\mydocs.dll", "%Skins%\mydocs.dll.res" ,,,
	call :RemoveFile "%Temp%\mydocs.bak"
	rem echo.正在修补 [\Windows\System32\shell32.dll] 文件……
	rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\shell32.bak", "%Temp%\shell32.dll", "%Skins%\shell32.dll.res" ,,,
	rem call :RemoveFile "%Temp%\shell32.bak"
	rem echo.正在修补 [\Windows\System32\taskmgr.exe] 文件……
	rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr.bak", "%Temp%\taskmgr.exe", "%Skins%\taskmgr.exe.res" ,,,
	rem call :RemoveFile "%Temp%\taskmgr.bak"
	echo.正在修补 [\Windows\System32\zipfldr.dll] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr.bak", "%Temp%\zipfldr.dll", "%Skins%\zipfldr.dll.res" ,,,
	call :RemoveFile "%Temp%\zipfldr.bak"

	if "%ImageArchitecture%" equ "x64" (
		echo.正在修补 [\Windows\SysWOW64\imageres.dll] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres_wow64.bak", "%Temp%\imageres_wow64.dll", "%Skins%\imageres.dll.res" ,,,
		call :RemoveFile "%Temp%\imageres_wow64.bak"
		echo.正在修补 [\Windows\SysWOW64\imagesp1.dll] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1_wow64.bak", "%Temp%\imagesp1_wow64.dll", "%Skins%\imagesp1.dll.res" ,,,
		call :RemoveFile "%Temp%\imagesp1_wow64.bak"
		echo.正在修补 [\Windows\SysWOW64\mydocs.dll] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs_wow64.bak", "%Temp%\mydocs_wow64.dll", "%Skins%\mydocs.dll.res" ,,,
		call :RemoveFile "%Temp%\mydocs_wow64.bak"
		rem echo.正在修补 [\Windows\SysWOW64\taskmgr.exe] 文件……
		rem "%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr_wow64.bak", "%Temp%\taskmgr_wow64.exe", "%Skins%\taskmgr.exe.res" ,,,
		rem call :RemoveFile "%Temp%\taskmgr_wow64.bak"
		echo.正在修补 [\Windows\SysWOW64\zipfldr.dll] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr_wow64.bak", "%Temp%\zipfldr_wow64.dll", "%Skins%\zipfldr.dll.res" ,,,
		call :RemoveFile "%Temp%\zipfldr_wow64.bak"
	)
)

echo.正在修补 [\Windows\System32\cmd.exe] 文件……
"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\cmd.bak", "%Temp%\cmd.exe", "%Skins%\cmd.exe.res" ,,,
call :RemoveFile "%Temp%\cmd.bak"
echo.正在修补 [\Windows\System32\SnippingTool.exe] 文件……
"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\SnippingTool.bak", "%Temp%\SnippingTool.exe", "%Skins%\snippingtool.exe.res" ,,,
call :RemoveFile "%Temp%\SnippingTool.bak"

if exist "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" (
	echo.正在修补 [\Windows\System32\win32calc.exe] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\win32calc.bak", "%Temp%\win32calc.exe", "%Skins%\win32calc.exe.res" ,,,
	call :RemoveFile "%Temp%\win32calc.bak"
)

if "%ImageArchitecture%" equ "x64" (
	echo.正在修补 [\Windows\SysWOW64\cmd.exe] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\cmd_wow64.bak", "%Temp%\cmd_wow64.exe", "%Skins%\cmd.exe.res" ,,,
	call :RemoveFile "%Temp%\cmd_wow64.bak"

    if exist "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" (
		echo.正在修补 [\Windows\SysWOW64\win32calc.exe] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\win32calc_wow64.bak", "%Temp%\win32calc_wow64.exe", "%Skins%\win32calc.exe.res" ,,,
		call :RemoveFile "%Temp%\win32calc_wow64.bak"
	)
)

if "%ImageBuild%" geq "18363" (
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imageres.dll.mun" "%Temp%\imageres.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imagesp1.dll.mun" "%Temp%\imagesp1.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\mydocs.dll.mun" "%Temp%\mydocs.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\shell32.dll.mun" "%Temp%\shell32.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\taskmgr.exe.mun" "%Temp%\taskmgr.bak" >nul
	copy "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\zipfldr.dll.mun" "%Temp%\zipfldr.bak" >nul
	echo.
	echo.正在修补 [\Windows\SystemResources\imageres.dll.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imageres.bak", "%Temp%\imageres.dll.mun", "%Skins%\imageres.dll.res" ,,,
	call :RemoveFile "%Temp%\imageres.bak"
	echo.正在修补 [\Windows\SystemResources\imagesp1.dll.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\imagesp1.bak", "%Temp%\imagesp1.dll.mun", "%Skins%\imagesp1.dll.res" ,,,
	call :RemoveFile "%Temp%\imagesp1.bak"
	echo.正在修补 [\Windows\SystemResources\mydocs.dll.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\mydocs.bak", "%Temp%\mydocs.dll.mun", "%Skins%\mydocs.dll.res" ,,,
	call :RemoveFile "%Temp%\mydocs.bak"
	echo.正在修补 [\Windows\SystemResources\shell32.dll.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\shell32.bak", "%Temp%\shell32.dll.mun", "%Skins%\shell32.dll.res" ,,,
	call :RemoveFile "%Temp%\shell32.bak"
	echo.正在修补 [\Windows\SystemResources\taskmgr.exe.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\taskmgr.bak", "%Temp%\taskmgr.exe.mun", "%Skins%\taskmgr.exe.res" ,,,
	call :RemoveFile "%Temp%\taskmgr.bak"
	echo.正在修补 [\Windows\SystemResources\zipfldr.dll.mun] 文件……
	"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\zipfldr.bak", "%Temp%\zipfldr.dll.mun", "%Skins%\zipfldr.dll.res" ,,,
	call :RemoveFile "%Temp%\zipfldr.bak"
)
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 图标皮肤##################################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制已修补的 Windows 图标文件……
		echo.
		echo.正在复制 [\Windows\System32\cmd.exe] 文件……
		copy /y "%Temp%\cmd.exe" "%InstallMount%\%%i\Windows\System32\cmd.exe" >nul
		echo.正在复制 [\Windows\System32\SnippingTool.exe] 文件……
		copy /y "%Temp%\SnippingTool.exe" "%InstallMount%\%%i\Windows\System32\SnippingTool.exe" >nul

		if exist "%InstallMount%\%%i\Windows\System32\win32calc.exe" (
			echo.正在复制 [\Windows\System32\win32calc.exe] 文件……
			copy /y "%Temp%\win32calc.exe" "%InstallMount%\%%i\Windows\System32\win32calc.exe" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.正在复制 [\Windows\SysWOW64\cmd.exe] 文件……
			copy /y "%Temp%\cmd_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\cmd.exe" >nul

			if exist "%InstallMount%\%%i\Windows\SysWOW64\win32calc.exe" (
				echo.正在复制 [\Windows\SysWOW64\win32calc.exe] 文件……
				copy /y "%Temp%\Win32Calc_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" >nul
			)
		)

		if "%ImageBuild%" leq "17763" (
			echo.正在复制 [\Windows\System32\imageres.dll] 文件……
			copy /y "%Temp%\imageres.dll" "%InstallMount%\%%i\Windows\System32\imageres.dll" >nul
			echo.正在复制 [\Windows\System32\imagesp1.dll] 文件……
			copy /y "%Temp%\imagesp1.dll" "%InstallMount%\%%i\Windows\System32\imagesp1.dll" >nul
			echo.正在复制 [\Windows\System32\mydocs.dll] 文件……
			copy /y "%Temp%\mydocs.dll" "%InstallMount%\%%i\Windows\System32\mydocs.dll" >nul
			rem echo.正在复制 [\Windows\System32\shell32.dll] 文件……
			rem copy /y "%Temp%\shell32.dll" "%InstallMount%\%%i\Windows\System32\shell32.dll" >nul
			rem echo.正在复制 [\Windows\System32\taskmgr.exe] 文件……
			rem copy /y "%Temp%\taskmgr.exe" "%InstallMount%\%%i\Windows\System32\taskmgr.exe" >nul
			echo.正在复制 [\Windows\System32\zipfldr.dll] 文件……
			copy /y "%Temp%\zipfldr.dll" "%InstallMount%\%%i\Windows\System32\zipfldr.dll" >nul

			if "%ImageArchitecture%" equ "x64" (
				echo.正在复制 [\Windows\SysWOW64\imageres.dll] 文件……
				copy /y "%Temp%\imageres_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\imageres.dll" >nul
				echo.正在复制 [\Windows\SysWOW64\imagesp1.dll] 文件……
				copy /y "%Temp%\imagesp1_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\imagesp1.dll" >nul
				echo.正在复制 [\Windows\SysWOW64\mydocs.dll] 文件……
				copy /y "%Temp%\mydocs_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\mydocs.dll" >nul
				rem echo.正在复制 [\Windows\SysWOW64\taskmgr.exe] 文件……
				rem copy /y "%Temp%\taskmgr_wow64.exe" "%InstallMount%\%%i\Windows\SysWOW64\taskmgr.exe" >nul
				echo.正在复制 [\Windows\SysWOW64\zipfldr.dll] 文件……
				copy /y "%Temp%\zipfldr_wow64.dll" "%InstallMount%\%%i\Windows\SysWOW64\zipfldr.dll" >nul
			)
		)

		if "%ImageBuild%" geq "18363" (
			echo.正在复制 [\Windows\SystemResources\imageres.dll.mun] 文件……
			copy /y "%Temp%\imageres.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\imageres.dll.mun" >nul
			echo.正在复制 [\Windows\SystemResources\imagesp1.dll.mun] 文件……
			copy /y "%Temp%\imagesp1.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\imagesp1.dll.mun" >nul
			echo.正在复制 [\Windows\SystemResources\mydocs.dll.mun] 文件……
			copy /y "%Temp%\mydocs.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\mydocs.dll.mun" >nul
			echo.正在复制 [\Windows\SystemResources\shell32.dll.mun] 文件……
			copy /y "%Temp%\shell32.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\shell32.dll.mun" >nul
			echo.正在复制 [\Windows\SystemResources\taskmgr.exe.mun] 文件……
			copy /y "%Temp%\taskmgr.exe.mun" "%InstallMount%\%%i\Windows\SystemResources\taskmgr.exe.mun" >nul
			echo.正在复制 [\Windows\SystemResources\zipfldr.dll.mun] 文件……
			copy /y "%Temp%\zipfldr.dll.mun" "%InstallMount%\%%i\Windows\SystemResources\zipfldr.dll.mun" >nul
		)
	)
)

for %%f in (cmd; cmd_wow64; imageres; imageres_wow64; imagesp1; imagesp1_wow64; SnippingTool; SnippingTool_wow64; shell32; shell32_wow64; taskmgr; taskmgr_wow64; Win32Calc; Win32Calc_wow64; zipfldr; zipfldr_wow64; ResourceHacker.exe; ResourceHacker.ini; ResourceHacker.log) do (
   call :RemoveFile "%Temp%\%%f"
   call :RemoveFile "%Temp%\%%f.bak"
   call :RemoveFile "%Temp%\%%f.dll"
   call :RemoveFile "%Temp%\%%f.exe"
   call :RemoveFile "%Temp%\%%f.dll.mun"
   call :RemoveFile "%Temp%\%%f.exe.mun"
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows 图标皮肤已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Skins=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows 照片查看器 Metro 皮肤模组
::-------------------------------------------------------------------------------------------
:IntWPVMetroSkin

setlocal

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 集成 Windows 照片查看器 Metro 皮肤
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\PhotoViewer"

:: 检查 Windows 照片查看器 Metro 皮肤包文件是否存在
for %%i in (PhotoViewer.dll.res, photowiz.dll.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows 照片查看器 Metro 皮肤包文件“%%i”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\Skins\PhotoViewer^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows 照片查看器 Metro 皮肤#################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows 照片查看器 Metro 皮肤#####################################
echo.-------------------------------------------------------------------------------

copy /y %ResourceHacker% %Temp% >nul

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制 Windows 照片查看器文件到临时文件夹……
		if "%ImageArchitecture%" equ "x86" (
			copy "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer64_x.dll" >nul
			copy "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer32_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz64_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\photowiz.dll" "%Temp%\photowiz32_x.dll" >nul
		)

		echo.
		if "%ImageArchitecture%" equ "x86" (
			echo.正在应用 Windows 照片查看器 Metro 皮肤到 [PhotoViewer.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer_x.dll", "%Temp%\PhotoViewer.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer_x.dll"
			echo.
			echo.正在应用 Windows 照片查看器 Metro 皮肤到 [photowiz.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz_x.dll", "%Temp%\photowiz.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz_x.dll"
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.正在应用 Windows 照片查看器 Metro 皮肤到 [PhotoViewer.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer32_x.dll", "%Temp%\PhotoViewer32.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer64_x.dll", "%Temp%\PhotoViewer64.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer64_x.dll"
			echo.
			echo.正在应用 Windows 照片查看器 Metro 皮肤到 [photowiz.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz32_x.dll", "%Temp%\photowiz32.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\photowiz64_x.dll", "%Temp%\photowiz64.dll", "%Skins%\photowiz.dll.res" ,,,
			call :RemoveFile "%Temp%\photowiz64_x.dll"
		)

		echo.
		echo.正在复制已修补的 Windows 照片查看器文件……
		if "%ImageArchitecture%" equ "x86" (
			move /y "%Temp%\PhotoViewer.dll" "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\photowiz.dll" "%InstallMount%\%%i\Windows\System32\photowiz.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			move /y "%Temp%\PhotoViewer64.dll" "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\PhotoViewer32.dll" "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" >nul
			move /y "%Temp%\photowiz64.dll" "%InstallMount%\%%i\Windows\System32\photowiz.dll" >nul
			move /y "%Temp%\photowiz32.dll" "%InstallMount%\%%i\Windows\SysWOW64\photowiz.dll" >nul
		)
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows 照片查看器 Metro 皮肤已完成###################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Skins=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成 Windows Media Player Metro 皮肤模组
::-------------------------------------------------------------------------------------------
:IntWMPMetroSkin

setlocal

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Windows Media Player Metro 皮肤
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "Skins=%Skins%\MediaPlayer"

:: 检查 Windows Media Player Metro 皮肤包文件是否存在
for %%i in (setup_wm.exe.res, wmpconfig.exe.res, wmplayer.exe.res, wmploc.dll.res, wmpshare.exe.res, WMPSideShowGadget.exe.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows Media Player Metro 皮肤包文件“%%i”没有找到……
		echo.
		echo.请复制上述文件到 ^<Packs\Skins\MediaPlayer^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows Media Player Metro 皮肤###############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows Media Player Metro 皮肤###################################
echo.-------------------------------------------------------------------------------

copy /y %ResourceHacker% %Temp% >nul

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制 Windows Media Player 文件到临时文件夹……
		if "%ImageArchitecture%" equ "x86" (
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc64_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" "%Temp%\wmploc32_x.dll" >nul
		)

		echo.
		echo.正在应用 Windows Media Player Metro 皮肤到 [setup_wm.exe] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\setup_wm_x.exe", "%Temp%\setup_wm.exe", "%Skins%\setup_wm.exe.res" ,,,
		call :RemoveFile "%Temp%\setup_wm_x.exe"
		echo.正在应用 Windows Media Player Metro 皮肤到 [wmpconfig.exe] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpconfig_x.exe", "%Temp%\wmpconfig.exe", "%Skins%\wmpconfig.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpconfig_x.exe"
		echo.正在应用 Windows Media Player Metro 皮肤到 [wmplayer.exe] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmplayer_x.exe", "%Temp%\wmplayer.exe", "%Skins%\wmplayer.exe.res" ,,,
		call :RemoveFile "%Temp%\wmplayer_x.exe"
		echo.正在应用 Windows Media Player Metro 皮肤到 [wmpshare.exe] 文件……
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpshare_x.exe", "%Temp%\wmpshare.exe", "%Skins%\wmpshare.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpshare_x.exe"

		if exist "%Temp%\WMPSideShowGadget_x.exe" (
			echo.正在应用 Windows Media Player Metro 皮肤到 [WMPSideShowGadget.exe] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\WMPSideShowGadget_x.exe", "%Temp%\WMPSideShowGadget.exe", "%Skins%\WMPSideShowGadget.exe.res" ,,,
			call :RemoveFile "%Temp%\WMPSideShowGadget_x.exe"
		)

		if "%ImageArchitecture%" equ "x86" (
			echo.正在应用 Windows Media Player Metro 皮肤到 [wmploc.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc_x.dll", "%Temp%\wmploc.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc_x.dll"
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.正在应用 Windows Media Player Metro 皮肤到 [wmploc.dll] 文件……
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc32_x.dll", "%Temp%\wmploc32.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc64_x.dll", "%Temp%\wmploc64.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc64_x.dll"
		)

		echo.
		echo.正在复制已修补的 Windows Media Player 文件……
		move /y "%Temp%\setup_wm.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" >nul
		move /y "%Temp%\wmpconfig.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" >nul
		move /y "%Temp%\wmplayer.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" >nul
		move /y "%Temp%\wmpshare.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" >nul
		if exist "%Temp%\WMPSideShowGadget.exe" move /y "%Temp%\WMPSideShowGadget.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" >nul
		if "%ImageArchitecture%" equ "x86" move /y "%Temp%\wmploc.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc64.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc32.dll" "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" >nul
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Windows Media Player Metro 皮肤已完成#################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Skins=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 移除 Windows 组件菜单模组
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsMenu

:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 组件菜单
	echo.===============================================================================
	echo.
	echo.  [1]   选择 Windows 组件
	echo.
	echo.  [2]   开始移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :RemoveMenu
	if errorlevel 2 goto :RemoveWindowsComponents
	if errorlevel 1 goto :SelectWindowsComponentsMenu
)

:SelectWindowsComponentsMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 组件菜单
	echo.===============================================================================
	echo.
	echo.  [1]   Internet
	echo.
	echo.  [2]   多 媒 体
	echo.
	echo.  [3]   隐    私
	echo.
	echo.  [4]   远程处理
	echo.
	echo.  [5]   系    统
	echo.
	echo.  [6]   系统应用
	echo.
	if "%ImageBuild%" equ "17763" (
		if "%ImageFlag%" equ "EnterpriseS" echo.
		if "%ImageFlag%" equ "EnterpriseSN" echo.
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" echo.  [7]   Windows 应用
	)
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22000" echo.  [7]   Windows 应用
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "请输入你的选项 ："
	if errorlevel 8 goto :RemoveWindowsComponentsMenu
	if errorlevel 7 if "%ImageBuild%" equ "17763" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" goto :RemoveWindowsAppsMenu
	if errorlevel 7 if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22000" goto :RemoveWindowsAppsMenu
	if errorlevel 6 goto :RemoveSystemAppsMenu
	if errorlevel 5 goto :RemoveSystemMenu
	if errorlevel 4 goto :RemoveRemotingMenu
	if errorlevel 3 goto :RemovePrivacyMenu
	if errorlevel 2 goto :RemoveMultimediaMenu
	if errorlevel 1 goto :RemoveInternetMenu
)

:RemoveInternetMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本 Internet 菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 移除 Internet 组件菜单
	echo.===============================================================================
	echo.
	if "%SelectedSourceOS%" equ "w10" (
		echo.  [1] %C_AdobeFlashForWindows% Adobe Flash For Windows
		echo.
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
			echo.  [2] %C_EdgeChromium% Edge Chromium 浏览器
			echo.
		)
		if "%ImageFlag%" equ "EnterpriseS" (
			echo.  [2] %C_InternetExplorer% Internet Explorer
			echo.
			echo.
		)
		if "%ImageFlag%" equ "EnterpriseSN" (
			echo.  [2] %C_InternetExplorer% Internet Explorer
			echo.
			echo.
		)
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
			echo.  [3] %C_InternetExplorer% Internet Explorer
			echo.
		)
	)

	if "%SelectedSourceOS%" equ "w11" (
		echo.  [1] %C_EdgeChromium% Edge Chromium 浏览器
		echo.
		echo.  [2] %C_InternetExplorer% Internet Explorer
		echo.
		echo.
		echo.
	)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有 Internet 组件
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123AX /N /M "请输入你的选项 ："
	if errorlevel 5 goto :SelectWindowsComponentsMenu
	if errorlevel 4 (
		if "%SelectedSourceOS%" equ "w10" set "C_AdobeFlashForWindows=-"
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" set "C_EdgeChromium=-"
		set "C_InternetExplorer=-"
	)
	if errorlevel 3 if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w11" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "EnterpriseSN" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "EnterpriseS" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( if "%C_EdgeChromium%" equ "+" ( set "C_EdgeChromium=-" ) else ( set "C_EdgeChromium=+" ) )
	if errorlevel 1 if "%SelectedSourceOS%" equ "w11" ( if "%C_EdgeChromium%" equ "+" ( set "C_EdgeChromium=-" ) else ( set "C_EdgeChromium=+" ) )
	if errorlevel 1 if "%SelectedSourceOS%" equ "w10" ( if "%C_AdobeFlashForWindows%" equ "+" ( set "C_AdobeFlashForWindows=-" ) else ( set "C_AdobeFlashForWindows=+" ) )

	goto :RemoveInternetMenu
)

:RemoveMultimediaMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本多媒体菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                      MSMG 工具箱 - 移除多媒体组件菜单
	echo.===============================================================================
	echo.
	echo.  [1] %C_FirstLogonAnimation% 首次登录动画
	echo.  [2] %C_GameExplorer% 游戏浏览器 ^| 需要：Microsoft 游戏
	if "%SelectedSourceOS%" equ "w10" echo.  [3] %C_SnippingTool% 截图工具
	echo.  [4] %C_SpeechRecognition% 语音识别 ^| 需要：Cortana
	echo.  [5] %C_WindowsMediaPlayer% Windows Media Player
	echo.  [6] %C_WindowsPhotoViewer% Windows 照片查看器
	echo.  [7] %C_WinSAT% Windows 系统评估工具
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有多媒体组件
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567AX /N /M "请输入你的选项 ："
	if errorlevel 9 goto :SelectWindowsComponentsMenu
	if errorlevel 8 (
		set "C_Cortana=-"
		set "C_FirstLogonAnimation=-"
		set "C_GameExplorer=-"
		if "%SelectedSourceOS%" equ "w10" set "C_SnippingTool=-"
		set "C_SpeechRecognition=-"
		set "C_WindowsMediaPlayer=-"
		set "C_WindowsPhotoViewer=-"
		set "C_WinSAT=-"
	)
	if errorlevel 7 ( if "%C_WinSAT%" equ "+" ( set "C_WinSAT=-" ) else ( set "C_WinSAT=+" ) )
	if errorlevel 6 ( if "%C_WindowsPhotoViewer%" equ "+" ( set "C_WindowsPhotoViewer=-" ) else ( set "C_WindowsPhotoViewer=+" ) )
	if errorlevel 5 ( if "%C_WindowsMediaPlayer%" equ "+" ( set "C_WindowsMediaPlayer=-" ) else ( set "C_WindowsMediaPlayer=+" ) )
	if errorlevel 4 (
		if "%C_SpeechRecognition%" equ "+" ( 
			set "C_Cortana=-"
			set "C_SpeechRecognition=-"
		) else ( 
			set "C_SpeechRecognition=+"
		)
	)
	if errorlevel 3 if "%SelectedSourceOS%" equ "w10" ( if "%C_SnippingTool%" equ "+" ( set "C_SnippingTool=-" ) else ( set "C_SnippingTool=+" ) )
	if errorlevel 2 ( if "%C_GameExplorer%" equ "+" ( set "C_GameExplorer=-" ) else  ( set "C_GameExplorer=+" ) )
	if errorlevel 1 ( if "%C_FirstLogonAnimation%" equ "+" ( set "C_FirstLogonAnimation=-" ) else  ( set "C_FirstLogonAnimation=+" ) )

	goto :RemoveMultimediaMenu
)

:RemovePrivacyMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本隐私菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                        MSMG 工具箱 - 移除隐私组件菜单
	echo.===============================================================================
	echo.
	echo.  [A] %C_AssignedAccess% 分配的访问权限
	echo.  [B] %C_CEIP% 客户体验改善计划 ^(CEIP^)
	echo.  [C] %C_FaceRecognition% 面部识别
	echo.  [D] %C_KernelDebugging% 内核调试 ^| 依赖于：Windows 错误报告
	echo.  [E] %C_LocationService% 定位服务
	echo.  [F] %C_PicturePassword% 图片密码
	echo.  [G] %C_PinEnrollment% Pin 登录支持
	echo.  [H] %C_UnifiedTelemetryClient% 统一遥测客户端 ^(Asimov^) ^| 依赖于：Windows 错误报告
	echo.  [I] %C_WiFiNetworkManager% WiFi Network Manager ^(WiFi 感知^)
	if "%ImageBuild%" equ "17763" echo.  [J] %C_WindowsErrorReporting% Windows 错误报告
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.  [J] %C_WindowsErrorReporting% Windows 错误报告 ^| 需要：全新安装体验
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" echo.  [J] %C_WindowsErrorReporting% Windows 错误报告
	echo.  [K] %C_WindowsInsiderHub% Windows 会员中心
	echo.
	echo.
	echo.  [1]   所有隐私组件
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJK1X /N /M "请输入你的选项 ："
	if errorlevel 13 goto :SelectWindowsComponentsMenu
	if errorlevel 12 (
		set "C_AssignedAccess=-"
		set "C_AssignedAccessLockApp=-"
		set "C_CEIP=-"
		set "C_FaceRecognition=-"
		set "C_KernelDebugging=-"
		set "C_LocationService=-"
		set "C_PicturePassword=-"
		set "C_PinEnrollment=-"
		set "C_UnifiedTelemetryClient=-"
		set "C_WiFiNetworkManager=-"
		set "C_WindowsErrorReporting=-"
		set "C_WindowsInsiderHub=-"
	)
	if errorlevel 11 ( if "%C_WindowsInsiderHub%" equ "+" ( set "C_WindowsInsiderHub=-" ) else ( set "C_WindowsInsiderHub=+" ) )
	if errorlevel 10 ( 
		if "%C_WindowsErrorReporting%" equ "+" ( 
			set "C_KernelDebugging=-"
			set "C_UnifiedTelemetryClient=-"
			set "C_WindowsErrorReporting=-"
		) else ( 
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 9  ( if "%C_WiFiNetworkManager%" equ "+" ( set "C_WiFiNetworkManager=-" ) else ( set "C_WiFiNetworkManager=+" ) )
	if errorlevel 8 ( 
		if "%C_UnifiedTelemetryClient%" equ "+" ( 
			set "C_UnifiedTelemetryClient=-"
		) else ( 
			set "C_UnifiedTelemetryClient=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 7  ( if "%C_PinEnrollment%" equ "+" ( set "C_PinEnrollment=-" ) else ( set "C_PinEnrollment=+" ) )
	if errorlevel 6  ( if "%C_PicturePassword%" equ "+" ( set "C_PicturePassword=-" ) else ( set "C_PicturePassword=+" ) )
	if errorlevel 5  ( if "%C_LocationService%" equ "+" ( set "C_LocationService=-" ) else ( set "C_LocationService=+" ) )
	if errorlevel 4 ( 
		if "%C_KernelDebugging%" equ "+" ( 
			set "C_KernelDebugging=-"
		) else ( 
			set "C_KernelDebugging=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 3  ( if "%C_FaceRecognition%" equ "+" ( set "C_FaceRecognition=-" ) else ( set "C_FaceRecognition=+" ) )
	if errorlevel 2  ( if "%C_CEIP%" equ "+" ( set "C_CEIP=-" ) else ( set "C_CEIP=+" ) )
	if errorlevel 1 ( 
		if "%C_AssignedAccess%" equ "+" ( 
			set "C_AssignedAccess=-"
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
		)
	)

	goto :RemovePrivacyMenu
)

:RemoveRemotingMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本远程处理菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除远程处理组件菜单
	echo.===============================================================================
	echo.
	if "%SelectedSourceOS%" equ "w10" (
		echo.  [1] %C_HomeGroup% 家庭组
		echo.
		echo.  [2] %C_MultiPointConnector% MultiPoint Connector
		echo.
		echo.  [3] %C_RemoteAssistance% 远程协助
	)

	if "%SelectedSourceOS%" equ "w11" (
		echo.  [1] %C_MultiPointConnector% MultiPoint Connector
		echo.
		echo.  [2] %C_RemoteAssistance% 远程协助		
	)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有远程处理组件
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:123AX /N /M "请输入你的选项 ："
	if errorlevel 5 goto :SelectWindowsComponentsMenu
	if errorlevel 4 (
		if "%SelectedSourceOS%" equ "w10" set "C_HomeGroup=-"
		set "C_MultiPointConnector=-"
		set "C_RemoteAssistance=-"
	)
	if errorlevel 3 if "%SelectedSourceOS%" equ "w10" ( if "%C_RemoteAssistance%" equ "+" ( set "C_RemoteAssistance=-" ) else ( set "C_RemoteAssistance=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w11" ( if "%C_RemoteAssistance%" equ "+" ( set "C_RemoteAssistance=-" ) else ( set "C_RemoteAssistance=+" ) )
	if errorlevel 2 if "%SelectedSourceOS%" equ "w10" ( if "%C_MultiPointConnector%" equ "+" ( set "C_MultiPointConnector=-" ) else ( set "C_MultiPointConnector=+" ) )
	if errorlevel 1 if "%SelectedSourceOS%" equ "w11" ( if "%C_MultiPointConnector%" equ "+" ( set "C_MultiPointConnector=-" ) else ( set "C_MultiPointConnector=+" ) )
	if errorlevel 1 if "%SelectedSourceOS%" equ "w10" ( if "%C_HomeGroup%" equ "+" ( set "C_HomeGroup=-" ) else ( set "C_HomeGroup=+" ) )

	goto :RemoveRemotingMenu
)

:RemoveSystemMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本系统菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统组件菜单
	echo.===============================================================================
	echo.  [A] %C_DeviceLockdown% 设备锁定 ^(嵌入式体验^)
	echo.  [B] %C_EaseOfAccessThemes% 轻松访问主题
	echo.  [C] %C_EasyTransfer% 轻松传送
	echo.  [D] %C_FileHistory% 文件历史记录
	echo.  [E] %C_ManualSetup% 手动安装程序 ^(就地升级^)
	if "%SelectedSourceOS%" equ "w10" echo.  [F] %C_Paint% 画图
	echo.  [G] %C_SecurityCenter% 安全中心 ^| 依赖于：Windows Defender
	echo.  [H] %C_StepsRecorder% 步骤记录器
	echo.  [I] %C_SystemRestore% 系统恢复 ^| 依赖于：Windows 备份
	echo.  [J] %C_WindowsBackup% Windows 备份
	echo.  [K] %C_WindowsFirewall% Windows 防火墙
	echo.  [L] %C_WindowsSubsystemForLinux% 适用于 Linux 的 Windows 子系统
	echo.  [M] %C_WindowsToGo% Windows To Go
	echo.  [N] %C_Wordpad% 写字板
	echo.
	if "%SelectedSourceOS%" equ "w11" echo.
	echo.  [1]   所有系统组件
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "请输入你的选项 ："
	if errorlevel 16 goto :SelectWindowsComponentsMenu
	if errorlevel 15 (
		set "C_DeviceLockdown=-"
		set "C_EaseOfAccessThemes=-"
		set "C_EasyTransfer=-"
		set "C_FileHistory=-"
		set "C_ManualSetup=-"
		if "%SelectedSourceOS%" equ "w10" set "C_Paint=-"
		set "C_SecurityCenter=-"
		set "C_StepsRecorder=-"
		set "C_SystemRestore=-"
		set "C_WindowsBackup=-"
		set "C_WindowsFirewall=-"
		set "C_WindowsSubsystemForLinux=-"
		set "C_WindowsToGo=-"
		set "C_Wordpad=-"
	)
	if errorlevel 14 ( if "%C_Wordpad%" equ "+" ( set "C_Wordpad=-" ) else ( set "C_Wordpad=+" ) )
	if errorlevel 13 ( if "%C_WindowsToGo%" equ "+" ( set "C_WindowsToGo=-" ) else ( set "C_WindowsToGo=+" ) )
	if errorlevel 12 ( if "%C_WindowsSubsystemForLinux%" equ "+" ( set "C_WindowsSubsystemForLinux=-" ) else ( set "C_WindowsSubsystemForLinux=+" ) )
	if errorlevel 11 ( if "%C_WindowsFirewall%" equ "+" ( set "C_WindowsFirewall=-" ) else ( set "C_WindowsFirewall=+" ) )
	if errorlevel 10 ( 
		if "%C_WindowsBackup%" equ "+" ( 
			set "C_SystemRestore=-"
			set "C_WindowsBackup=-"
		) else ( 
			set "C_WindowsBackup=+"
		)
	)
	if errorlevel 9 ( 
		if "%C_SystemRestore%" equ "+" ( 
			set "C_SystemRestore=-"
		) else ( 
			set "C_SystemRestore=+"
			set "C_WindowsBackup=+"
		)
	)
	if errorlevel 8 ( if "%C_StepsRecorder%" equ "+" ( set "C_StepsRecorder=-" ) else ( set "C_StepsRecorder=+" ) )
	if errorlevel 7 (
		if "%C_SecurityCenter%" equ "+" ( 
			set "C_SecurityCenter=-"
		) else ( 
			set "C_SecurityCenter=+"
			set "C_WindowsDefender=+"
		)
	)
	if errorlevel 6 if "%SelectedSourceOS%" equ "w10" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
	if errorlevel 5 ( if "%C_ManualSetup%" equ "+" ( set "C_ManualSetup=-" ) else ( set "C_ManualSetup=+" ) )
	if errorlevel 4 ( if "%C_FileHistory%" equ "+" ( set "C_FileHistory=-" ) else ( set "C_FileHistory=+" ) )
	if errorlevel 3 ( if "%C_EasyTransfer%" equ "+" ( set "C_EasyTransfer=-" ) else ( set "C_EasyTransfer=+" ) )
	if errorlevel 2 ( if "%C_EaseOfAccessThemes%" equ "+" ( set "C_EaseOfAccessThemes=-" ) else ( set "C_EaseOfAccessThemes=+" ) )
	if errorlevel 1 ( if "%C_DeviceLockdown%" equ "+" ( set "C_DeviceLockdown=-" ) else ( set "C_DeviceLockdown=+" ) )

	goto :RemoveSystemMenu
)

:RemoveSystemAppsMenu
:: 移除 Windows 10 企业版（N）LTSC 2019 客户端版本系统应用菜单
if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" if "%ImageFlag%" neq "Education" if "%ImageFlag%" neq "EducationN" if "%ImageFlag%" neq "Enterprise" if "%ImageFlag%" neq "EnterpriseN" if "%ImageFlag%" neq "Professional" if "%ImageFlag%" neq "ProfessionalN" if "%ImageFlag%" neq "ProfessionalEducation" if "%ImageFlag%" neq "ProfessionalEducationN" if "%ImageFlag%" neq "ProfessionalWorkstation" if "%ImageFlag%" neq "ProfessionalWorkstationN" if "%ImageFlag%" neq "ServerRdsh" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统应用菜单
	echo.===============================================================================
	echo.  [01] %C_AccountsControl% 帐户控制 ^| 需要：Windows 应用商店
	echo.  [02] %C_AssignedAccessLockApp% 指定访问锁定应用 ^| 依赖于：分配的访问权限
	echo.  [03] %C_AsyncTextService% Async Text 服务
	echo.  [04] %C_AADBrokerPlugin% Azure Active Directory AppX 代理插件 ^| 需要：Microsoft 帐户、Windows 应用商店
	echo.  [05] %C_BioEnrollment% Windows Hello 安装程序
	echo.  [06] %C_CapturePicker% Capture Picker
	echo.  [07] %C_CBSPreview% Camera Barcode Scanner
	echo.  [08] %C_ContentDeliveryManager% Content Delivery Manager ^| 需要：全新安装体验
	echo.  [09] %C_Cortana% Cortana、开始菜单和设置搜索应用 ^| 依赖于：语音识别
	echo.  [10] %C_CredDialogHost% Credential Dialog 主机
	echo.  [11] %C_EdgeDevToolsClient% Edge 开发者工具客户端
	echo.  [12] %C_ECApp% 目视控制应用
	echo.  [13] %C_FileExplorer% 现代文件资源管理器应用
	echo.  [14] %C_LockApp% 锁屏应用
	echo.  [15] %C_MapControl% 地图控件
	echo.  [16] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [17] %C_OOBENetworkCaptivePortal% OOBE Network Captive Portal
	echo.  [18] %C_OOBENetworkConnectionFlow% OOBE 网络连接流
	echo.  [19] %C_ParentalControls% 家长控制应用
	echo.  [20] %C_PeopleExperienceHost% 人脉栏
	echo.  [21] %C_QuickAssist% 快速助手应用
	echo.  [22] %C_RetailDemoContent% 零售演示内容
	echo.  [23] %C_SettingSync% 设置同步
	echo.  [24] %C_SkypeORTC% Skype ORTC
	echo.  [25] %C_SmartScreen% Smart Screen
	echo.  [26] %C_Win32WebViewHost% Win32 Web View 主机
	echo.  [27] %C_WindowsDefender% Windows Defender 应用
	echo.  [28] %C_WindowsMixedReality% Windows 混合现实
	echo.  [29] %C_WindowsReaderPDF% Windows 阅读器 ^(PDF^)
	echo   [30] %C_WindowsStoreClient% Windows 应用商店后台客户端
	echo   [31] %C_XboxClient% Xbox 主机小帮手后台客户端
	echo.  [32] %C_XboxGameCallableUI% Xbox Live ^(XboxGameCallableUI^)
	echo.  [33] %C_XGpuEjectDialog% 现代外部 GPU 弹出应用 ^(XGpuEjectDialog^)
	echo.
	echo.  [A]    所有系统应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
	if "!MenuChoice!" equ "02" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_CapturePicker%" equ "+" ( set "C_CapturePicker=-" ) else ( set "C_CapturePicker=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "09" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "10" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_EdgeDevToolsClient%" equ "+" ( set "C_EdgeDevToolsClient=-" ) else ( set "C_EdgeDevToolsClient=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_MapControl%" equ "+" ( set "C_MapControl=-" ) else ( set "C_MapControl=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OOBENetworkCaptivePortal%" equ "+" ( set "C_OOBENetworkCaptivePortal=-" ) else ( set "C_OOBENetworkCaptivePortal=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OOBENetworkConnectionFlow%" equ "+" ( set "C_OOBENetworkConnectionFlow=-" ) else ( set "C_OOBENetworkConnectionFlow=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_PeopleExperienceHost%" equ "+" ( set "C_PeopleExperienceHost=-" ) else ( set "C_PeopleExperienceHost=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "25" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "27" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "28" ( if "%C_WindowsMixedReality%" equ "+" ( set "C_WindowsMixedReality=-" ) else ( set "C_WindowsMixedReality=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_WindowsReaderPDF%" equ "+" ( set "C_WindowsReaderPDF=-" ) else ( set "C_WindowsReaderPDF=+" ) )
	if "!MenuChoice!" equ "30" ( if "%C_WindowsStoreClient%" equ "+" ( set "C_WindowsStoreClient=-" ) else ( set "C_WindowsStoreClient=+" ) )
	if "!MenuChoice!" equ "31" ( if "%C_XboxClient%" equ "+" ( set "C_XboxClient=-" ) else ( set "C_XboxClient=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_XboxGameCallableUI%" equ "+" ( set "C_XboxGameCallableUI=-" ) else ( set "C_XboxGameCallableUI=+" ) )
	if "!MenuChoice!" equ "33" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_AADBrokerPlugin=-"
		set "C_AccountsControl=-"
		set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		set "C_BioEnrollment=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_NarratorQuickStart=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_PeopleExperienceHost=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_WindowsStoreClient=-"
		set "C_XboxClient=-"
		set "C_XboxGameCallableUI=-"
		set "C_XGpuEjectDialog=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 移除 Windows 10 v1809 非企业版（N）LTSC 2019 客户端版本系统应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统应用菜单
	echo.===============================================================================
	echo.  [01] %C_AccountsControl% 帐户控制 ^| 需要：Windows 应用商店
	echo.  [02] %C_AssignedAccessLockApp% 指定访问锁定应用 ^| 依赖于：分配的访问权限
	echo.  [03] %C_AsyncTextService% Async Text 服务
	echo.  [04] %C_AADBrokerPlugin% Azure Active Directory AppX 代理插件 ^| 需要：Microsoft 帐户、Windows 应用商店
	echo.  [05] %C_BioEnrollment% Windows Hello 安装程序
	echo.  [06] %C_CapturePicker% Capture Picker
	echo.  [07] %C_CBSPreview% Camera Barcode Scanner
	echo.  [08] %C_PPIProjection% 连接应用
	echo.  [09] %C_ContentDeliveryManager% Content Delivery Manager ^| 需要：全新安装体验
	echo.  [10] %C_Cortana% Cortana、开始菜单和设置搜索应用 ^| 依赖于：语音识别
	echo.  [11] %C_Edge% Edge 经典浏览器
	echo.  [12] %C_CredDialogHost% Credential Dialog 主机
	echo.  [13] %C_EdgeDevToolsClient% Edge 开发者工具客户端
	echo.  [14] %C_ECApp% 目视控制应用
	echo.  [15] %C_FileExplorer% 文件资源管理器应用
	echo.  [16] %C_LockApp% 锁屏应用
	echo.  [17] %C_MapControl% 地图控件
	echo.  [18] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [19] %C_OneDrive% OneDrive 桌面客户端
	echo.  [20] %C_OOBENetworkCaptivePortal% OOBE Network Captive Portal
	echo.  [21] %C_OOBENetworkConnectionFlow% OOBE 网络连接流
	echo.  [22] %C_ParentalControls% 家长控制应用
	echo.  [23] %C_PeopleExperienceHost% 人脉栏
	echo.  [24] %C_QuickAssist% 快速助手应用
	echo.  [25] %C_RetailDemoContent% 零售演示内容
	echo.  [26] %C_SettingSync% 设置同步
	echo.  [27] %C_SkypeORTC% Skype ORTC
	echo.  [28] %C_SmartScreen% Smart Screen
	echo.  [29] %C_SecureAssessmentBrowser% Take Test 应用
	echo.  [30] %C_Win32WebViewHost% Win32 Web View 主机
	echo.  [31] %C_WindowsDefender% Windows Defender 应用
	echo.  [32] %C_WindowsMixedReality% Windows 混合现实
	echo.  [33] %C_WindowsReaderPDF% Windows 阅读器 ^(PDF^) ^| 依赖于：Edge 经典浏览器
	echo   [34] %C_WindowsStoreClient% Windows 应用商店后台客户端
	echo   [35] %C_XboxClient% Xbox 主机小帮手后台客户端
	echo.  [36] %C_XboxGameCallableUI% Xbox Live ^(XboxGameCallableUI^)
	echo.  [37] %C_XGpuEjectDialog% 现代外部 GPU 弹出应用 ^(XGpuEjectDialog^)
	echo.
	echo.  [A]    所有系统应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
	if "!MenuChoice!" equ "02" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_CapturePicker%" equ "+" ( set "C_CapturePicker=-" ) else ( set "C_CapturePicker=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "10" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "13" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "17" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "18" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_OOBENetworkCaptivePortal%" equ "+" ( set "C_OOBENetworkCaptivePortal=-" ) else ( set "C_OOBENetworkCaptivePortal=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_OOBENetworkConnectionFlow%" equ "+" ( set "C_OOBENetworkConnectionFlow=-" ) else ( set "C_OOBENetworkConnectionFlow=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "23" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "24" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "25" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "30" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "31" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "32" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			set "C_3DViewer=-"
			if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "33" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "34" (
		if "%C_WindowsStoreClient%" equ "+" (
			set "C_ServicesStoreEngagement=-"
			set "C_SolitaireCollection=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
			set "C_WindowsStoreClient=-"
		) else (
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "35" (
		if "%C_XboxClient%" equ "+" (
 			set "C_XboxApp=-"
			set "C_XboxClient=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "36" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "37" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AccountsControl=-"
		set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		set "C_BioEnrollment=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_PPIProjection=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_ServicesStoreEngagement=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_SolitaireCollection=-"
		set "C_StorePurchaseApp=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_WindowsStoreApp=-"
		set "C_WindowsStoreClient=-"
 		set "C_XboxApp=-"
		set "C_XboxClient=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_XboxGameCallableUI=-"
		set "C_XGpuEjectDialog=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 移除 Windows 10 v1903/v1909 客户端版本系统应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统应用菜单
	echo.===============================================================================
	echo.  [01] %C_AccountsControl% 帐户控制 ^| 需要：Windows 应用商店
	echo.  [02] %C_AssignedAccessLockApp% 指定访问锁定应用 ^| 依赖于：分配的访问权限
	echo.  [03] %C_AsyncTextService% Async Text 服务
	echo.  [04] %C_AADBrokerPlugin% Azure Active Directory AppX 代理插件 ^| 需要：Microsoft 帐户、Windows 应用商店
	echo.  [05] %C_BioEnrollment% Windows Hello 安装程序
	echo.  [06] %C_CallingShellApp% Calling Shell 应用
	echo.  [07] %C_CapturePicker% Capture Picker
	echo.  [08] %C_CBSPreview% Camera Barcode Scanner
	echo.  [09] %C_PPIProjection% 连接应用
	echo.  [10] %C_ContentDeliveryManager% Content Delivery Manager ^| 需要：全新安装体验
	echo.  [11] %C_Cortana% Cortana、开始菜单和设置搜索应用 ^| 依赖于：语音识别
	echo.  [12] %C_CredDialogHost% Credential Dialog 主机
	echo.  [13] %C_Edge% Edge 经典浏览器
	echo.  [14] %C_EdgeDevToolsClient% Edge 开发者工具客户端 ^| 依赖于：Edge 经典浏览器
	echo.  [15] %C_ECApp% 目视控制应用
	echo.  [16] %C_FileExplorer% 文件资源管理器应用
	echo.  [17] %C_LockApp% 锁屏应用
	echo.  [18] %C_MapControl% 地图控件
	echo.  [19] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [20] %C_OneDrive% OneDrive 桌面客户端
	echo.  [21] %C_OOBENetworkCaptivePortal% OOBE Network Captive Portal
	echo.  [22] %C_OOBENetworkConnectionFlow% OOBE 网络连接流
	echo.  [23] %C_ParentalControls% 家长控制应用
	echo.  [24] %C_PeopleExperienceHost% 人脉栏
	echo.  [25] %C_QuickAssist% 快速助手应用
	echo.  [26] %C_RetailDemoContent% 零售演示内容
	echo.  [27] %C_SettingSync% 设置同步
	echo.  [28] %C_SkypeORTC% Skype ORTC
	echo.  [29] %C_SmartScreen% Smart Screen
	echo.  [30] %C_SecureAssessmentBrowser% Take Test 应用
	echo.  [31] %C_Win32WebViewHost% Win32 Web View 主机
	echo.  [32] %C_WindowsDefender% Windows Defender 应用
	echo.  [33] %C_WindowsMixedReality% Windows 混合现实
	echo.  [34] %C_WindowsReaderPDF% Windows 阅读器 ^(PDF^) ^| 依赖于：Edge 经典浏览器
	echo   [35] %C_WindowsStoreClient% Windows 应用商店后台客户端
	echo   [36] %C_XboxClient% Xbox 主机小帮手后台客户端
	echo.  [37] %C_XboxGameCallableUI% Xbox Live ^(XboxGameCallableUI^)
	echo.  [38] %C_XGpuEjectDialog% 现代外部 GPU 弹出应用 ^(XGpuEjectDialog^)
	echo.
	echo.  [A]    所有系统应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
	if "!MenuChoice!" equ "02" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_CallingShellApp%" equ "+" ( set "C_CallingShellApp=-" ) else ( set "C_CallingShellApp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_CapturePicker%" equ "+" ( set "C_CapturePicker=-" ) else ( set "C_CapturePicker=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "11" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "12" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
	if "!MenuChoice!" equ "13" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "14" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "15" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "18" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "19" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_OOBENetworkCaptivePortal%" equ "+" ( set "C_OOBENetworkCaptivePortal=-" ) else ( set "C_OOBENetworkCaptivePortal=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_OOBENetworkConnectionFlow%" equ "+" ( set "C_OOBENetworkConnectionFlow=-" ) else ( set "C_OOBENetworkConnectionFlow=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "24" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "25" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "30" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "31" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "32" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "33" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			set "C_3DViewer=-"
			if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "34" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "35" (
		if "%C_WindowsStoreClient%" equ "+" (
			set "C_ServicesStoreEngagement=-"
			set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
			set "C_WindowsStoreClient=-"
		) else (
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "36" (
		if "%C_XboxClient%" equ "+" (
 			set "C_XboxApp=-"
			set "C_XboxClient=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "37" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "38" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AccountsControl=-"
		set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		set "C_BioEnrollment=-"
		set "C_CallingShellApp=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_PPIProjection=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_ServicesStoreEngagement=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_SolitaireCollection=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_WindowsStoreApp=-"
		set "C_WindowsStoreClient=-"
 		set "C_XboxApp=-"
		set "C_XboxClient=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_XboxGameCallableUI=-"
		set "C_XGpuEjectDialog=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 移除 Windows 10 v2004/v20H2/v21H1/v21H2，Windows 11 v21H2 客户端版本系统应用菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统应用菜单
	echo.===============================================================================
	echo.  [01] %C_AccountsControl% 帐户控制 ^| 需要：Windows 应用商店
	echo.  [02] %C_AssignedAccessLockApp% 指定访问锁定应用 ^| 依赖于：分配的访问权限
	echo.  [03] %C_AsyncTextService% Async Text 服务
	echo.  [04] %C_AADBrokerPlugin% Azure Active Directory AppX 代理插件 ^| 需要：Microsoft 帐户、Windows 应用商店
	echo.  [05] %C_BioEnrollment% Windows Hello 安装程序
	echo.  [06] %C_CallingShellApp% Calling Shell 应用
	echo.  [07] %C_CapturePicker% Capture Picker
	echo.  [08] %C_CBSPreview% Camera Barcode Scanner
	echo.  [09] %C_ContentDeliveryManager% Content Delivery Manager ^| 需要：全新安装体验
	echo.  [10] %C_CredDialogHost% Credential Dialog 主机
	echo.  [11] %C_Edge% Edge 经典浏览器
	echo.  [12] %C_EdgeDevToolsClient% Edge 开发者工具客户端 ^| 依赖于：Edge 经典浏览器
	echo.  [13] %C_ECApp% 目视控制应用
	echo.  [14] %C_FileExplorer% 文件资源管理器应用
	echo.  [15] %C_LockApp% 锁屏应用
	echo.  [16] %C_MapControl% 地图控件
	echo.  [17] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [18] %C_OneDrive% OneDrive 桌面客户端
	echo.  [19] %C_OOBENetworkCaptivePortal% OOBE Network Captive Portal
	echo.  [20] %C_OOBENetworkConnectionFlow% OOBE 网络连接流
	echo.  [21] %C_ParentalControls% 家长控制应用
	echo.  [22] %C_PeopleExperienceHost% 人脉栏
	echo.  [23] %C_QuickAssist% 快速助手应用
	echo.  [24] %C_RetailDemoContent% 零售演示内容
	if "%SelectedSourceOS%" equ "w10" echo.  [25] %C_SettingSync% 设置同步
	echo.  [26] %C_SkypeORTC% Skype ORTC
	echo.  [27] %C_SmartScreen% Smart Screen
	echo.  [28] %C_SecureAssessmentBrowser% Take Test 应用
	echo.  [29] %C_Win32WebViewHost% Win32 Web View 主机
	echo.  [30] %C_WindowsDefender% Windows Defender 应用
	echo.  [31] %C_WindowsMixedReality% Windows 混合现实
	echo.  [32] %C_WindowsReaderPDF% Windows 阅读器 ^(PDF^) ^| 依赖于：Edge 经典浏览器
	echo   [33] %C_WindowsStoreClient% Windows 应用商店后台客户端
	echo   [34] %C_XboxClient% Xbox 主机小帮手后台客户端
	echo.  [35] %C_XboxGameCallableUI% Xbox Live ^(XboxGameCallableUI^)
	echo.  [36] %C_XGpuEjectDialog% 现代外部 GPU 弹出应用 ^(XGpuEjectDialog^)
	echo.
	echo.  [A]    所有系统应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
	if "!MenuChoice!" equ "02" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_CallingShellApp%" equ "+" ( set "C_CallingShellApp=-" ) else ( set "C_CallingShellApp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_CapturePicker%" equ "+" ( set "C_CapturePicker=-" ) else ( set "C_CapturePicker=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
	if "!MenuChoice!" equ "11" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "12" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "13" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "16" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "17" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_OOBENetworkCaptivePortal%" equ "+" ( set "C_OOBENetworkCaptivePortal=-" ) else ( set "C_OOBENetworkCaptivePortal=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_OOBENetworkConnectionFlow%" equ "+" ( set "C_OOBENetworkConnectionFlow=-" ) else ( set "C_OOBENetworkConnectionFlow=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "22" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "23" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "25" if "%SelectedSourceOS%" equ "w10" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "30" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "31" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			set "C_3DViewer=-"
			if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "32" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "33" (
		if "%C_WindowsStoreClient%" equ "+" (
			set "C_ServicesStoreEngagement=-"
			set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
			set "C_WindowsStoreClient=-"
		) else (
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "34" (
		if "%C_XboxClient%" equ "+" (
			if "%ImageBuild%" geq "22000" set "C_GamingApp=-"
 			if "%ImageBuild%" leq "19044" set "C_XboxApp=-"
			set "C_XboxClient=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "35" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "36" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AccountsControl=-"
		set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		set "C_BioEnrollment=-"
		set "C_CallingShellApp=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		if "%ImageBuild%" geq "22000" set "C_GamingApp=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_ServicesStoreEngagement=-"
		if "%SelectedSourceOS%" equ "w10" set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_SolitaireCollection=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_WindowsStoreApp=-"
		set "C_WindowsStoreClient=-"
 		if "%ImageBuild%" leq "19044" set "C_XboxApp=-"
		set "C_XboxClient=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_XboxGameCallableUI=-"
		set "C_XGpuEjectDialog=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 返回到移除系统应用菜单
goto :RemoveSystemAppsMenu

:RemoveWindowsAppsMenu
:: 移除 Windows 10 v1809/v1903/v1909 客户端版本 Windows 应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 应用菜单
	echo.===============================================================================
	echo.  [01] %C_3DViewer% 3D 查看器 ^| 依赖于：Windows 混合现实
	echo.  [02] %C_AdvertisingXaml% Advertising Xaml
	echo.  [03] %C_Alarms% 闹钟和时钟
	echo.  [04] %C_Calculator% 计算器
	echo.  [05] %C_Camera% 相机
	echo.  [06] %C_DesktopAppInstaller% 桌面应用安装程序
	echo.  [07] %C_FeedbackHub% 反馈中心
	echo.  [08] %C_ZuneVideo% 电影和电视
	echo.  [09] %C_GetHelp% 获取帮助
	echo.  [10] %C_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [11] %C_ZuneMusic% Groove 音乐
	echo.  [12] %C_HEIFImageExtension% 高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [13] %C_Maps% 地图 ^| 依赖于：地图控件
	echo.  [14] %C_Messaging% 消息
	echo.  [15] %C_WalletService% Microsoft Pay
	if "%ImageArchitecture%" equ "x64" echo.  [16] %C_MixedRealityPortal% 混合现实查看器 ^| 依赖于：Windows 混合现实
	echo.  [17] %C_OneConnect% 移动套餐
	echo.  [18] %C_OfficeHub% 我的 Office
	echo.  [19] %C_OfficeOneNote% OneNote
	echo.  [20] %C_Paint3D% 画图 3D
	echo.  [21] %C_People% 人脉 ^| 依赖于：人脉栏
	echo.  [22] %C_Photos% 照片
	echo.  [23] %C_Print3D% Print 3D
	echo.  [24] %C_ServicesStoreEngagement% Services Store Engagement ^| 依赖于：Windows 应用商店应用
	echo.  [25] %C_ScreenSketch% 屏幕和草图
	echo.  [26] %C_SkypeApp% Skype
	echo.  [27] %C_SolitaireCollection% Solitaire Collection ^| 依赖于：Advertising Xaml、Services Store Engagement、Xbox Live
	if "%ImageBuild%" equ "17763" echo.  [28] %C_StickyNotes% 便笺
	if "%ImageBuild%" neq "17763" echo.  [28] %C_StickyNotes% 便笺 ^| 依赖于：Services Store Engagement
	echo.  [29] %C_StorePurchaseApp% 应用商店体验主机 ^| 依赖于：Windows 应用商店应用
	echo.  [30] %C_Getstarted% 使用技巧
	echo.  [31] %C_SoundRecorder% 录音机
	echo.  [32] %C_BingWeather% 天气 ^| 依赖于：Advertising Xaml
	echo.  [33] %C_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [34] %C_WebpImageExtension% WebP 图像编解码器插件
	echo.  [35] %C_CommunicationsApps% Windows 邮件 ^| 依赖于：Advertising Xaml
	echo.  [36] %C_WindowsStoreApp% Windows 应用商店应用 ^| 依赖于：Windows 应用商店后台客户端、Xbox Identity Provider
	echo.  [37] %C_XboxApp% Xbox 主机小帮手 ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [38] %C_XboxGameOverlay% Xbox Game Bar Plugin ^| 依赖于：Xbox 主机小帮手
	echo.  [39] %C_XboxGamingOverlay% Xbox Game Bar ^| 依赖于：Xbox 主机小帮手
	echo.  [40] %C_XboxIdentityProvider% Xbox Identity Provider ^| 依赖于：Xbox 主机小帮手
	echo.  [41] %C_XboxSpeechToTextOverlay% Xbox Live 游戏内体验 ^| 依赖于：Xbox 主机小帮手
	echo.  [42] %C_XboxTCUI% Xbox UI ^| 依赖于：Xbox 主机小帮手
	echo.  [43] %C_YourPhone% 你的手机
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "02" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "13" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_Messaging%" equ "+" ( set "C_Messaging=-" ) else ( set "C_Messaging=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "16" if "%ImageArchitecture%" equ "x64" (
		if "%C_MixedRealityPortal%" equ "+" ( 
			set "C_MixedRealityPortal=-"
		) else ( 
			set "C_MixedRealityPortal=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "17" ( if "%C_OneConnect%" equ "+" ( set "C_OneConnect=-" ) else ( set "C_OneConnect=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "22" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_Print3D%" equ "+" ( set "C_Print3D=-" ) else ( set "C_Print3D=+" ) )
	if "!MenuChoice!" equ "24" (
		if "%C_ServicesStoreEngagement%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
		) else ( 
			set "C_ServicesStoreEngagement=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "25" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "27" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			if "%ImageBuild%" equ "17763" (
				set "C_AdvertisingXaml=+"
				set "C_ServicesStoreEngagement=+"
				set "C_WindowsStoreApp=+"
				set "C_WindowsStoreClient=+"
			)
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "28" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			if "%ImageBuild%" neq "17763" (
				set "C_ServicesStoreEngagement=+"
				set "C_WindowsStoreApp=+"
				set "C_WindowsStoreClient=+"
			)
		)
	)
	if "!MenuChoice!" equ "29" (
		if "%C_StorePurchaseApp%" equ "+" (
			set "C_StorePurchaseApp=-"
		) else (
			set "C_StorePurchaseApp=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "30" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "31" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "32" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "33" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_WebpImageExtension%" equ "+" ( set "C_WebpImageExtension=-" ) else ( set "C_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "35" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "36" (
		if "%C_WindowsStoreApp%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
		) else ( 
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "37" (
		if "%C_XboxApp%" equ "+" (
 			set "C_XboxApp=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "38" (
		if "%C_XboxGameOverlay%" equ "+" ( 
			set "C_XboxGameOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxGameOverlay=+"
		)
	)
	if "!MenuChoice!" equ "39" (
		if "%C_XboxGamingOverlay%" equ "+" ( 
			set "C_XboxGamingOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxGamingOverlay=+"
		)
	)
	if "!MenuChoice!" equ "40" (
		if "%C_XboxIdentityProvider%" equ "+" ( 
			set "C_XboxIdentityProvider=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "41" (
		if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
			set "C_XboxSpeechToTextOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxSpeechToTextOverlay=+"
		)
	)
	if "!MenuChoice!" equ "42" (
		if "%C_XboxTCUI%" equ "+" ( 
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxTCUI=+"
		)
	)
	if "!MenuChoice!" equ "43" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_Messaging=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_OneConnect=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_Print3D=-"
		set "C_ScreenSketch=-"
		set "C_ServicesStoreEngagement=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtension=-"
		set "C_WindowsStoreApp=-"
 		set "C_XboxApp=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 移除 Windows 10 v2004/v20H2/v21H1/v21H2 客户端版本 Windows 应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19044" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 应用菜单
	echo.===============================================================================
	echo.  [01] %C_3DViewer% 3D 查看器 ^| 依赖于：Windows 混合现实
	echo.  [02] %C_AdvertisingXaml% Advertising Xaml
	echo.  [03] %C_Alarms% 闹钟和时钟
	echo.  [04] %C_Calculator% 计算器
	echo.  [05] %C_Camera% 相机
	echo.  [06] %C_Cortana% Cortana ^| 依赖于：语音识别
	echo.  [07] %C_DesktopAppInstaller% 桌面应用安装程序
	echo.  [08] %C_FeedbackHub% 反馈中心
	echo.  [09] %C_GetHelp% 获取帮助
	echo.  [10] %C_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [11] %C_ZuneMusic% Groove 音乐
	echo.  [12] %C_HEIFImageExtension% 高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [13] %C_Maps% 地图 ^| 依赖于：地图控件
	echo.  [14] %C_WalletService% Microsoft Pay
	if "%ImageArchitecture%" equ "x64" echo.  [15] %C_MixedRealityPortal% 混合现实查看器 ^| 依赖于：Windows 混合现实
	echo.  [16] %C_ZuneVideo% 电影和电视
	echo.  [17] %C_OfficeHub% 我的 Office
	echo.  [18] %C_OfficeOneNote% OneNote
	echo.  [19] %C_Paint3D% 画图 3D
	echo.  [20] %C_People% 人脉 ^| 依赖于：人脉栏
	echo.  [21] %C_Photos% 照片
	echo.  [22] %C_ServicesStoreEngagement% Services Store Engagement ^| 依赖于：Windows 应用商店应用
	echo.  [23] %C_ScreenSketch% 屏幕和草图
	echo.  [24] %C_SkypeApp% Skype
	echo.  [25] %C_SolitaireCollection% Solitaire Collection ^| 依赖于：Xbox Live
	echo.  [26] %C_StickyNotes% 便笺 ^| 依赖于：Services Store Engagement
	echo.  [27] %C_StorePurchaseApp% 应用商店体验主机 ^| 依赖于：Windows 应用商店应用
	echo.  [28] %C_Getstarted% 使用技巧
	echo.  [29] %C_SoundRecorder% 录音机
	echo.  [30] %C_BingWeather% 天气 ^| 依赖于：Advertising Xaml
	echo.  [31] %C_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [32] %C_WebpImageExtension% WebP 图像编解码器插件
	echo.  [33] %C_CommunicationsApps% Windows 邮件 ^| 依赖于：Advertising Xaml
	echo.  [34] %C_WindowsStoreApp% Windows 应用商店应用 ^| 依赖于：Windows 应用商店后台客户端、Xbox Identity Provider
	echo.  [35] %C_XboxApp% Xbox 主机小帮手 ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [36] %C_XboxGameOverlay% Xbox Game Bar Plugin ^| 依赖于：Xbox 主机小帮手
	echo.  [37] %C_XboxGamingOverlay% Xbox Game Bar ^| 依赖于：Xbox 主机小帮手
	echo.  [38] %C_XboxIdentityProvider% Xbox Identity Provider ^| 依赖于：Xbox 主机小帮手
	echo.  [39] %C_XboxSpeechToTextOverlay% Xbox Live 游戏内体验 ^| 依赖于：Xbox 主机小帮手
	echo.  [40] %C_XboxTCUI% Xbox UI ^| 依赖于：Xbox 主机小帮手
	echo.  [41] %C_YourPhone% 你的手机
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "02" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "06" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else (
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "07" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "13" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "15" if "%ImageArchitecture%" equ "x64" (
		if "%C_MixedRealityPortal%" equ "+" (
			set "C_MixedRealityPortal=-"
		) else (
			set "C_MixedRealityPortal=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "16" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "20" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "21" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "22" (
		if "%C_ServicesStoreEngagement%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
		) else ( 
			set "C_ServicesStoreEngagement=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "23" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "25" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "26" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_ServicesStoreEngagement=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "27" (
		if "%C_StorePurchaseApp%" equ "+" (
			set "C_StorePurchaseApp=-"
		) else (
			set "C_StorePurchaseApp=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "28" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "30" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "31" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_WebpImageExtension%" equ "+" ( set "C_WebpImageExtension=-" ) else ( set "C_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "33" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "34" (
		if "%C_WindowsStoreApp%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
		) else ( 
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "35" (
		if "%C_XboxApp%" equ "+" (
 			set "C_XboxApp=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "36" (
		if "%C_XboxGameOverlay%" equ "+" ( 
			set "C_XboxGameOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxGameOverlay=+"
		)
	)
	if "!MenuChoice!" equ "37" (
		if "%C_XboxGamingOverlay%" equ "+" ( 
			set "C_XboxGamingOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxGamingOverlay=+"
		)
	)
	if "!MenuChoice!" equ "38" (
		if "%C_XboxIdentityProvider%" equ "+" ( 
			set "C_XboxIdentityProvider=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "39" (
		if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
			set "C_XboxSpeechToTextOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxSpeechToTextOverlay=+"
		)
	)
	if "!MenuChoice!" equ "40" (
		if "%C_XboxTCUI%" equ "+" ( 
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxClient=+"
			set "C_XboxTCUI=+"
		)
	)
	if "!MenuChoice!" equ "41" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_ScreenSketch=-"
		set "C_ServicesStoreEngagement=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtension=-"
		set "C_WindowsStoreApp=-"
 		set "C_XboxApp=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 移除 Windows 11 v21H2 客户端版本 Windows 应用菜单
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 应用菜单
	echo.===============================================================================
	echo.  [01] %C_Alarms% 闹钟和时钟
	echo.  [02] %C_DesktopAppInstaller% 应用安装程序
	echo.  [03] %C_Calculator% 计算器
	echo.  [04] %C_Camera% 相机
	echo.  [05] %C_Cortana% Cortana ^| 依赖于：语音识别
	echo.  [06] %C_FeedbackHub% 反馈中心
	echo.  [07] %C_ZuneVideo% 电影和电视
	echo.  [08] %C_GamingApp% Gaming 应用 ^(Xbox 应用^) ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [09] %C_GetHelp% 获取帮助
	echo.  [10] %C_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [11] %C_ZuneMusic% Groove 音乐
	echo.  [12] %C_HEIFImageExtension% 高效图像文件 ^(HEIF^) 编解码器插件
	echo.  [13] %C_Maps% 地图 ^| 依赖于：地图控件
	echo.  [14] %C_OfficeHub% 我的 Office
	echo.  [15] %C_BingNews% 资讯
	echo.  [16] %C_Notepad% 记事本
	echo.  [17] %C_Paint% 画图
	echo.  [18] %C_People% 人脉 ^| 依赖于：人脉栏
	echo.  [19] %C_Photos% 照片
	echo.  [20] %C_PowerAutomateDesktop% Power Automate Desktop
	echo.  [21] %C_ScreenSketch% 屏幕和草图
	echo.  [22] %C_SolitaireCollection% Solitaire Collection ^| 依赖于：Xbox Live
	echo.  [23] %C_StickyNotes% 便笺
	echo.  [24] %C_StorePurchaseApp% 应用商店体验主机 ^| 依赖于：Windows 应用商店应用
	echo.  [25] %C_Terminal% 终端
	echo.  [26] %C_Getstarted% 使用技巧
	echo.  [27] %C_Todos% Todos
	echo.  [28] %C_SoundRecorder% 录音机
	echo.  [29] %C_BingWeather% 天气
	echo.  [30] %C_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [31] %C_WebpImageExtension% WebP 图像编解码器插件
	echo.  [32] %C_ClientWebExperience% 小组件
	echo.  [33] %C_CommunicationsApps% Windows 邮件
	echo.  [34] %C_WindowsStoreApp% Windows 应用商店应用 ^| 依赖于：Windows 应用商店后台客户端、Xbox Identity Provider
	echo.  [35] %C_XboxGameOverlay% Xbox Game Bar Plugin ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [36] %C_XboxGamingOverlay% Xbox Game Bar ^|依赖于：Xbox 主机小帮手后台客户端
	echo.  [37] %C_XboxIdentityProvider% Xbox Identity Provider ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [38] %C_XboxSpeechToTextOverlay% Xbox Live 游戏内体验 ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [39] %C_XboxTCUI% Xbox UI ^| 依赖于：Xbox 主机小帮手后台客户端
	echo.  [40] %C_YourPhone% 你的手机
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "05" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else (
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "06" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "08" (
		if "%C_GamingApp%" equ "+" ( 
			set "C_GamingApp=-"
		) else (
			set "C_GamingApp=+"
			set "C_XboxClient=+"
		)
	)
	if "!MenuChoice!" equ "09" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "13" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_BingNews%" equ "+" ( set "C_BingNews=-" ) else ( set "C_BingNews=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_Notepad%" equ "+" ( set "C_Notepad=-" ) else ( set "C_Notepad=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
	if "!MenuChoice!" equ "18" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "19" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_PowerAutomateDesktop%" equ "+" ( set "C_PowerAutomateDesktop=-" ) else ( set "C_PowerAutomateDesktop=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "22" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "23" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "24" (
		if "%C_StorePurchaseApp%" equ "+" (
			set "C_StorePurchaseApp=-"
		) else (
			set "C_StorePurchaseApp=+"
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
		)
	)
	if "!MenuChoice!" equ "25" ( if "%C_Terminal%" equ "+" ( set "C_Terminal=-" ) else ( set "C_Terminal=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_Todos%" equ "+" ( set "C_Todos=-" ) else ( set "C_Todos=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_BingWeather%" equ "+" ( set "C_BingWeather=-" ) else ( set "C_BingWeather=+"	) )
	if "!MenuChoice!" equ "30" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "31" ( if "%C_WebpImageExtension%" equ "+" ( set "C_WebpImageExtension=-" ) else ( set "C_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_ClientWebExperience%" equ "+" ( set "C_ClientWebExperience=-" ) else ( set "C_ClientWebExperience=+" ) )
	if "!MenuChoice!" equ "33" ( if "%C_CommunicationsApps%" equ "+" ( set "C_CommunicationsApps=-" ) else ( set "C_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "34" (
		if "%C_WindowsStoreApp%" equ "+" ( 
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStoreApp=-"
		) else ( 
			set "C_WindowsStoreApp=+"
			set "C_WindowsStoreClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "35" (
		if "%C_XboxGameOverlay%" equ "+" ( 
			set "C_XboxGameOverlay=-"
		) else (
			set "C_XboxClient=+"
			set "C_XboxGameOverlay=+"
		)
	)
	if "!MenuChoice!" equ "36" (
		if "%C_XboxGamingOverlay%" equ "+" ( 
			set "C_XboxGamingOverlay=-"
		) else (
			set "C_XboxClient=+"
			set "C_XboxGamingOverlay=+"
		)
	)
	if "!MenuChoice!" equ "37" (
		if "%C_XboxIdentityProvider%" equ "+" ( 
			set "C_XboxIdentityProvider=-"
		) else (
			set "C_XboxClient=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "38" (
		if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
			set "C_XboxSpeechToTextOverlay=-"
		) else (
			set "C_XboxClient=+"
			set "C_XboxSpeechToTextOverlay=+"
		)
	)
	if "!MenuChoice!" equ "39" (
		if "%C_XboxTCUI%" equ "+" ( 
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxClient=+"
			set "C_XboxTCUI=+"
		)
	)
	if "!MenuChoice!" equ "40" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_BingNews=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GamingApp=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_OfficeHub=-"
		set "C_Notepad=-"
		set "C_Paint=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_PowerAutomateDesktop=-"
		set "C_ScreenSketch=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_StorePurchaseApp=-"
		set "C_Terminal=-"
		set "C_Todos=-"
		set "C_VP9VideoExtensions=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtension=-"
		set "C_ClientWebExperience=-"
		set "C_WindowsStoreApp=-"
		set "C_XboxGameOverlay=-"
		set "C_XboxGamingOverlay=-"
		set "C_XboxIdentityProvider=-"
		set "C_XboxSpeechToTextOverlay=-"
		set "C_XboxTCUI=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
)

:: 返回到移除 Windows 组件菜单。
goto :RemoveWindowsAppsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 移除 Windows 组件模组
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponents

setlocal

set Components=

cls
echo.===============================================================================
echo.                       MSMG 工具箱 - 移除 Windows 组件
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_SnippingTool,C_SpeechRecognition,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WinSAT,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_RemoteAssistance,C_DeviceLockdown,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_ManualSetup,C_Paint,C_SecurityCenter,C_StepsRecorder,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_EdgeDevToolsClient,C_Edge,C_FileExplorer,C_LockApp,C_MapControl,C_NarratorQuickStart,C_OneDrive,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SecureAssessmentBrowser,C_SettingSync,C_SkypeORTC,C_SmartScreen,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreClient,C_XboxClient,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingWeather,C_BingNews,C_Calculator,C_Camera,C_ClientWebExperience,C_CommunicationsApps,C_DesktopAppInstaller,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Notepad,C_Paint3D,C_People,C_Photos,C_Print3D,C_ServicesStoreEngagement,C_PowerAutomateDesktop,C_ScreenSketch,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_VP9VideoExtensions,C_WalletService,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStoreApp,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	if "%%i" neq "C_ManualSetup" if "%%i" neq "C_WindowsFirewall" if "!%%i!" equ "-" (
		for /f "tokens=2 delims=_" %%j in ("%%i") do (
			set "Components=!Components!%%j;"
		)
	)
)

if "%Components%" equ "" (
	echo.未选择要被移除的 Windows 组件……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始移除 Windows 组件##################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在移除 Windows 组件######################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================

		:: 对客户端版本 WebExperience 移除预期的临时修复
		if "%C_ClientWebExperience%" equ "-" call :RemoveFolder "%InstallMount%\%%i\Program Files\WindowsApps\MicrosoftWindows.Client.WebExperience_321.14700.0.9_x64__cw5n1h2txyewy"
		
		:: 移除 Windows 组件
		%ToolKitHelper% "%InstallMount%\%%i" "%Components%"
	)
)

if "%C_ManualSetup%" equ "-" %ToolKitHelper% "%InstallMount%\%DefaultIndexNo%" "ManualSetup"

echo.-------------------------------------------------------------------------------
echo.####移除 Windows 组件功能已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Components=

endlocal

:: 重置组件状态标识
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_SnippingTool,C_SpeechRecognition,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WinSAT,C_AssignedAccess,C_CEIP,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_RemoteAssistance,C_DeviceLockdown,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_ManualSetup,C_Paint,C_SecurityCenter,C_StepsRecorder,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_EdgeDevToolsClient,C_Edge,C_FileExplorer,C_LockApp,C_MapControl,C_NarratorQuickStart,C_OneDrive,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SecureAssessmentBrowser,C_SettingSync,C_SkypeORTC,C_SmartScreen,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreClient,C_XboxClient,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingWeather,C_BingNews,C_Calculator,C_Camera,C_ClientWebExperience,C_CommunicationsApps,C_DesktopAppInstaller,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Notepad,C_Paint3D,C_People,C_Photos,C_Print3D,C_ServicesStoreEngagement,C_PowerAutomateDesktop,C_ScreenSketch,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_VP9VideoExtensions,C_WalletService,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStoreApp,C_XboxApp,C_XboxGameOverlay,C_XboxGamingOverlay,C_XboxIdentityProvider,C_XboxSpeechToTextOverlay,C_XboxTCUI,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	set "%%i=+"
)

:: 返回到移除 Windows 组件菜单。
goto :RemoveWindowsComponentsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用应用列表移除 Windows 组件模组
::-------------------------------------------------------------------------------------------
:RemoveWindowsAppsList

setlocal

set "RemoveAppsList=%Lists%\RemoveAppsList.txt"

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 使用应用列表移除 Windows 应用
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始使用应用列表移除 Windows 应用######################################
echo.-------------------------------------------------------------------------------
echo.
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在使用应用列表移除 Windows 应用##########################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		for /f %%z IN ('"type %RemoveAppsList%" 2^>nul') do (
			call :RemoveProvisionedAppxPackage "%InstallMount%\%%i", %%z, %%z

			if "%%z" equ "Microsoft.3DBuilder" (
				:: 安装映像注册表
				call :MountImageRegistry "%InstallMount%\%%i"

				:: 从右键单击上下文菜单注册表项中移除“使用 3D Builder 进行 3D 打印”选项
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.bmp\Shell\T3D Print" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpg\Shell\T3D Print" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.png\Shell\T3D Print" /f >nul 2>&1

				:: 卸载映像注册表
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.MSPaint" (
				:: 安装映像注册表
				call :MountImageRegistry "%InstallMount%\%%i"

				:: 从右键单击上下文菜单注册表项中移除“使用画图 3D 编辑”选项
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.3mf\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.bmp\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.fbx\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.gif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jfif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpe\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpeg\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.jpg\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.png\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.tif\Shell\3D Edit" /f >nul 2>&1
				Reg delete "HKLM\TK_SOFTWARE\Classes\SystemFileAssociations\.tiff\Shell\3D Edit" /f >nul 2>&1

				:: 卸载映像注册表
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.Print3D" if "%ImageBuild%" geq "16299" (
				:: 安装映像注册表
				call :MountImageRegistry "%InstallMount%\%%i"

				:: 从 Windows 资源管理器导航窗格中删除 3D 对象部分
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1
				if "%ImageArchitecture%" equ "x64" Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1

				:: 卸载映像注册表
				call :UnMountImageRegistry
			)

			if "%%z" equ "Microsoft.Microsoft3DViewer" if "%ImageBuild%" geq "16299" (
				:: 安装映像注册表
				call :MountImageRegistry "%InstallMount%\%%i"

				:: 从 Windows 资源管理器导航窗格中删除 3D 对象部分
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1
				if "%ImageArchitecture%" equ "x64" Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" /f >nul 2>&1

				:: 卸载映像注册表
				call :UnMountImageRegistry
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####使用应用列表移除默认 Metro 应用已完成######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set RemoveAppsList=

endlocal

:: 返回到移除菜单。
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用程序包列表移除 Windows 组件模组
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsList

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                  MSMG 工具箱 - 使用程序包列表移除 Windows 组件
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                警         告
	echo.                                =============
	echo.
	echo.   在没有进行适当测试的情况下任意移除程序包，有可能会破坏操作系统及其相应的
	echo.   功能模组。
	echo.
	echo.   在当将程序包添加到 RemovePkgsList.txt 时，仅添加父程序包名称，不包括它的
	echo.   语言包或子程序包。
	echo.
	echo.
	if "%SelectedSourceOS%" neq "w10" echo.
	if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" lss "17763" echo.
	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
		echo.   例如：WindowsDefender ^(ToolKitHelper.exe 方式^)
		echo.
	)
	echo.   例如：Windows-Defender-Client-Package ^(DISM 方式^)
	echo.
	echo.   若要关闭此警告对话框，请在工具 -^> 选项菜单中选择禁用对话框
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 goto :RemoveMenu
)

setlocal

set "RemovePkgsList=%Lists%\RemovePkgsList.txt"
set RemovalMethod=

if "%SelectedSourceOS%" neq "w10" set "RemovalMethod=DISM"
if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" lss "17763" set "RemovalMethod=DISM"

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" (
	cls
	echo.===============================================================================
	echo.               MSMG 工具箱 - 使用程序包列表移除 Windows 组件菜单
	echo.===============================================================================
	echo.
	echo.  [1]   使用程序包列表移除 Windows 组件 ^(DISM 方式^)
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件 ^(ToolKitHelper 方式^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  注：只能使用上述方法中的一种
	echo.
	echo.
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:12X /N /M "请输入你的选项 ："
	if errorlevel 3 goto :RemoveMenu
	if errorlevel 2 set "RemovalMethod=ToolKitHelper"
	if errorlevel 1 set "RemovalMethod=DISM"
)

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 使用程序包列表移除 Windows 组件
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始使用程序包列表移除 Windows 组件####################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在使用程序包列表移除 Windows 组件########################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================

		if "%RemovalMethod%" equ "DISM" (
			for /f %%z IN ('"type %RemovePkgsList%" 2^>nul') do (
				call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z
			)
		)

		if "%RemovalMethod%" equ "ToolKitHelper" (
			%ToolKitHelper% "%InstallMount%\%%i" "%RemovePkgsList%"
			echo.
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####使用程序包列表移除 Windows 组件已完成######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set RemovePkgsList=
set RemovalMethod=

endlocal

:: 返回到移除菜单。
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用功能列表启用 Windows 功能模组
::-------------------------------------------------------------------------------------------
:EnableFeatures

setlocal

set "FeaturesList=%Lists%\EnableFeaturesList.txt"

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 使用功能列表启用 Windows 功能
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始使用功能列表启用 Windows 功能######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在使用功能列表启用 Windows 功能##########################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.正在启用 Windows 功能 - [%%z]……
			echo.-------------------------------------------------------------------------------
			call :EnableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####使用功能列表启用 Windows 功能已完成########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set FeaturesList=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用功能列表禁用 Windows 功能模组
::-------------------------------------------------------------------------------------------
:DisableFeatures

setlocal

set "FeaturesList=%Lists%\DisableFeaturesList.txt"

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 使用功能列表禁用 Windows 功能
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始使用功能列表禁用 Windows 功能######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在使用功能列表禁用 Windows 功能##########################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.正在禁用 Windows 功能 - [%%z]……
			echo.-------------------------------------------------------------------------------
			call :DisableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####使用功能列表禁用 Windows 功能已完成########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set FeaturesList=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从 XML 文件导入自定义默认内置应用关联的模组
::-------------------------------------------------------------------------------------------
:ImportMetroAppsAssociation

setlocal

set "CustomAppsAssociationXML=%XMLs%\%SelectedSourceOS%_CustomAppsAssociation.xml"

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 从 XML 文件导入自定义默认内置应用关联
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始从 XML 文件导入自定义默认内置应用关联##############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在从 XML 文件导入自定义默认内置应用关联##################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.

		call :ImportDefaultAppAssociations "%InstallMount%\%%i", "%CustomAppsAssociationXML%"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####从 XML 文件导入自定义默认内置应用关联已完成################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomAppsAssociationXML=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 导出默认内置应用关联到 XML 文件模组
::-------------------------------------------------------------------------------------------
:ExportMetroAppsAssociation

setlocal

set "DefaultMetroAppsAssociationXML=%XMLs%\%SelectedSourceOS%_DefaultAppsAssociation.xml"

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 导出默认内置应用关联到 XML 文件
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始导出默认内置应用关联到 XML 文件####################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在检查默认内置应用关联###################################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
		if errorlevel 1 (
			echo.已找到默认内置应用关联 XML 文件……
			echo.
			echo.-------------------------------------------------------------------------------
			echo.正在导出默认内置应用关联 XML 文件……
			echo.-------------------------------------------------------------------------------
			echo.
			call :RemoveFile "%DefaultMetroAppsAssociationXML%"
			%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr "<" >> "%DefaultMetroAppsAssociationXML%"
			echo.
			echo.-------------------------------------------------------------------------------
			echo.####导出默认内置应用关联 XML 文件已完成########################################
			echo.-------------------------------------------------------------------------------
			goto :Stop
		)
		if not errorlevel 1 (
			echo.默认内置应用关联 XML 文件是空的……
			echo.
			echo.-------------------------------------------------------------------------------
			echo.####导出默认内置应用关联 XML 文件已停止########################################
			echo.-------------------------------------------------------------------------------
			goto :Stop
		)
	)
)

:Stop
echo.
echo.===============================================================================
echo.
pause

set DefaultMetroAppsAssociationXML=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 移除默认内置应用关联模组
::-------------------------------------------------------------------------------------------
:RemoveMetroAppsAssociation

setlocal

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 移除默认内置应用关联
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在开始移除默认内置应用关联###############################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.正在检查默认内置应用关联……
		echo.-------------------------------------------------------------------------------
		echo.
		%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
		if errorlevel 1 (
			echo.已找到默认内置应用关联 XML 文件。
			echo.
			echo.-------------------------------------------------------------------------------
			echo.正在移除默认内置应用关联……
			echo.-------------------------------------------------------------------------------
			call :RemoveDefaultAppAssociations "%InstallMount%\%%i"
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####移除默认内置应用关联已完成#################################################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		) else (
			echo.默认内置应用关联已经被移除。
			echo.
			echo.正在跳过移除默认内置应用关联。
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####移除默认内置应用关联已停止#################################################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		)
	)
)

:Stop
echo.===============================================================================
echo.
pause

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从 XML 文件合并自定义开始菜单布局模组
::-------------------------------------------------------------------------------------------
:ImportStartMenuLayout

setlocal

set "CustomStartMenuLayoutXML=%XMLs%\%SelectedSourceOS%_CustomStartMenuLayout.xml"

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 从 XML 文件合并自定义开始菜单布局
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####正在从 XML 文件合并自定义开始菜单布局######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在从 XML 文件合并自定义开始菜单布局######################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在复制自定义开始菜单布局……
		copy %CustomStartMenuLayoutXML% "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml" >nul
		call :RemoveFolder "%InstallMount%\%%i\Users\Default\AppData\Local\TileDataLayer"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####从 XML 文件合并自定义开始菜单布局已完成####################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomStartMenuLayoutXML=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从注册表文件合并自定义注册表设置的模组
::-------------------------------------------------------------------------------------------
:ImportCustomRegistry

setlocal

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 从注册表文件合并自定义注册表设置
echo.===============================================================================
echo.

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

set "CustomRegistry=%CustomRegistry%\%SelectedSourceOS%\%ImageArchitecture%"

:: 检查自定义注册表文件包文件是否存在
for /f %%i in ('dir /b /a:-d "%CustomRegistry%\*.reg" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		echo.自定义注册表设置文件夹是空的……
		echo.
		echo.请将注册表文件复制到 ^<Custom\Registry\%SelectedSourceOS%\%ImageArchitecture%^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从注册表文件合并自定义注册表设置###################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在处理自定义注册表设置文件###############################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在使自定义注册表与工具箱的映像注册表兼容……
call :RemoveFolder "%Temp%\CustomRegistry"
call :CreateFolder "%Temp%\CustomRegistry"
PowerShell -Executionpolicy Bypass -File "%Bin%\ConvertReg.ps1" "%CustomRegistry%" "%Temp%\CustomRegistry"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在合并自定义注册表设置文件###############################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.

		for /f "tokens=*" %%z in ('"dir /b "%Temp%\CustomRegistry\*.reg"" 2^>nul') do (
			echo.正在合并 [%%z] 到映像注册表……
			call :ImportRegistry2Image "%Temp%\CustomRegistry\%%z"
		)

		echo.
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

call :RemoveFolder "%Temp%\CustomRegistry"
echo.
echo.-------------------------------------------------------------------------------
echo.####从注册表文件合并自定义注册表设置已完成#####################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CustomRegistry=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 应用调整菜单模组
::-------------------------------------------------------------------------------------------
:ApplyTweaksMenu

setlocal

set Tweak=

cls
echo.===============================================================================
echo.                         MSMG 工具箱 - 应用调整菜单
echo.===============================================================================
echo.

if "%SelectedSourceOS%" equ "w81" (
	echo.  [A]   禁止通过 Windows 更新自动更新驱动
	echo.  [B]   禁用自动下载并安装第三方应用
	echo.  [C]   禁用 Windows Defender
	echo.  [D]   禁用 Windows SmartScreen
	echo.  [E]   禁用自动执行 Windows 升级
	echo.  [F]   禁用 Windows 更新
	echo.  [G]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [H]   启用 Windows 照片查看器
	echo.  [I]   启用 Fraunhofer MP3 Professional Codec
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [1]   所有调整
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHI1X /N /M "请输入你的选项 ："
	if errorlevel 11 goto :CustomizeMenu
	if errorlevel 10 set "Tweak=AllTweaks"
	if errorlevel 9  set "Tweak=EnableFMP3ProCodec"
	if errorlevel 8  set "Tweak=EnablePhotoViewer"
	if errorlevel 7  set "Tweak=ForceLatestNetFramework"
	if errorlevel 6  set "Tweak=DisableWindowsUpdate"
	if errorlevel 5  set "Tweak=DisableWindowsUpgrade"
	if errorlevel 4  set "Tweak=DisableWindowsSmartScreen"
	if errorlevel 3  set "Tweak=DisableWindowsDefender"
	if errorlevel 2  set "Tweak=Disable3RDPartyApps"
	if errorlevel 1  set "Tweak=DisableDriversUpdates"
)

if "%SelectedSourceOS%" equ "w10" (
	echo.  [A]   禁用 Cortana 应用
	echo.  [B]   隐藏任务栏任务视图图标
	echo.  [C]   隐藏任务栏立即开会图标
	echo.  [D]   隐藏任务栏资讯和兴趣
	echo.  [E]   禁止通过 Windows 更新自动更新驱动
	echo.  [F]   禁用自动下载并安装第三方应用
	echo.  [G]   禁用 Windows Defender
	echo.  [H]   禁用 Windows SmartScreen
	echo.  [I]   禁用自动执行 Windows 升级
	echo.  [J]   禁用 Windows 更新
	echo.  [K]   禁用 Microsoft 用于 Windows 更新保留的存储空间
	echo.  [L]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [M]   启用 Windows 照片查看器
	echo.  [N]   启用 Fraunhofer MP3 Professional Codec
	echo.  [O]   使用完整 ResetBase 启用 DISM 映像清理
	echo.
	echo.  [1]   所有调整
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNO1X /N /M "请输入你的选项 ："
	if errorlevel 17 goto :CustomizeMenu
	if errorlevel 16 set "Tweak=AllTweaks"
	if errorlevel 15 set "Tweak=EnableFullResetBase"
	if errorlevel 14 set "Tweak=EnableFMP3ProCodec"
	if errorlevel 13 set "Tweak=EnablePhotoViewer"
	if errorlevel 12 set "Tweak=ForceLatestNetFramework"
	if errorlevel 11 set "Tweak=DisableReservedStorage"
	if errorlevel 10 set "Tweak=DisableWindowsUpdate"
	if errorlevel 9  set "Tweak=DisableWindowsUpgrade"
	if errorlevel 8  set "Tweak=DisableWindowsSmartScreen"
	if errorlevel 7  set "Tweak=DisableWindowsDefender"
	if errorlevel 6  set "Tweak=Disable3RDPartyApps"
	if errorlevel 5  set "Tweak=DisableDriversUpdates"
	if errorlevel 4  set "Tweak=HideNewsAndInterests"
	if errorlevel 3  set "Tweak=HideMeetNowIcon"
	if errorlevel 2  set "Tweak=HideTaskViewIcon"
	if errorlevel 1  set "Tweak=DisableCortanaApp"
)

if "%SelectedSourceOS%" equ "w11" (
	echo.  [A]   禁用 Windows 11 安装程序硬件检查
	echo.  [B]   禁用 Cortana 应用
	echo.  [C]   隐藏任务栏任务视图图标
	echo.  [D]   隐藏任务栏立即开会图标
	echo.  [E]   隐藏任务栏资讯和兴趣
	echo.  [F]   禁止通过 Windows 更新自动更新驱动
	echo.  [G]   禁用自动下载并安装第三方应用
	echo.  [H]   禁用 Windows Defender
	echo.  [I]   禁用 Windows SmartScreen
	echo.  [J]   禁用自动执行 Windows 升级
	echo.  [K]   禁用 Windows 更新
	echo.  [L]   禁用 Microsoft 用于 Windows 更新保留的存储空间
	echo.  [M]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [N]   启用 Windows 照片查看器
	echo.  [O]   启用 Fraunhofer MP3 Professional Codec
	echo.  [P]   使用完整 ResetBase 启用 DISM 映像清理
	echo.
	echo.  [1]   所有调整
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOP1X /N /M "请输入你的选项 ："
	if errorlevel 18 goto :CustomizeMenu
	if errorlevel 17 set "Tweak=AllTweaks"
	if errorlevel 16 set "Tweak=EnableFullResetBase"
	if errorlevel 15 set "Tweak=EnableFMP3ProCodec"
	if errorlevel 14 set "Tweak=EnablePhotoViewer"
	if errorlevel 13 set "Tweak=ForceLatestNetFramework"
	if errorlevel 12 set "Tweak=DisableReservedStorage"
	if errorlevel 11 set "Tweak=DisableWindowsUpdate"
	if errorlevel 10 set "Tweak=DisableWindowsUpgrade"
	if errorlevel 9  set "Tweak=DisableWindowsSmartScreen"
	if errorlevel 8  set "Tweak=DisableWindowsDefender"
	if errorlevel 7  set "Tweak=Disable3RDPartyApps"
	if errorlevel 6  set "Tweak=DisableDriversUpdates"
	if errorlevel 5  set "Tweak=HideNewsAndInterests"
	if errorlevel 4  set "Tweak=HideMeetNowIcon"
	if errorlevel 3  set "Tweak=HideTaskViewIcon"
	if errorlevel 2  set "Tweak=DisableCortanaApp"
	if errorlevel 1  set "Tweak=DisableW11InstHardwareCheck"
)

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 应用调整
echo.===============================================================================
echo.
:: 获取已更新的映像信息
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19044" (
   call :GetUpdatedImageInformation
)

:: 获取安装映像索引体系结构
call :GetImageArchitecture "%InstallWim%", %DefaultIndexNo% >nul

if "%Tweak%" equ "DisableW11InstHardwareCheck" if "%IsBootImageSelected%" equ "No" (
	echo.Windows 安装程序启动映像尚未选择……
	echo.
	echo.请在选择源文件时选择 Windows 安装程序启动映像……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始应用调整###########################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Tweak%" equ "AllTweaks" echo.####正在应用所有调整###########################################################
if "%Tweak%" equ "Disable3RDPartyApps" echo.####正在应用禁用自动下载并安装第三方应用调整###################################
if "%Tweak%" equ "DisableCortanaApp" echo.####正在应用禁用 Cortana 应用调整##############################################
if "%Tweak%" equ "DisableDriversUpdates" echo.####正在应用禁止通过 Windows 更新自动更新驱动调整##############################
if "%Tweak%" equ "DisableReservedStorage" echo.####正在应用禁用 Microsoft 用于进行 Windows 更新保留的存储空间#################
if "%Tweak%" equ "DisableW11InstHardwareCheck" echo.####正在应用禁用 Windows 11 安装程序硬件检查###################################
if "%Tweak%" equ "DisableWindowsDefender" echo.####正在应用禁用 Windows Defender 调整#########################################
if "%Tweak%" equ "DisableWindowsUpdate" echo.####正在应用禁用 Windows 更新调整##############################################
if "%Tweak%" equ "DisableWindowsUpgrade" echo.####正在应用禁用自动升级 Windows 操作系统调整##################################
if "%Tweak%" equ "EnableFMP3ProCodec" echo.####正在应用启用 Fraunhofer MP3 Professional Codec 调整#########################
if "%Tweak%" equ "EnableFullResetBase" echo.####正在应用使用完整 ResetBase 启用 DISM 映像清理调整###########################
if "%Tweak%" equ "EnablePhotoViewer" echo.####正在应用启用 Windows 照片查看器调整########################################
if "%Tweak%" equ "ForceLatestNetFramework" echo.####正在应用强制 .NET 程序使用最新的 .NET Framework 调整#######################
if "%Tweak%" equ "HideTaskViewIcon" echo.####正在应用隐藏任务栏任务视图图标调整#########################################
if "%Tweak%" equ "HideMeetNowIcon" echo.####正在应用隐藏任务栏立即开会图标调整#########################################
if "%Tweak%" equ "HideNewsAndInterests" echo.####正在应用隐藏任务栏资讯和兴趣调整###########################################
echo.-------------------------------------------------------------------------------

if "%Tweak%" equ "DisableW11InstHardwareCheck" (
	echo.
	echo.正在安装映像注册表……
	Reg load "HKLM\TK_BOOT_SYSTEM" "%BootMount%\2\Windows\System32\Config\SYSTEM" >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	Reg add "HKLM\TK_BOOT_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
	echo.
	echo.正在卸载映像注册表……
	Reg unload "HKLM\TK_BOOT_SYSTEM" >nul 2>&1
)

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim，索引 ：%%i]=============================
		if %%i gtr 9 echo.==========================[Install.wim，索引 ：%%i]=============================
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……

		if "%Tweak%" equ "DisableCortanaApp" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" /v "EnableCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\AboveLock" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Experience" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana ActionUriServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana Package" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana PlacesServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersShareTargetApp.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana SearchUI.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideTaskViewIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul

		if "%Tweak%" equ "HideMeetNowIcon" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul
		)

		if "%Tweak%" equ "HideNewsAndInterests" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v "ShellFeedsTaskbarViewMode" /t REG_DWORD /d "2" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d "0" /f >nul
		)

		if "%Tweak%" equ "DisableDriversUpdates" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul
		)

		if "%Tweak%" equ "Disable3RDPartyApps" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul
		)

		if "%Tweak%" equ "DisableWindowsDefender" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtectionSource" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Signature Updates" /v "FirstAuGracePeriod" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\UX Configuration" /v "DisablePrivacyMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" /v "SecurityHealth" /t REG_BINARY /d "030000000000000000000000" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontOfferThroughWUAU" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "RandomizeScheduleTaskTimes" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions" /v "DisableAutoExclusions" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "LocalSettingOverridePurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "PurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScriptScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleDay" /t REG_DWORD /d "8" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "AdditionalActionTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "CriticalFailureTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericRePorts" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "NonCriticalTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "AvgCPULoadFactor" /t REG_DWORD /d "10" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableArchiveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupQuickScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRemovableDriveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRestorePoint" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningMappedNetworkDrivesForFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningNetworkFiles" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "PurgeItemsAfterDelay" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanOnlyIfIdle" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanParameters" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "DisableUpdateOnStartupWithoutEngine" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "SignatureUpdateCatchupInterval" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReporting" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReportingLocation" /t REG_MULTI_SZ /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableWindowsSmartScreen" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Security Health\State" /v "AppAndBrowser_StoreAppsSmartScreenOff" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControl" /t REG_SZ /d "Anywhere" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControlEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableWindowsUpgrade" (
			if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Gwx" /v "DisableGwx" /t REG_DWORD /d "1" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpdatePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgradePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersion" /t REG_DWORD /d "1" /f >nul 2>&1
				if "%ImageBuild%" equ "17134" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1803" /f >nul 2>&1
				if "%ImageBuild%" equ "17763" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1809" /f >nul 2>&1
				if "%ImageBuild%" equ "18362" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1903" /f >nul 2>&1
				if "%ImageBuild%" equ "18363" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1909" /f >nul 2>&1
				if "%ImageBuild%" equ "19041" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2004" /f >nul 2>&1
				if "%ImageBuild%" equ "19042" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2009" /f >nul 2>&1
				if "%ImageBuild%" equ "19043" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H1" /f >nul 2>&1
				if "%ImageBuild%" equ "19044" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "22000" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "DisableWindowsUpdate" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "SystemSettingsDownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "OptInOOBE" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "5" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\7971f918-a847-4430-9279-4a52d1efe18d" /v "RegisteredWithAU" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceUpdateAgent/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-WindowsUpdateClient/Operational]" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v "HideMCTLink" /t REG_DWORD /d "1" /f >nul 2>&1

			if "%ImageDefaultLanguage%" equ "zh-CN" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-HK" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%ImageDefaultLanguage%" equ "zh-TW" Reg add "HKLM\TK_SOFTWARE\Microsoft\LexiconUpdate\loc_0804" /v "HapDownloadEnabled" /t REG_DWORD /d "0" /f >nul 2>&1

			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Speech" /v "AllowSpeechModelUpdate" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DoNotConnectToWindowsUpdateInternetLocations" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableWindowsUpdateAccess" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "WUStatusServer" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "UpdateServiceUrlAlternate" /t REG_SZ /d " " /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "UseWUServer" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\wuauserv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
		)

		if "%Tweak%" equ "DisableReservedStorage" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul
		if "%Tweak%" equ "ForceLatestNetFramework" Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul

		if "%Tweak%" equ "EnablePhotoViewer" (
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3056" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3058" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3069" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationName" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3009" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
		)

		if "%Tweak%" equ "EnableFMP3ProCodec" (
			if "%ImageArchitecture%" equ "x86" (
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
			)

			if "%ImageArchitecture%" equ "x64" (
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
				Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\SysWOW64\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\SysWOW64\l3codecp.acm" /f >nul
			)
		)

		if "%Tweak%" equ "EnableFullResetBase" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul

		if "%Tweak%" equ "AllTweaks" (
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" /v "EnableCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\AboveLock" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Experience" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana ActionUriServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana Package" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana PlacesServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersShareTargetApp.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana SearchUI.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtectionSource" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Signature Updates" /v "FirstAuGracePeriod" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\UX Configuration" /v "DisablePrivacyMode" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" /v "SecurityHealth" /t REG_BINARY /d "030000000000000000000000" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontOfferThroughWUAU" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender" /v "RandomizeScheduleTaskTimes" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions" /v "DisableAutoExclusions" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "LocalSettingOverridePurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Quarantine" /v "PurgeItemsAfterDelay" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScriptScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleDay" /t REG_DWORD /d "8" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Remediation" /v "Scan_ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "AdditionalActionTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "CriticalFailureTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericRePorts" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "NonCriticalTimeOut" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "AvgCPULoadFactor" /t REG_DWORD /d "10" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableArchiveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableCatchupQuickScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRemovableDriveScanning" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableRestorePoint" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningMappedNetworkDrivesForFullScan" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "DisableScanningNetworkFiles" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "PurgeItemsAfterDelay" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanOnlyIfIdle" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScanParameters" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Scan" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "DisableUpdateOnStartupWithoutEngine" /t REG_DWORD /d 1 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleDay" /t REG_DWORD /d 8 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "ScheduleTime" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Signature Updates" /v "SignatureUpdateCatchupInterval" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReporting" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpyNetReportingLocation" /t REG_MULTI_SZ /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "EnableWebContentEvaluation" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Policies\Microsoft\Edge" /v "SmartScreenEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Security Health\State" /v "AppAndBrowser_StoreAppsSmartScreenOff" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "SmartScreenEnabled" /t REG_SZ /d "Off" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Internet Explorer\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "EnabledV9" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" /v "PreventOverride" /t REG_DWORD /d 0 /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControl" /t REG_SZ /d "Anywhere" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" /v "ConfigureAppInstallControlEnabled" /t REG_DWORD /d "0" /f >nul 2>&1

			if "%SelectedSourceOS%" neq "w10" if "%SelectedSourceOS%" neq "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Gwx" /v "DisableGwx" /t REG_DWORD /d "1" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpdatePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpgradePeriod" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersion" /t REG_DWORD /d "1" /f >nul 2>&1
				if "%ImageBuild%" equ "17134" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1803" /f >nul 2>&1
				if "%ImageBuild%" equ "17763" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1809" /f >nul 2>&1
				if "%ImageBuild%" equ "18362" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1903" /f >nul 2>&1
				if "%ImageBuild%" equ "18363" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "1909" /f >nul 2>&1
				if "%ImageBuild%" equ "19041" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2004" /f >nul 2>&1
				if "%ImageBuild%" equ "19042" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "2009" /f >nul 2>&1
				if "%ImageBuild%" equ "19043" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H1" /f >nul 2>&1
				if "%ImageBuild%" equ "19044" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
				if "%ImageBuild%" equ "22000" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "21H2" /f >nul 2>&1
			)

			Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "SystemSettingsDownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "OptInOOBE" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\7971f918-a847-4430-9279-4a52d1efe18d" /v "RegisteredWithAU" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-DeviceUpdateAgent/Operational" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-WindowsUpdateClient/Operational]" /v "Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v "HideMCTLink" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Speech" /v "AllowSpeechModelUpdate" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\wuauserv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3056" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3058" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3069" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationName" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3009" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul

			if "%ImageArchitecture%" equ "x86" (
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
			)

			if "%ImageArchitecture%" equ "x64" (
				Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
				Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\SysWOW64\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
				Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\SysWOW64\l3codecp.acm" /f >nul
			)

			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul
		)

		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####应用调整已完成#############################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set Tweaks=

endlocal

:: 返回到应用调整菜单
goto :ApplyTweaksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 清理源映像模组
::-------------------------------------------------------------------------------------------
:CleanupSource

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 使用组件清理和 ResetBase 清理源映像
echo.===============================================================================
echo.
:: 卸载映像注册表（如果已安装）
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####正在开始使用组件清理和 ResetBase 清理源映像################################
echo.-------------------------------------------------------------------------------
echo.
if "%IsBootImageSelected%" equ "Yes" (
	:: 使用 ResetBase 选项执行对 [Boot.wim，索引 ：1 和 2] 的映像组件清理
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.正在执行对 [Boot.wim，索引 ：%%i] 的映像组件清理……
		echo.-------------------------------------------------------------------------------
		call :CleanupImage "%BootMount%\%%i", "ComponentCleanupResetBase"
	)
)

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		:: 使用 ResetBase 选项执行对 [Install.wim] 的映像组件清理
		echo.-------------------------------------------------------------------------------
		echo.正在执行对 [Install.wim，索引 ：%%i] 的映像组件清理……
		echo.-------------------------------------------------------------------------------
		if exist "%InstallMount%\%%i\Windows\WinSxS\pending.xml" (
			echo.
			echo.当 Pending.xml 存在时无法执行映像组件清理……
			echo.
		) else (
			call :CleanupImage "%InstallMount%\%%i", "ComponentCleanupResetBase"
		)
	)
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	:: 使用 ResetBase 选项执行对 [WinRE.wim] 的映像组件清理
	echo.-------------------------------------------------------------------------------
	echo.正在执行对 [Install.wim，索引 ：!DefaultIndexNo! -^> WinRE.wim] 的映像组件清理……
	echo.-------------------------------------------------------------------------------
	call :CleanupImage "%WinReMount%", "ComponentCleanupResetBase"
)

echo.-------------------------------------------------------------------------------
echo.####使用组件清理和 ResetBase 清理源映像已完成##################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause

:: 返回到应用菜单
goto :ApplyMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 应用、保存与优化更改到源映像模组
::-------------------------------------------------------------------------------------------
:SaveSource

setlocal

set "TrimEditions=No"

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 应用并保存更改到源映像
echo.===============================================================================
echo.
:: 卸载映像注册表（如果已安装）
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####正在开始应用并保存更改到源映像#############################################
echo.-------------------------------------------------------------------------------
echo.
if /i "%ImageIndexNo%" neq "A" if %ImageCount% neq 1 (
	choice /C:NY /N /M "你想要修整未选择的映像版本吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 set "TrimEditions=Yes"
	echo.
)

choice /C:YN /N /M "你是否要清理映像 Windows 文件夹 ？ [是‘Y’/否‘N’] ："
echo.
if %errorlevel% equ 1 (
	echo.-------------------------------------------------------------------------------
	echo.正在清理映像文件夹……
	echo.-------------------------------------------------------------------------------
	echo.
	echo.正在清理映像 Windows 临时和日志文件或文件夹。
	:: 执行对 [Boot.wim，索引 ：1 和 2] 映像 Windows 文件夹清理
	if "%IsBootImageSelected%" equ "Yes" (
		for /l %%i in (1, 1, 2) do (
			if exist "%BootMount%\%%i\Users\Default\*.LOG1" del /f /q "%BootMount%\%%i\Users\Default\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.LOG2" del /f /q "%BootMount%\%%i\Users\Default\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.TM.blf" del /f /q "%BootMount%\%%i\Users\Default\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Users\Default\*.regtrans-ms" del /f /q "%BootMount%\%%i\Users\Default\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\inf\*.log" del /f /q "%BootMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%BootMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%BootMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%i >nul 2>&1)
				del /s /f /q "%BootMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%BootMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%BootMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Backup\*.*" del /f /q "%BootMount%\Windows\WinSxS\Backup\*.*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
		)
	)

   :: 执行对 [WinRE.wim，索引 ：IndexNo] 映像 Windows 文件夹清理
   if "%IsRecoveryImageSelected%" equ "Yes" (
       if exist "%WinReMount%\Users\Default\*.LOG1" del /f /q "%WinReMount%\Users\Default\*.LOG1" >nul 2>&1
       if exist "%WinReMount%\Users\Default\*.LOG2" del /f /q "%WinReMount%\Users\Default\*.LOG2" >nul 2>&1
       if exist "%WinReMount%\Users\Default\*.TM.blf" del /f /q "%WinReMount%\Users\Default\*.TM.blf" >nul 2>&1
       if exist "%WinReMount%\Users\Default\*.regtrans-ms" del /f /q "%WinReMount%\Users\Default\*.regtrans-ms" >nul 2>&1
       if exist "%WinReMount%\Windows\inf\*.log" del /f /q "%WinReMount%\Windows\inf\*.log" >nul 2>&1

       if exist "%WinReMount%\Windows\CbsTemp\*" (
           for /f %%j in ('"dir /s /b /ad "%WinReMount%\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%j >nul 2>&1)
           del /s /f /q "%WinReMount%\Windows\CbsTemp\*" >nul 2>&1
       )

       if exist "%WinReMount%\Windows\System32\config\*.LOG1" del /f /q "%WinReMount%\Windows\System32\config\*.LOG1" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\config\*.LOG2" del /f /q "%WinReMount%\Windows\System32\config\*.LOG2" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\config\*.TM.blf" del /f /q "%WinReMount%\Windows\System32\config\*.TM.blf" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\config\*.regtrans-ms" del /f /q "%WinReMount%\Windows\System32\config\*.regtrans-ms" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
       if exist "%WinReMount%\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%WinReMount%\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
       if exist "%WinReMount%\Windows\WinSxS\Backup\*.*" del /f /q "%WinReMount%\Windows\WinSxS\Backup\*.*" >nul 2>&1
       if exist "%WinReMount%\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%WinReMount%\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
       if exist "%WinReMount%\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%WinReMount%\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
       if exist "%WinReMount%\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%WinReMount%\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
   )

	for /l %%i in (1, 1, %ImageCount%) do (
		:: 执行对 [Install.wim] 映像 Windows 文件夹清理
		if exist "%InstallMount%\%%i" (
			if exist "%InstallMount%\%%i\$Recycle.Bin" rd /q /s "%InstallMount%\%%i\$Recycle.Bin" >nul 2>&1
			if exist "%InstallMount%\%%i\PerfLogs" rd /q /s "%InstallMount%\%%i\PerfLogs" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.LOG1" del /f /q "%InstallMount%\%%i\Users\Default\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.LOG2" del /f /q "%InstallMount%\%%i\Users\Default\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.TM.blf" del /f /q "%InstallMount%\%%i\Users\Default\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Users\Default\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Users\Default\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\inf\*.log" del /f /q "%InstallMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%InstallMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%InstallMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%i >nul 2>&1)
				del /s /f /q "%InstallMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Windows\System32\SMI\Store\Machine\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Backup\*.*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Backup\*.*" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%InstallMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /f /q "%InstallMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
		)
	)
	echo.
)

:: 保存并卸载源启动映像
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.正在应用更改并卸载源 [Boot.wim，索引 ：%%i] 映像……
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Commit"
		call :RemoveFolder "%BootMount%\%%i"
	)

	:: 使用最大压缩重建源启动映像。
	echo.-------------------------------------------------------------------------------
	echo.正在使用最大压缩优化源 [Boot.wim] 映像……
	echo.-------------------------------------------------------------------------------
	call :ExportImage "%BootWim%", "%Temp%\rebuild.wim", "WIM", "No"
	move /y "%Temp%\rebuild.wim" "%BootWim%" >nul
)

if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.正在应用更改并卸载源 [Install.wim，索引 ：!DefaultIndexNo! -^> WinRE.wim] 映像……
	echo.-------------------------------------------------------------------------------
	call :UnMountImage "%WinReMount%", "Commit"
	call :RemoveFolder "%WinReMount%"

	:: 使用最大压缩重建源恢复映像。
	echo.-------------------------------------------------------------------------------
	echo.正在优化源 [Install.wim，索引 ：!DefaultIndexNo! -^> WinRE.wim] 映像……
	echo.-------------------------------------------------------------------------------
	call :ExportImage "%InstallMount%\!DefaultIndexNo!\%WinReWim%", "%Temp%\rebuild.wim", "WIM", "No"
)

:: 保存并卸载源安装和恢复映像
for /l %%i in (1, 1, %ImageCount%) do (
   if exist "%InstallMount%\%%i" (
		if "%IsRecoveryImageSelected%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			echo.正在复制 Winre.wim 文件到 [Install.wim，索引 ：%%i] 映像……
			echo.-------------------------------------------------------------------------------
			copy /y "%Temp%\rebuild.wim" "%InstallMount%\%%i\%WinReWim%"
			echo.
		)

		echo.-------------------------------------------------------------------------------
		echo.正在应用更改并卸载源 [Install.wim，索引 ：%%i] 映像……
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Commit"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)

if "%IsRecoveryImageSelected%" equ "Yes" del /f /q "%Temp%\rebuild.wim" >nul

:: 使用最大压缩重建源安装映像。
echo.-------------------------------------------------------------------------------
echo.正在使用最大压缩优化源 [Install.wim] 映像……
echo.-------------------------------------------------------------------------------

if "%TrimEditions%" equ "Yes" (
	for %%i in (%ImageIndexNo%) do (
		call :ExportImageIndex "%InstallWim%", %%i, "%Temp%\rebuild.wim", "WIM", "No"
	)
)

if "%TrimEditions%" equ "No" (
	call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
)

move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul
echo.-------------------------------------------------------------------------------
echo.####应用并保存更改到源映像已完成###############################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
echo.
pause

set TrimEditions=

endlocal

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 丢弃更改并卸载源映像模组
::-------------------------------------------------------------------------------------------
:DiscardSource

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 丢弃更改并卸载源映像
echo.===============================================================================
echo.
:: 卸载映像注册表（如果已安装）
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####正在开始丢弃更改并卸载源映像###############################################
echo.-------------------------------------------------------------------------------
echo.
:: 丢弃并卸载源启动映像
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.正在卸载 [Boot.wim，索引 ：%%i] 映像……
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Discard"
		call :RemoveFolder "%BootMount%\%%i"
	)
)

:: 丢弃并卸载源安装和恢复映像
if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	echo.正在卸载 [Install.wim，索引 ：!DefaultIndexNo! -^> WinRE.wim] 映像……
	echo.-------------------------------------------------------------------------------
	call :UnMountImage "%WinReMount%", "Discard"
	call :RemoveFolder "%WinReMount%"
)

for /l %%i in (1, 1, %ImageCount%) do (
   if exist "%InstallMount%\%%i" (
		echo.-------------------------------------------------------------------------------
		echo.正在卸载 [Install.wim，索引 ：%%i] 映像……
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Discard"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)
echo.-------------------------------------------------------------------------------
echo.####丢弃更改并卸载源映像已完成#################################################
echo.-------------------------------------------------------------------------------
echo.

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

:Stop
echo.===============================================================================
echo.
pause

goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 制作用于刻录 DVD 光盘的 DVD ISO 镜像模组
::-------------------------------------------------------------------------------------------
:MakeISO

setlocal

set "BIOSBoot=%DVD%\boot\etfsboot.com"
set "UEFIBoot=%DVD%\efi\microsoft\boot\efisys.bin"
set ISOLabel=
set ISOFileName=

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 制作 DVD ISO 镜像
echo.===============================================================================
echo.

:: 检查源文件是否被应用
if "%IsSourceSelected%" equ "Yes" (
	echo.当源操作系统被选择时，无法使用此功能……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%BIOSBoot%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%BootWim%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" if not exist "%DVD%\sources\*.swm" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

call :CreateFolder "%ISO%"

echo.-------------------------------------------------------------------------------
echo.####正在开始建立 DVD ISO 镜像##################################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 DVD ISO 镜像详细信息##############################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 ISO 卷标名称
set /p ISOLabel=请输入 ISO 卷标 ：
echo.

:: 获取 ISO 文件名称
set /p ISOFileName=请输入 ISO 文件名称 ：
echo.

:: 建立用于使用 BIOS/UEFI 引导的系统的 DVD ISO 镜像。
echo.-------------------------------------------------------------------------------
echo.####正在建立 DVD ISO 映像######################################################
echo.-------------------------------------------------------------------------------
if "%ISOLabel%" equ "" (
	if exist "%UEFIBoot%" "%Oscdimg%" -bootdata:2#p0,e,b"%BIOSBoot%"#pEF,e,b"%UEFIBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
	if not exist "%UEFIBoot%" "%Oscdimg%" -bootdata:1#p0,e,b"%BIOSBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
)

if "%ISOLabel%" neq "" (
	if exist "%UEFIBoot%" "%Oscdimg%" -bootdata:2#p0,e,b"%BIOSBoot%"#pEF,e,b"%UEFIBoot%" -o -h -m -u2 -udfver102 -l"%ISOLabel%" "%DVD%" "%ISO%\%ISOFileName%.iso"
	if not exist "%UEFIBoot%" "%Oscdimg%" -bootdata:1#p0,e,b"%BIOSBoot%" -o -h -m -u2 -udfver102 "%DVD%" "%ISO%\%ISOFileName%.iso"
)
echo.
echo.-------------------------------------------------------------------------------
echo.####建立 DVD ISO 映像已完成####################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set BIOSBoot=
set UEFIBoot=
set ISOLabel=
set ISOFileName=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 刻录 DVD ISO 镜像到 DVD 光盘模组
::-------------------------------------------------------------------------------------------
:BurnISO

setlocal

set DvdDrive=
set ISOFileName=

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 刻录 DVD ISO 镜像到 DVD 光盘
echo.===============================================================================
echo.

:: 检查 ISO 文件夹是否是空的
if not exist "%ISO%\*.iso" (
	echo.ISO 镜像文件夹 ^<ISO^> 是空的……
	echo.
	echo.请复制 ISO 镜像到 ^<ISO^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始刻录 DVD ISO 镜像到 DVD 光盘#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 DVD 驱动器和 DVD ISO 镜像详细信息#################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 ISO 文件名称
set /p ISOFileName=请输入 ISO 文件名称 ：
echo.
:: 获取 DVD 驱动器盘符
set /p DvdDrive=请输入 DVD 盘符 ：
echo.
echo.-------------------------------------------------------------------------------
echo.####正在刻录 DVD ISO 镜像到 DVD 光盘###########################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在刻录 ISO 镜像文件 [%ISOFileName%.iso] 到 DVD 驱动器 [%DvdDrive%:]……
echo.
%DvdBurn% "%DvdDrive%:" "%ISO%\%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####刻录 DVD ISO 镜像到 DVD 光盘已完成#########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set DvdDrive=
set ISOFileName=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 复制源文件夹到 USB 闪存驱动器模组
::-------------------------------------------------------------------------------------------
:CopyUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 复制源文件夹到 USB 闪存驱动器
echo.===============================================================================
echo.

:: 检查源文件是否被应用
if "%IsSourceSelected%" equ "Yes" (
	echo.当源操作系统被选择时，无法使用此功能……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%BootWim%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始复制源文件夹到 USB 闪存驱动器######################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 USB 闪存驱动器选项################################################
echo.-------------------------------------------------------------------------------
echo.
:: 显示可用的 USB 闪存驱动器。
echo.正在列出可用的 USB 闪存驱动器……
call :ListDisks

:: 获取 USB 闪存驱动器盘符
set /p USBDriveLetter=请输入 USB 闪存驱动器盘符 ：

:: 设置 USB 闪存驱动器盘符
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在复制源文件夹到 USB 闪存驱动器##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在复制源文件和文件夹，请稍候……
echo.-------------------------------------------------------------------------------
echo.
echo.源驱动器     ："%DVD%"
echo.目标驱动器   ：%USBDriveLetter%
echo.
%XCopy% "%DVD%" %USBDriveLetter% >nul
echo.-------------------------------------------------------------------------------
echo.####复制源文件夹到 USB 闪存驱动器已完成########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 同步源启动和安装映像到 USB 闪存盘的模组
::-------------------------------------------------------------------------------------------
:SyncUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.              MSMG 工具箱 - 同步源启动和安装映像到 USB 闪存盘
echo.===============================================================================
echo.

:: 检查源文件是否被应用
if "%IsSourceSelected%" equ "Yes" (
	echo.当源操作系统被选择时，无法使用此功能……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%BootWim%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows 安装源文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装源文件到 ^<DVD^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始同步源启动和安装映像到 USB 闪存驱动器##############################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 USB 闪存驱动器选项################################################
echo.-------------------------------------------------------------------------------
echo.
:: 显示可用的 USB 闪存驱动器。
echo.正在列出可用的 USB 闪存驱动器……
call :ListDisks

:: 获取 USB 闪存驱动器盘符
set /p USBDriveLetter=请输入 USB 闪存驱动器盘符 ：

:: 设置 USB 闪存驱动器盘符
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在同步源启动和安装映像到 USB 闪存驱动器##################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在复制源启动和安装映像文件，请稍等……
echo.-------------------------------------------------------------------------------
echo.
echo.源 文 件 ：^<\DVD\Sources\Boot.wim^>
if exist "%DVD%\Sources\install.wim" echo.         ^<\DVD\Sources\Install.wim^>
if exist "%DVD%\Sources\install.esd" echo.         ^<\DVD\Sources\Install.esd^>
echo.目    标 ：^<%USBDriveLetter%\Sources^>
echo.
call :RemoveFile %USBDriveLetter%\Sources\Boot.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.esd

%XCopy% "%DVD%\Sources\boot.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.wim" %XCopy% "%DVD%\Sources\install.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.esd" %XCopy% "%DVD%\Sources\install.esd" %USBDriveLetter%\Sources
echo.
echo.-------------------------------------------------------------------------------
echo.####同步源启动和安装映像到 USB 闪存驱动器已完成################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 刻录 ISO 镜像到 USB 闪存驱动器模组
::-------------------------------------------------------------------------------------------
:BurnUSB

setlocal

set ISOFileName=
set USBDriveLetter=

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 刻录 ISO 镜像到 USB 闪存驱动器
echo.===============================================================================
echo.

:: 检查 ISO 文件夹是否是空的
if not exist "%ISO%\*.iso" (
	echo.ISO 镜像文件夹 ^<ISO^> 是空的……
	echo.
	echo.请复制 ISO 镜像到 ^<ISO^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始刻录 ISO 镜像到 USB 闪存驱动器#####################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 ISO 镜像选项######################################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取 ISO 文件名称
set /p ISOFileName=请输入 ISO 文件名称 ：

:: 设置 ISO 文件名称
set "ISOFileName=%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 USB 闪存驱动器选项################################################
echo.-------------------------------------------------------------------------------
echo.
:: 显示可用的 USB 闪存驱动器。
echo.正在列出可用的 USB 闪存驱动器……
call :ListDisks

:: 获取 USB 闪存驱动器盘符
set /p USBDriveLetter=请输入 USB 闪存驱动器盘符 ：

:: 设置 USB 闪存驱动器盘符
set "USBDriveLetter=%USBDriveLetter%:"

echo.
echo.-------------------------------------------------------------------------------
echo.####正在刻录 ISO 镜像到 USB 闪存驱动器#########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在复制 ISO 镜像文件内容到 USB 闪存驱动器，请稍等……
echo.-------------------------------------------------------------------------------
echo.
echo.源 ISO 文件       ：%ISOFileName%
echo.目标驱动器        ：%USBDriveLetter%
echo.
%Zip% x -y "%ISO%\%ISOFileName%" -o"%USBDriveLetter%"
echo.
echo.-------------------------------------------------------------------------------
echo.####刻录 ISO 镜像到 USB 闪存驱动器已完成#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set ISOFileName=
set USBDriveLetter=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 格式化 USB 闪存驱动器模组
::-------------------------------------------------------------------------------------------
:FormatUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 格式化 USB 闪存驱动器
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始格式化 USB 闪存驱动器##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####正在获取 USB 闪存驱动器选项################################################
echo.-------------------------------------------------------------------------------
echo.
:: 显示可用的 USB 闪存驱动器。
echo.正在列出可用的 USB 闪存驱动器……
call :ListDisks

:: 获取 USB 闪存驱动器盘符
set /p USBDriveLetter=请输入 USB 闪存驱动器盘符 ：
echo.

:: 设置 USB 闪存驱动器盘符
set "USBDriveLetter=%USBDriveLetter%:"

:: 检查指定的 USB 闪存驱动器是否存在
cd /d %USBDriveLetter% 2>nul
if errorlevel 1 (
	echo.指定的 USB 闪存驱动器无效，请再次尝试……
	goto :Stop
)

:: 获取 USB 闪存驱动器卷标。
set /p USBDriveLabel=请输入 USB 闪存驱动器的卷标：
echo.

:: 获取 USB 引导类型（UEFI/BIOS/所有）。
choice /C:12 /N /M "输入 USB 闪存驱动器的启动类型 [1=BIOS，2=BIOS/UEFI] ："
if errorlevel 2 goto :BIOS_UEFI
if errorlevel 1 goto :BIOS

:: 格式化 USB 闪存驱动器为 NTFS 格式，可用于 BIOS 引导系统。
:BIOS
	echo.
	choice /C:YN /N /M "你确定要格式化 [%USBDriveLetter%] 吗？ [是‘Y’/否‘N’] ："
	if errorlevel 2 (
		echo.
		echo.格式化 USB 闪存驱动器 [%USBDriveLetter%] 已取消……
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####格式化 USB 闪存驱动器已停止################################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)
	if errorlevel 1 (
		call :FormatDisk %USBDriveLetter%, NTFS, %USBDriveLabel%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####格式化 USB 闪存驱动器已完成################################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)

:: 格式化 USB 闪存驱动器为 FAT32 格式，可用于 BIOS 和/或 UEFI 引导系统。
:BIOS_UEFI
	echo.
	choice /C:YN /N /M "你确定要格式化 [%USBDriveLetter%] 吗？ [是‘Y’/否‘N’] ："
	if errorlevel 2 (
		echo.
		echo.格式化 USB 闪存驱动器 [%USBDriveLetter%] 已取消……
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####格式化 USB 闪存驱动器已停止################################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)
	if errorlevel 1 (
		call :FormatDisk %USBDriveLetter%, FAT32, %USBDriveLabel%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####格式化 USB 闪存驱动器已完成################################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)

:Stop
echo.
echo.===============================================================================
echo.
pause

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: 返回到主菜单
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 列出所有磁盘和卷模组
::-------------------------------------------------------------------------------------------
:ListDisks

call :RemoveFile "%Temp%\DiskList.txt"
call :RemoveFile "%Temp%\DiskList1.txt"

echo.list volume>> "%Temp%\DiskList.txt"
diskpart /s "%Temp%\DiskList.txt" >> "%Temp%\DiskList1.txt"
call :RemoveFile "%Temp%\DiskList.txt"
echo.>> "%Temp%\DiskList.txt"

echo.===============================================================================>> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "en-US" echo.  Volume #  Letter Label      file Sys Type         Size    Status     Info>> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "zh-CN" echo.  卷 #      盘符   标签       文件系统  类型        大小    状态       信息>> "%Temp%\DiskList.txt"
echo.------------------------------------------------------------------------------->> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "en-US" findstr "Removable" "%Temp%\DiskList1.txt" >> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "zh-CN" findstr "可移动" "%Temp%\DiskList1.txt" >> "%Temp%\DiskList.txt"
echo.===============================================================================>> "%Temp%\DiskList.txt"

type "%Temp%\DiskList.txt"
call :RemoveFile "%Temp%\DiskList.txt"
call :RemoveFile "%Temp%\DiskList1.txt"
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 格式化硬盘/卷模组
:: 输入参数 [ %~1 ：USB 盘符、%~2 ：格式类型、%~3 ：卷标]
::-------------------------------------------------------------------------------------------
:FormatDisk

:: 写入 DiskPart.txt 脚本文件。
call :RemoveFile "%Temp%\DiskPart.txt"
echo.select volume ^%~1>> "%Temp%\DiskPart.txt"
echo.clean>> "%Temp%\DiskPart.txt"
echo.create partition primary>> "%Temp%\DiskPart.txt"
echo.select partition ^1>> "%Temp%\DiskPart.txt"
echo.active>> "%Temp%\DiskPart.txt"
echo.format fs=%~2 quick label=%~3>> "%Temp%\DiskPart.txt"
echo.exit>> "%Temp%\DiskPart.txt"
echo.exit>> "%Temp%\DiskPart.txt"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在格式化 USB 闪存驱动器##################################################
echo.-------------------------------------------------------------------------------
echo.
:: 使用 Diskpart 执行 DiskPart.txt 脚本文件。
echo.正在格式化 USB 闪存驱动器 [%~1] 为 %~2 格式，请稍等……
start /B /wait diskpart /s "%Temp%\DiskPart.txt" >nul
echo.
echo.格式化 USB 闪存驱动器 [%~1] 为 %~2 格式，完成……
call :RemoveFile "%Temp%\DiskPart.txt"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - WIM 管理器
::-------------------------------------------------------------------------------------------
:WIMManager

cls
echo.===============================================================================
echo.                          MSMG 工具箱 - WIM 管理器
echo.===============================================================================
echo.

:: 检查源文件是否被应用.
if "%IsSourceSelected%" equ "Yes" (
	echo.当源操作系统被选择时，无法使用此功能……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :ToolsMenu
)

echo.  [A]   显    示
echo.  [B]   重 命 名
echo.  [C]   删    除
echo.  [D]   导    出
echo.  [E]   转    换
echo.  [F]   拆    分
echo.  [G]   合    并
echo.  [H]   升    级
echo.  [I]   捕    获
echo.  [J]   应    用
echo.  [K]   清    理
echo.  [L]   优    化
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:ABCDEFGHIJKLX /N /M "请输入你的选项 ："
if errorlevel 13 goto :ToolsMenu
if errorlevel 12 goto :WIMOptimize
if errorlevel 11 goto :WIMCleanUp
if errorlevel 10 goto :WIMApply
if errorlevel 9  goto :WIMCapture
if errorlevel 8  goto :WIMUpgrade
if errorlevel 7  goto :WIMMerge
if errorlevel 6  goto :WIMSplit
if errorlevel 5  goto :WIMConvert
if errorlevel 4  goto :WIMExport
if errorlevel 3  goto :WIMDelete
if errorlevel 2  goto :WIMRename
if errorlevel 1  goto :WIMDisplay

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 显示 WIM 映像信息模组
::-------------------------------------------------------------------------------------------
:WIMDisplay

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 显示 WIM 映像信息
echo.===============================================================================

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请将 Windows 安装程序中的“Install.wim”映像复制到相应的文件夹……
	echo.
	echo.===============================================================================
	echo.
	goto :Stop
)

:: 显示映像索引信息
call :ShowImageInfo

:Stop

pause

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 重命名 WIM 索引模组
::-------------------------------------------------------------------------------------------
:WIMRename

setlocal

set NewImageName=
set NewImageDescription=

cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 重命名 WIM 映像索引
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始重命名源 WIM 映像索引##############################################
echo.-------------------------------------------------------------------------------

:: 显示映像索引信息
call :ShowImageInfo

:: 获取映像索引编号以重命名
set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入了无效的索引编号 #……
	echo.
	pause
	goto :WIMRename
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

echo.
set /p NewImageName=请输入 WIM 索引名称 ：
echo.
set /p NewImageDescription=请输入 WIM 索引描述 ：

echo.
echo.-------------------------------------------------------------------------------
echo.正在重命名源 WIM 映像 [Install.wim，索引 ：%ImageIndexNo%] 信息……
echo.-------------------------------------------------------------------------------
echo.
%WimLibImagex% info "%InstallWim%" %ImageIndexNo% "%NewImageName%" "%NewImageDescription%" --image-property DISPLAYNAME="%NewImageName%" --image-property DISPLAYDESCRIPTION="%NewImageDescription%"
echo.
echo.-------------------------------------------------------------------------------
echo.####重命名源 WIM 映像索引已完成################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set NewImageName=
set NewImageDescription=
set ImageIndexNo=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 删除 WIM 索引模组
::-------------------------------------------------------------------------------------------
:WIMDelete

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 删除 WIM 索引
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

:: 查找当前 ESD 映像中的总索引数量
call :GetImageCount "%InstallWim%"

if %ImageCount% equ 1 (
	echo.无法删除单一孤立的映像索引……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始删除源 WIM 映像索引################################################
echo.-------------------------------------------------------------------------------

:: 显示映像信息
call :ShowImageInfo

:: 获取映像索引编号以删除
set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：
echo.

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.输入的索引编号 # 无效，有效范围为 [1、…%ImageCount%，按‘Q’退出]
	echo.
	pause
	goto :WIMDelete
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

echo.-------------------------------------------------------------------------------
echo.正在删除源 WIM 映像 [Install.wim，索引 ：%ImageIndexNo%]……
echo.-------------------------------------------------------------------------------
call :DeleteImage "%InstallWim%", %ImageIndexNo%
echo.-------------------------------------------------------------------------------
echo.####删除源 WIM 映像索引已完成##################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 导出 WIM 索引到源 WIM 映像或新的 WIM 映像模组
::-------------------------------------------------------------------------------------------
:WIMExport

setlocal

set WimImageFileName=
set Export2NewImage=

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 导出 WIM 索引
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始导出源 WIM 映像索引################################################
echo.-------------------------------------------------------------------------------

:: 显示映像信息
call :ShowImageInfo

:: 获取映像索引编号以删除
if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：
) else set /p ImageIndexNo=请输入 WIM 映像索引号 # [范围 ：1、…%ImageCount%，按‘A’选择所有，按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入的索引编号 # 无效，有效范围为 [1、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
	echo.
	pause
	goto :WIMExport
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
    for /l %%i in (2, 1, %ImageCount%) do (
        set "ImageIndexNo=!ImageIndexNo!,%%i"
    )
)

if /i "%ImageIndexNo%" equ "Q" (
   set ImageIndexNo=
   goto :WIMManager
)

echo.
choice /C:YN /N /M "你想要导出为新的 WIM 映像吗 ？ [是‘Y’/否‘N’] ："
if errorlevel 2 set "Export2NewImage=No"
if errorlevel 1 set "Export2NewImage=Yes"

if "%Export2NewImage%" equ "Yes" (
	echo.
	set /p WimImageFileName=请输入 WIM 映像文件名称，不含 [.wim] ：
	set "WimImageFileName=!WimImageFileName!.wim"
)

echo.
echo.-------------------------------------------------------------------------------
echo.####正在导出源 WIM 映像索引####################################################
echo.-------------------------------------------------------------------------------
echo.
for %%i in (%ImageIndexNo%) do (
	echo.-------------------------------------------------------------------------------
	if "!Export2NewImage!" equ "Yes" echo.正在导出源 WIM 映像 [Install.wim，索引 ：%%i] 为 [%WimImageFileName%]…… 
	if "!Export2NewImage!" equ "No" echo.正在导出源 WIM 映像 [Install.wim，索引 ：%%i] 为 [Install.wim]……
	echo.-------------------------------------------------------------------------------
	if "!Export2NewImage!" equ "Yes" call :ExportImageIndex "%InstallWim%", %%i, "%DVD%\sources\%WimImageFileName%", "WIM", "No"
	if "!Export2NewImage!" equ "No" call :ExportImageIndex "%InstallWim%", %%i, "%InstallWim%", "WIM", "No"
)
echo.-------------------------------------------------------------------------------
echo.####导出源 WIM 映像索引已完成##################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set WimImageFileName=
set Export2NewImage=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 转换 WIM 映像为 ESD 映像
::-------------------------------------------------------------------------------------------
:WIMConvert

cls
echo.===============================================================================
echo.                   MSMG 工具箱 - 转换 WIM 映像为 ESD 映像
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始转换 WIM 映像为 ESD 映像###########################################
echo.-------------------------------------------------------------------------------

:: 获取映像索引号以维护
call :GetImageIndexNo "%InstallWim%"

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入的索引编号 # 无效，有效范围为 [1、…%ImageCount%，按‘A’选择所有，按‘Q’退出]
	echo.
	pause
	goto :WIMConvert
)

if /i "%ImageIndexNo%" equ "A" (
	set "ImageIndexNo=1"
    for /l %%i in (2, 1, %ImageCount%) do (
        set "ImageIndexNo=!ImageIndexNo!,%%i"
    )
)

if /i "%ImageIndexNo%" equ "Q" (
   set ImageIndexNo=
   goto :WIMManager
)

echo.
echo.-------------------------------------------------------------------------------
echo.####正在转换 WIM 映像为 ESD 映像###############################################
echo.-------------------------------------------------------------------------------

:: 导出源映像为 ESD 映像
for %%i in (%ImageIndexNo%) do (
	call :ExportImageIndex "%InstallWim%", %%i, "%InstallEsd%", "ESD", "No"
)

:: 删除源映像文件
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####转换 WIM 映像为 ESD 映像已完成#############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 拆分 WIM 映像模组
::-------------------------------------------------------------------------------------------
:WIMSplit

setlocal

set WimImageSplitFileSize=

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 拆分 WIM 映像
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始拆分源 WIM 映像####################################################
echo.-------------------------------------------------------------------------------
echo.
set /p WimImageSplitFileSize=请输入 WIM 映像拆分文件大小 ^(单位 MB^) ：
echo.
echo.-------------------------------------------------------------------------------
echo.正在拆分源 WIM 映像 [Install.wim]……
echo.-------------------------------------------------------------------------------

call :SplitImage "%InstallWim%", "%DVD%\sources\install.swm", %WimImageSplitFileSize%
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####拆分源 WIM 映像已完成######################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set WimImageSplitFileSize=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 合并已拆分的 WIM 映像模组
::-------------------------------------------------------------------------------------------
:WIMMerge

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 合并已拆分的 WIM 映像
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始合并已拆分的源 WIM 映像############################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在合并已拆分的源 WIM 映像 [Install.swm] 为 [Install.wim]……
echo.-------------------------------------------------------------------------------

call :MergeImage "%DVD%\sources\install", "%InstallWim%"
call :RemoveFile "%DVD%\sources\*.swm"

echo.-------------------------------------------------------------------------------
echo.####合并已拆分的源 WIM 映像已完成##############################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 升级 WIM 索引版本模组
::-------------------------------------------------------------------------------------------
:WIMUpgrade

setlocal

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 升级 WIM 版本
echo.===============================================================================

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

:: 显示映像信息
call :ShowImageInfo

:: 获取映像索引号以升级
set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入了无效的索引编号 #……
	echo.
	pause
	goto :WIMUpgrade
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: 获取所选择的映像索引信息
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: 设置选择的源操作系统版本
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"
if "%ImageVersion:~0,-6%" equ "10.0" (
   if "%ImageBuild%" leq "20348" (
       set "SelectedSourceOS=w10"
       set "OSID=10"
   )
   if "%ImageBuild%" geq "22000" (
       set "SelectedSourceOS=w11"
       set "OSID=11"
   )
)

if "%ImageVersion:~0,-6%" equ "11.0" (
   set "SelectedSourceOS=w11"
   set "OSID=11"
)

echo.

:: 检查所选择的源操作系统是否是 Windows 7 企业版
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 7 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 N
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 7 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 K
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseK" (
	echo.Windows 7 企业版 K 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 KN
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseKN" (
	echo.Windows 7 企业版 KN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Ultimate" (
	echo.Windows 7 旗舰版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 N
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateN" (
	echo.Windows 7 旗舰版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 K
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateK" (
	echo.Windows 7 旗舰版 K 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 KN
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateKN" (
	echo.Windows 7 旗舰版 KN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版（含 Media Center）
if "%ImageFlag%" equ "ProfessionalWMC" (
	echo.Windows 8.1 专业版 ^(含 Media Center^) 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版 N
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 8.1 专业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 企业版
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 8.1 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 企业版 N
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 8.1 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 Embedded Industry Pro/Enterprise
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustry" (
	echo.Windows Embedded 8.1 Industry Pro 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 Embedded Industry Enterprise
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustryE" (
	echo.Windows Embedded 8.1 Industry Enterprise 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Datacenter Core
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenterCore" (
	echo.Windows Server 2012 R2 Datacenter Core 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Datacenter
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenter" (
	echo.Windows Server 2012 R2 Datacenter 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Foundation
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerWinFoundation" (
	echo.Windows Server 2012 R2 Foundation 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2012 R2 Standard
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2012 R2 Standard 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2012 R2 Workgroup
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2012 R2 Workgroup 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 10 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 10 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 S
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "Cloud" (
	echo.Windows 10 S 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 S N
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "CloudN" (
	echo.Windows 10 S N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 专业版
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "Professional" (
	echo.Windows 10 专业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 专业版 N
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 10 专业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 企业版 G
if "%ImageFlag%" equ "EnterpriseG" (
	echo.Windows %OSID% 企业版 G 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 企业版 GN
if "%ImageFlag%" equ "EnterpriseGN" (
	echo.Windows %OSID% 企业版 GN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 LTSB
if "%ImageFlag%" equ "EnterpriseS" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 企业版 2015 LTSB 无法升级……
	if "%ImageBuild%" equ "14393" echo.Windows 10 企业版 2016 LTSB 无法升级……
	if "%ImageBuild%" equ "17763" echo.Windows 10 企业版 2019 LTSC 无法升级……
	if "%ImageBuild%" equ "19044" echo.Windows 10 企业版 2021 LTSC 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版 N LTSB
if "%ImageFlag%" equ "EnterpriseSN" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 企业版 N 2015 LTSB 无法升级……
	if "%ImageBuild%" equ "14393" echo.Windows 10 企业版 N 2016 LTSB 无法升级……
	if "%ImageBuild%" equ "17763" echo.Windows 10 企业版 N 2019 LTSC 无法升级……
	if "%ImageBuild%" equ "19044" echo.Windows 10 企业版 N 2021 LTSC 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 IoT 企业版
if "%ImageFlag%" equ "IoTEnterprise" (
	echo.Windows %OSID% IoT 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 IoT 企业版 N
if "%ImageFlag%" equ "IoTEnterpriseN" (
	echo.Windows %OSID% IoT 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 教育版
if "%ImageFlag%" equ "Education" (
	echo.Windows %OSID% 教育版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 教育版 N
if "%ImageFlag%" equ "EducationN" (
	echo.Windows %OSID% 教育版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 适用于虚拟桌面的企业版
if "%ImageFlag%" equ "ServerRdsh" (
	echo.Windows %OSID% 企业版多会话无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Hyper Server 2016
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerHyper" (
	echo.Windows Hyper-V Server 2016 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2016 Azure Core
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerAzureCor" (
	echo.Windows Server 2016 Azure Core 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2016 Datacenter
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerDatacenter" (
	echo.Windows Server 2016 Datacenter 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2016 Standard
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2016 Standard 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2016 Workgroup
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2016 Workgroup 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

set SourceEdition=%ImageFlag%

echo.-------------------------------------------------------------------------------
echo.####正在开始升级 WIM 映像版本##################################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在将 [Install.wim，索引 ：%ImageIndexNo%] 映像安装在 ^<\Mount\Install^>……
echo.-------------------------------------------------------------------------------
call :MountImage "%InstallWim%", %ImageIndexNo%, "%InstallMount%"
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在获取目标版本……
echo.-------------------------------------------------------------------------------
echo.
for /f "tokens=2 delims=:" %%a in ('%DISM% /Image:"%InstallMount%" /Get-TargetEditions ^| find "Target Edition"') do (echo. %%a)
echo.
:: 获取目标版本
set /p TargetEdition=请输入目标版本 ：
echo.

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版零售版本
if "%SelectedSourceOS%" equ "w81" if "%ImageEdition%" equ "Professional" if "%TargetEdition%" equ "ProfessionalWMC" (
	echo.正在检查源映像是否是 Windows 8.1 专业版……
	echo.
	%DISM% /Format:Table /Image:"%InstallMount%" /Get-Packages | findstr /c:"GVLK-Package" >nul
	if not errorlevel 1 (
		echo.选择的源文件不是 Windows 8.1 专业版零售版本……
		echo.
		echo.请使用 Windows 8.1 专业版零售版本操作系统作为源文件……
		goto :Stop
	)
)
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" echo.正在将 Windows 7 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server 2008 R2 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" echo.正在将 Windows 8.1 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Embedded" echo.正在将 Windows 8.1 Embedded %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server 2012 R2 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType%" equ "Client" echo.正在将 Windows 10 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w11" if "%ImageInstallationType%" equ "Client" echo.正在将 Windows 11 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server 2016 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v1709 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v1803 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v1809 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server 2019 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v1903 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18363" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v1909 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19041" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v20H1 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19042" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v20H2 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19043" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v21H1 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19044" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v21H2 %SourceEdition% 升级到 %TargetEdition%……

echo.-------------------------------------------------------------------------------
%DISM% /Image:"%InstallMount%" /Set-Edition:%TargetEdition%
echo.
echo.-------------------------------------------------------------------------------
echo.正在卸载 [Install.wim，索引 ：%ImageIndexNo%] 映像……
echo.-------------------------------------------------------------------------------
call :UnMountImage "%InstallMount%", "Commit"
echo.-------------------------------------------------------------------------------
echo.####正在应用目标 WIM 映像版本属性##############################################
echo.-------------------------------------------------------------------------------
echo.
if "%SelectedSourceOS%" equ "w7"  (
	if "%TargetEdition%" equ "HomeBasic" (
		set "Flag=HomeBasic"
		set "Edition=HomeBasic"
		set "Name=Windows 7 HOMEBASIC"
		set "Description=Windows 7 HOMEBASIC"
		set "DisplayName=Windows 7 家庭普通版"
		set "DisplayDescription=Windows 7 家庭普通版"
	)

	if "%TargetEdition%" equ "HomePremium" (
		set "Flag=HomePremium"
		set "Edition=HomePremium"
		set "Name=Windows 7 HOMEPREMIUM"
		set "Description=Windows 7 HOMEPREMIUM"
		set "DisplayName=Windows 7 家庭高级版"
		set "DisplayDescription=Windows 7 家庭高级版"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows 7 PROFESSIONAL"
		set "Description=Windows 7 PROFESSIONAL"
		set "DisplayName=Windows 7 专业版"
		set "DisplayDescription=Windows 7 专业版"
	)

	if "%TargetEdition%" equ "Ultimate" (
		set "Flag=Ultimate"
		set "Edition=Ultimate"
		set "Name=Windows 7 ULTIMATE"
		set "Description=Windows 7 ULTIMATE"
		set "DisplayName=Windows 7 旗舰版"
		set "DisplayDescription=Windows 7 旗舰版"
	)

	if "%TargetEdition%" equ "HomeBasicN" (
		set "Flag=HomeBasicN"
		set "Edition=HomeBasicN"
		set "Name=Windows 7 HOMEBASICN"
		set "Description=Windows 7 HOMEBASICN"
		set "DisplayName=Windows 7 家庭普通版 N"
		set "DisplayDescription=Windows 7 家庭普通版 N"
	)

	if "%TargetEdition%" equ "HomePremiumN" (
		set "Flag=HomePremiumN"
		set "Edition=HomePremiumN"
		set "Name=Windows 7 HOMEPREMIUMN"
		set "Description=Windows 7 HOMEPREMIUMN"
		set "DisplayName=Windows 7 家庭高级版 N"
		set "DisplayDescription=Windows 7 家庭高级版 N"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows 7 PROFESSIONALN"
		set "Description=Windows 7 PROFESSIONALN"
		set "DisplayName=Windows 7 专业版 N"
		set "DisplayDescription=Windows 7 专业版 N"
	)

	if "%TargetEdition%" equ "UltimateN" (
		set "Flag=UltimateN"
		set "Edition=UltimateN"
		set "Name=Windows 7 ULTIMATEN"
		set "Description=Windows 7 ULTIMATEN"
		set "DisplayName=Windows 7 旗舰版 N"
		set "DisplayDescription=Windows 7 旗舰版 N"
	)

	if "%TargetEdition%" equ "HomeBasicK" (
		set "Flag=HomeBasicK"
		set "Edition=HomeBasicK"
		set "Name=Windows 7 HOMEBASICK"
		set "Description=Windows 7 HOMEBASICK"
		set "DisplayName=Windows 7 家庭普通版 K"
		set "DisplayDescription=Windows 7 家庭普通版 K"
	)

	if "%TargetEdition%" equ "HomePremiumK" (
		set "Flag=HomePremiumK"
		set "Edition=HomePremiumK"
		set "Name=Windows 7 HOMEPREMIUMK"
		set "Description=Windows 7 HOMEPREMIUMK"
		set "DisplayName=Windows 7 家庭高级版 K"
		set "DisplayDescription=Windows 7 家庭高级版 K"
	)

	if "%TargetEdition%" equ "ProfessionalK" (
		set "Flag=ProfessionalK"
		set "Edition=ProfessionalK"
		set "Name=Windows 7 PROFESSIONALK"
		set "Description=Windows 7 PROFESSIONALK"
		set "DisplayName=Windows 7 专业版 K"
		set "DisplayDescription=Windows 7 专业版 K"
	)

	if "%TargetEdition%" equ "UltimateK" (
		set "Flag=UltimateK"
		set "Edition=UltimateK"
		set "Name=Windows 7 ULTIMATEK"
		set "Description=Windows 7 ULTIMATEK"
		set "DisplayName=Windows 7 旗舰版 K"
		set "DisplayDescription=Windows 7 旗舰版 K"
	)

	if "%TargetEdition%" equ "HomeBasicKN" (
		set "Flag=HomeBasicKN"
		set "Edition=HomeBasicKN"
		set "Name=Windows 7 HOMEBASICKN"
		set "Description=Windows 7 HOMEBASICKN"
		set "DisplayName=Windows 7 家庭普通版 KN"
		set "DisplayDescription=Windows 7 家庭普通版 KN"
	)

	if "%TargetEdition%" equ "HomePremiumKN" (
		set "Flag=HomePremiumKN"
		set "Edition=HomePremiumKN"
		set "Name=Windows 7 HOMEPREMIUMKN"
		set "Description=Windows 7 HOMEPREMIUMKN"
		set "DisplayName=Windows 7 家庭高级版 KN"
		set "DisplayDescription=Windows 7 家庭高级版 KN"
	)

	if "%TargetEdition%" equ "ProfessionalKN" (
		set "Flag=ProfessionalKN"
		set "Edition=ProfessionalKN"
		set "Name=Windows 7 PROFESSIONALKN"
		set "Description=Windows 7 PROFESSIONALKN"
		set "DisplayName=Windows 7 专业版 KN"
		set "DisplayDescription=Windows 7 专业版 KN"
	)

	if "%TargetEdition%" equ "UltimateKN" (
		set "Flag=UltimateKN"
		set "Edition=UltimateKN"
		set "Name=Windows 7 ULTIMATEKN"
		set "Description=Windows 7 ULTIMATEKN"
		set "DisplayName=Windows 7 旗舰版 KN"
		set "DisplayDescription=Windows 7 旗舰版 KN"
	)

	if "%TargetEdition%" equ "ServerStandardCore" (
		set "Flag=ServerStandardCore"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2008 R2 SERVERSTANDARDCORE"
		set "Description=Windows Server 2008 R2 SERVERSTANDARDCORE"
		set "DisplayName=Windows Server 2008 R2 Standard ^(服务器核心安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的最小安装，它没有标准的 Windows 用户界面，但可以从命令提示符管理服务器角色的一个子集，从而减少管理要求和攻击面。"
	)

	if "%TargetEdition%" equ "ServerEnterpriseCore" (
		set "Flag=ServerEnterpriseCore"
		set "Edition=ServerEnterprise"
		set "Name=Windows Server 2008 R2 SERVERENTERPRISECORE"
		set "Description=Windows Server 2008 R2 SERVERENTERPRISECORE"
		set "DisplayName=Windows Server 2008 R2 Enterprise ^(服务器核心安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的最小安装，它没有标准的 Windows 用户界面，但可以从命令提示符管理服务器角色的一个子集，从而减少管理要求和攻击面。"
	)

	if "%TargetEdition%" equ "ServerDatacenterCore" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2008 R2 SERVERDATACENTERCORE"
		set "Description=Windows Server 2008 R2 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2008 R2 Datacenter ^(服务器核心安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的最小安装，它没有标准的 Windows 用户界面，但可以从命令提示符管理服务器角色的一个子集，从而减少管理要求和攻击面。"
	)

	if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2008 R2 SERVERSTANDARD"
		set "Description=Windows Server 2008 R2 SERVERSTANDARD"
		set "DisplayName=Windows Server 2008 R2 Standard ^(完全安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的完整安装。该安装包括整个用户界面，并且它支持所有服务器角色。"
	)

	if "%TargetEdition%" equ "ServerEnterprise" (
		set "Flag=ServerEnterprise"
		set "Edition=ServerEnterprise"
		set "Name=Windows Server 2008 R2 SERVERENTERPRISE"
		set "Description=Windows Server 2008 R2 SERVERENTERPRISE"
		set "DisplayName=Windows Server 2008 R2 Enterprise ^(完全安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的完整安装。该安装包括整个用户界面，并且它支持所有服务器角色。"
	)

	if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2008 R2 SERVERDATACENTER"
		set "Description=Windows Server 2008 R2 SERVERDATACENTER"
		set "DisplayName=Windows Server 2008 R2 Datacenter ^(完全安装^)"
		set "DisplayDescription=该选项安装 Windows Server 的完整安装。该安装包括整个用户界面，并且它支持所有服务器角色。"
	)
)

if "%SelectedSourceOS%" equ "w81" (
	if "%TargetEdition%" equ "Core" (
		set "Flag=Core"
		set "Edition=Core"
		set "Name=Windows 8.1 Core"
		set "Description=Windows 8.1 Core"
		set "DisplayName=Windows 8.1 Core"
		set "DisplayDescription=Windows 8.1 Core"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows 8.1 专业版"
		set "Description=Windows 8.1 专业版"
		set "DisplayName=Windows 8.1 专业版"
		set "DisplayDescription=Windows 8.1 专业版"
	)

	if "%TargetEdition%" equ "ProfessionalWMC" (
		set "Flag=ProfessionalWMC"
		set "Edition=ProfessionalWMC"
		set "Name=Windows 8.1 专业版 WMC"
		set "Description=Windows 8.1 专业版 WMC"
		set "DisplayName=Windows 8.1 专业版 ^(含 Media Center^)"
		set "DisplayDescription=Windows 8.1 专业版 ^(含 Media Center^)"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows 8.1 专业版 N"
		set "Description=Windows 8.1 专业版 N"
		set "DisplayName=Windows 8.1 专业版 N"
		set "DisplayDescription=Windows 8.1 专业版 N"
	)

	if "%TargetEdition%" equ "ServerDatacenterCore" (
		set "Flag=ServerDatacenterCore"
		set "Edition=ServerDatacenterCore"
		set "Name=Windows Server 2012 R2 Datacenter ^(服务器核心安装^)"
		set "Description=此选项^(推荐^)通过仅安装运行大多数服务器角色和应用程序所需的内容来减少管理和服务。该选项不包含 GUI，但是可以使用 Windows PowerShell 或其他工具在本地或远程完全管理服务器。以后可以切换到其他安装选项。请参阅“Windows Server 安装选项”。"
		set "DisplayName=Windows Server 2012 R2 Datacenter ^(服务器核心安装^)"
		set "DisplayDescription=此选项^(推荐^)通过仅安装运行大多数服务器角色和应用程序所需的内容来减少管理和服务。该选项不包含 GUI，但是可以使用 Windows PowerShell 或其他工具在本地或远程完全管理服务器。以后可以切换到其他安装选项。请参阅“Windows Server 安装选项”。"
	)

	if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2012 R2 Standard ^(Server with a GUI^)"
		set "Description=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
		set "DisplayName=Windows Server 2012 R2 Standard ^(Server with a GUI^)"
		set "DisplayDescription=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDatacenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2012 R2 Datacenter ^(Server with a GUI^)"
		set "Description=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
		set "DisplayName=Windows Server 2012 R2 Datacenter ^(Server with a GUI^)"
		set "DisplayDescription=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)
)

if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	if "%TargetEdition%" equ "Core" (
		set "Flag=Core"
		set "Edition=Core"
		set "Name=Windows %OSID% 家庭版"
		set "Description=Windows %OSID% 家庭版"
		set "DisplayName=Windows %OSID% 家庭版"
		set "DisplayDescription=Windows %OSID% 家庭版"
	)

	if "%TargetEdition%" equ "CoreN" (
		set "Flag=CoreN"
		set "Edition=CoreN"
		set "Name=Windows %OSID% 家庭版 N"
		set "Description=Windows %OSID% 家庭版 N"
		set "DisplayName=Windows %OSID% 家庭版 N"
		set "DisplayDescription=Windows %OSID% 家庭版 N"
	)

	if "%TargetEdition%" equ "Professional" (
		set "Flag=Professional"
		set "Edition=Professional"
		set "Name=Windows %OSID% 专业版"
		set "Description=Windows %OSID% 专业版"
		set "DisplayName=Windows %OSID% 专业版"
		set "DisplayDescription=Windows %OSID% 专业版"
	)

	if "%TargetEdition%" equ "ProfessionalN" (
		set "Flag=ProfessionalN"
		set "Edition=ProfessionalN"
		set "Name=Windows %OSID% 专业版 N"
		set "Description=Windows %OSID% 专业版 N"
		set "DisplayName=Windows %OSID% 专业版 N"
		set "DisplayDescription=Windows %OSID% 专业版 N"
	)

	if "%TargetEdition%" equ "ProfessionalCountrySpecific" (
		set "Flag=ProfessionalCountrySpecific"
		set "Edition=ProfessionalCountrySpecific"
		set "Name=Windows %OSID% 专业仅中文版"
		set "Description=Windows %OSID% 专业仅中文版"
		set "DisplayName=Windows %OSID% 专业仅中文版"
		set "DisplayDescription=Windows %OSID% 专业仅中文版"
	)

	if "%TargetEdition%" equ "ProfessionalSingleLanguage" (
		set "Flag=ProfessionalSingleLanguage"
		set "Edition=ProfessionalSingleLanguage"
		set "Name=Windows %OSID% 专业单语言版"
		set "Description=Windows %OSID% 专业单语言版"
		set "DisplayName=Windows %OSID% 专业单语言版"
		set "DisplayDescription=Windows %OSID% 专业单语言版"
	)

	if "%TargetEdition%" equ "Education" (
		set "Flag=Education"
		set "Edition=Education"
		set "Name=Windows %OSID% 教育版"
		set "Description=Windows %OSID% 教育版"
		set "DisplayName=Windows %OSID% 教育版"
		set "DisplayDescription=Windows %OSID% 教育版"
	)

	if "%TargetEdition%" equ "EducationN" (
		set "Flag=EducationN"
		set "Edition=EducationN"
		set "Name=Windows %OSID% 教育版 N"
		set "Description=Windows %OSID% 教育版 N"
		set "DisplayName=Windows %OSID% 教育版 N"
		set "DisplayDescription=Windows %OSID% 教育版 N"
	)

	if "%TargetEdition%" equ "Enterprise" (
		set "Flag=Enterprise"
		set "Edition=Enterprise"
		set "Name=Windows %OSID% 企业版"
		set "Description=Windows %OSID% 企业版"
		set "DisplayName=Windows %OSID% 企业版"
		set "DisplayDescription=Windows %OSID% 企业版"
	)

	if "%TargetEdition%" equ "EnterpriseN" (
		set "Flag=EnterpriseN"
		set "Edition=EnterpriseN"
		set "Name=Windows %OSID% 企业版 N"
		set "Description=Windows %OSID% 企业版 N"
		set "DisplayName=Windows %OSID% 企业版 N"
		set "DisplayDescription=Windows %OSID% 企业版 N"
	)

	if "%TargetEdition%" equ "EnterpriseG" (
		set "Flag=EnterpriseG"
		set "Edition=EnterpriseG"
		set "Name=Windows %OSID% 企业版 G"
		set "Description=Windows %OSID% 企业版 G"
		set "DisplayName=Windows %OSID% 企业版 G"
		set "DisplayDescription=Windows %OSID% 企业版 G"
	)

	if "%TargetEdition%" equ "EnterpriseGN" (
		set "Flag=EnterpriseGN"
		set "Edition=EnterpriseGN"
		set "Name=Windows %OSID% 企业版 GN"
		set "Description=Windows %OSID% 企业版 GN"
		set "DisplayName=Windows %OSID% 企业版 GN"
		set "DisplayDescription=Windows %OSID% 企业版 GN"
	)

	if "%TargetEdition%" equ "ProfessionalEducation" (
		set "Flag=ProfessionalEducation"
		set "Edition=ProfessionalEducation"
		set "Name=Windows %OSID% 专业教育版"
		set "Description=Windows %OSID% 专业教育版"
		set "DisplayName=Windows %OSID% 专业教育版"
		set "DisplayDescription=Windows %OSID% 专业教育版"
	)

	if "%TargetEdition%" equ "ProfessionalEducationN" (
		set "Flag=ProfessionalEducationN"
		set "Edition=ProfessionalEducationN"
		set "Name=Windows %OSID% 专业教育版 N"
		set "Description=Windows %OSID% 专业教育版 N"
		set "DisplayName=Windows %OSID% 专业教育版 N"
		set "DisplayDescription=Windows %OSID% 专业教育版 N"
	)

	if "%TargetEdition%" equ "ProfessionalWorkstation" (
		set "Flag=ProfessionalWorkstation"
		set "Edition=ProfessionalWorkstation"
		set "Name=Windows %OSID% 专业工作站版"
		set "Description=Windows %OSID% 专业工作站版"
		set "DisplayName=Windows %OSID% 专业工作站版"
		set "DisplayDescription=Windows %OSID% 专业工作站版"
	)

	if "%TargetEdition%" equ "ProfessionalWorkstationN" (
		set "Flag=ProfessionalWorkstationN"
		set "Edition=ProfessionalWorkstationN"
		set "Name=Windows %OSID% 专业工作站版 N"
		set "Description=Windows %OSID% 专业工作站版 N"
		set "DisplayName=Windows %OSID% 专业工作站版 N"
		set "DisplayDescription=Windows %OSID% 专业工作站版 N"
	)

	if "%TargetEdition%" equ "ServerRdsh" (
		set "Flag=ServerRdsh"
		set "Edition=ServerRdsh"
		set "Name=Windows %OSID% 企业版多会话"
		set "Description=Windows %OSID% 企业版多会话"
		set "DisplayName=Windows %OSID% 企业版多会话"
		set "DisplayDescription=Windows %OSID% 企业版多会话"
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerAzureCor" (
		set "Flag=ServerAzureCor"
		set "Edition=ServerAzureCor"
		set "Name=Windows Server 2016 SERVERAZURECORE"
		set "Description=Windows Server 2016 SERVERAZURECORE"
		set "DisplayName=Windows Server 2016 Azure"
		set "DisplayDescription=此选项^(推荐使用^)仅安装运行大多数服务器角色和应用程序所需的内容，从而减少了管理和维护工作量。它不包括 GUI，但你可以使用 Windows PowerShell 或其他工具通过本地或远程方式完全管理服务器。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2016 SERVERDATACENTERCORE"
		set "Description=Windows Server 2016 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2016 Datacenter"
		set "DisplayDescription=此选项^(推荐使用^)仅安装运行大多数服务器角色和应用程序所需的内容，从而减少了管理和维护工作量。它不包括 GUI，但你可以使用 Windows PowerShell 或其他工具通过本地或远程方式完全管理服务器。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerSolution" if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2016 SERVERSTANDARD"
		set "Description=Windows Server 2016 SERVERSTANDARD"
		set "DisplayName=Windows Server 2016 Standard ^(桌面体验^)"
		set "DisplayDescription=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2016 SERVERDATACENTER"
		set "Description=Windows Server 2016 SERVERDATACENTER"
		set "DisplayName=Windows Server 2016 Datacenter ^(桌面体验^)"
		set "DisplayDescription=当需要 GUI 时，此选项很有用^(例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性^)。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerSolution" if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2019 SERVERSTANDARD"
		set "Description=Windows Server 2019 SERVERSTANDARD"
		set "DisplayName=Windows Server 2019 Standard ^(桌面体验^)"
		set "DisplayDescription=此选项将安装完整的 Windows 图形环境, 从而消耗额外的驱动器空间。如果你想要使用 Windows 桌面或拥有需要它的应用, 它可能会很有用。"
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2019 SERVERDATACENTER"
		set "Description=Windows Server 2019 SERVERDATACENTER"
		set "DisplayName=Windows Server 2019 Datacenter ^(桌面体验^)"
		set "DisplayDescription=此选项将安装完整的 Windows 图形环境, 从而消耗额外的驱动器空间。如果你想要使用 Windows 桌面或拥有需要它的应用, 它可能会很有用。"
	)
)

:: 设置映像标识、名称和描述以反映目标版本
echo.正在设置映像 [显示名称] 为“%DisplayName%”……
echo.正在设置映像 [显示说明] 为“%DisplayDescription%”……
echo.正在设置映像 [标识] 为“%Flag%”……
echo.正在设置映像 [版本] 为“%Edition%”……
echo.
%WimLibImagex% info "%InstallWim%" %ImageIndexNo% "%Name%" "%Description%" --image-property DISPLAYNAME="%DisplayName%" --image-property DISPLAYDESCRIPTION="%DisplayDescription%" --image-property FLAGS="%Flag%" >nul
echo.-------------------------------------------------------------------------------
echo.####正在复制 EI.CFG 配置文件到 ^<DVD\sources^> 文件夹############################
echo.-------------------------------------------------------------------------------
echo.
echo.正在复制“%TargetEdition%”的版本 EI.CFG 文件到 ^<DVD\sources^> 文件夹。
if exist "%DVD%\sources\EI.CFG" del /f /q "%DVD%\sources\EI.CFG" >nul
(
	echo.[EditionID]
	echo.%TargetEdition%
	echo.
	echo.[Channel]
	echo.Retail
	echo.
	echo.[VL]
	echo.0
)>"%DVD%\sources\EI.CFG"
echo.
echo.-------------------------------------------------------------------------------
echo.####升级源 WIM 映像版本已完成##################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 捕获驱动器或文件夹为 WIM 映像模组
::-------------------------------------------------------------------------------------------
:WIMCapture

setlocal

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

cls
echo.===============================================================================
echo.                MSMG 工具箱 - 捕获驱动器或文件夹为 WIM 映像
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####正在开始捕获驱动器或文件夹为 WIM 映像######################################
echo.-------------------------------------------------------------------------------
echo.
:: 获取源驱动器或文件夹路径以捕获为 WIM 映像
set /p SourceDriveFolder=请输入有效的源驱动器或文件夹路径 ：
echo.
:: 获取目标 WIM 映像文件名称
set /p TargetWimImageFileName=请输入目标 WIM 映像文件名称 ：
echo.
:: 获取目标 WIM 映像名称
set /p TargetWimImageName=请输入目标 WIM 映像名称 ：
echo.
:: 获取目标 WIM 映像描述
set /p TargetWimImageDescription=请输入目标 WIM 映像描述 ：
echo.
:: 获取目标 WIM 映像标识
set /p TargetWimImageEditionFlag=请输入目标 WIM 映像版本 ：
echo.
:: 获取引导标识状态
choice /C:YN /N /M "使目标 WIM 映像可引导 ？ [是‘Y’/否‘N’] ："
if errorlevel 2 set BootFlag=No
if not errorlevel 2 set BootFlag=Yes
echo.
echo.-------------------------------------------------------------------------------
echo.####正在捕获驱动器或文件夹为 WIM 映像##########################################
echo.-------------------------------------------------------------------------------
call :CaptureImage "%DVD%\sources\%TargetWimImageFileName%", "%SourceDriveFolder%", %TargetWimImageName%, %TargetWimImageDescription%, %BootFlag%
echo.-------------------------------------------------------------------------------
echo.####正在设置目标 WIM 映像标识、名称和描述######################################
echo.-------------------------------------------------------------------------------
echo.
:: 设置 WIM 映像标识、名称和描述以反映目标版本
echo.正在设置 WIM 映像 [名称] 为“%TargetWimImageName%”……
echo.
echo.正在设置 WIM 映像 [描述] 为“%TargetWimImageDescription%”……
echo.
echo.正在设置 WIM 映像 [标识] 为“%TargetWimImageEditionFlag%”……
%Imagex% /Flags "%TargetWimImageEditionFlag%" /Info "%DVD%\sources\%TargetWimImageFileName%" 1 %TargetWimImageName% %TargetWimImageDescription% >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####捕获驱动器或文件夹为 WIM 映像已完成########################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 应用 WIM 映像索引到驱动器或文件夹模组
::-------------------------------------------------------------------------------------------
:WIMApply

setlocal

set TargetDriveFolder=

cls
echo.===============================================================================
echo.               MSMG 工具箱 - 应用 WIM 映像索引到驱动器或文件夹
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始应用 WIM 映像索引到驱动器或文件夹##################################
echo.-------------------------------------------------------------------------------

:: 显示映像信息
call :ShowImageInfo

:: 获取映像索引编号以删除
set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入了无效的索引编号 #……
	echo.
	pause
	goto :WIMApply
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: 获取目标驱动器或文件夹路径以应用 WIM 映像索引
echo.
set /p TargetDriveFolder=请输入目标驱动器或文件夹路径 ：
echo.
echo.-------------------------------------------------------------------------------
echo.####正在应用 WIM 映像索引到驱动器或文件夹######################################
echo.-------------------------------------------------------------------------------
echo.
call :ApplyImage "%InstallWim%", %ImageIndexNo%, %TargetDriveFolder%
echo.-------------------------------------------------------------------------------
echo.####应用 WIM 映像索引到驱动器或文件夹已完成####################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set TargetDriveFolder=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 清理 WIM 映像索引模组
::-------------------------------------------------------------------------------------------
:WIMCleanUp

setlocal

set CleanupOption=

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 清理 WIM 映像索引
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.  [1]  清理映像
echo.
echo.  [2]  使用 CheckHealth 清理映像
echo.
echo.  [3]  使用 ScanHealth 清理映像
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "请输入你的选项 ："
if errorlevel 4 goto :ToolsMenu
if errorlevel 3 set "CleanupOption=ScanHealth"
if errorlevel 2 set "CleanupOption=CheckHealth"
if errorlevel 1 set "CleanupOption=CleanupImage"

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 清理 WIM 映像索引
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####正在开始对源 WIM 映像文件进行清理##########################################
if "%CleanupOption%" equ "CheckHealth" echo.####正在开始使用 CheckHealth 对源 WIM 映像文件进行清理#########################
if "%CleanupOption%" equ "ScanHealth" echo.####正在开始使用 CheckHealth 对源 WIM 映像文件进行清理#########################
echo.-------------------------------------------------------------------------------

:: 显示映像信息
call :ShowImageInfo

:: 获取映像索引编号以清理
set /p ImageIndexNo=请输入 WIM 映像索引号 # [按‘Q’退出] ：

:: 检查映像索引有效性
if not defined ImageIndexNo (
	echo.
	echo.输入了无效的索引编号 #……
	echo.
	pause
	goto :WIMCleanUp
)

if /i "%ImageIndexNo%" equ "Q" goto :WIMManager

:: 获取所选择的映像索引信息
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: 设置所选择的源操作系统
if "%ImageVersion%" equ "6.1.7601" set "SelectedSourceOS=w7"
if "%ImageVersion%" equ "6.3.9600" set "SelectedSourceOS=w81"
if "%ImageVersion:~0,-6%" equ "10.0" (
	if "%ImageBuild%" leq "19044" set "SelectedSourceOS=w10"
	if "%ImageBuild%" geq "22000" set "SelectedSourceOS=w11"
)
if "%ImageVersion:~0,-6%" equ "11.0" if "%ImageBuild%" geq "22000" set "SelectedSourceOS=w11"

echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####清理源 WIM 映像############################################################
if "%CleanupOption%" equ "CheckHealth" echo.####使用 CheckHealth 清理源 WIM 映像###########################################
if "%CleanupOption%" equ "ScanHealth" echo.####使用 ScanHealth 清理源 WIM 映像############################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在将 [Install.wim，索引 ：%ImageIndexNo%] 的 WIM 映像安装在 ^<\Mount\Install^> 中……
echo.-------------------------------------------------------------------------------
call :MountImage "%InstallWim%", %ImageIndexNo%, "%InstallMount%"
echo.-------------------------------------------------------------------------------
echo.正在执行对 [Install.wim，索引 ：%ImageIndexNo%] 的 WIM 映像清理……
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" (
	if "%SelectedSourceOS%" equ "w7" call :CleanupImage "%InstallMount%", "SPSupersededHideSP"
	if "%SelectedSourceOS%" neq "w7" call :CleanupImage "%InstallMount%", "ComponentCleanupResetBase"
) else (
	call :CleanupImage "%InstallMount%", "ComponentCleanup", "%CleanupOption%"
)
echo.-------------------------------------------------------------------------------
echo.正在应用更改并卸载源 [Install.wim，索引 ：%ImageIndexNo%] WIM 映像……
echo.-------------------------------------------------------------------------------
call :UnMountImage "%InstallMount%", "Commit"
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####源 WIM 映像清理已完成######################################################
if "%CleanupOption%" equ "CheckHealth" echo.####使用 CheckHealth 对源 WIM 映像的清理已完成#################################
if "%CleanupOption%" equ "ScanHealth" echo.####使用 ScanHealth 对源 WIM 映像的清理已完成##################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
echo.
pause

set CleanupOption=

endlocal

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 优化源 WIM 映像中的 WIM 索引模组
::-------------------------------------------------------------------------------------------
:WIMOptimize

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 优化 WIM 映像
echo.===============================================================================
echo.

:: 检查 Windows 源安装映像文件是否存在
if not exist "%InstallWim%" (
	echo.无法找到 Windows 安装程序安装映像 ^<DVD\Sources\install.wim^> 文件……
	echo.
	echo.请复制 Windows 安装程序安装映像到相应的文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始优化源 WIM 映像####################################################
echo.-------------------------------------------------------------------------------
:: 显示映像信息
call :ShowImageInfo
echo.-------------------------------------------------------------------------------
echo.####正在优化源 WIM 映像########################################################
echo.-------------------------------------------------------------------------------
call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul
echo.-------------------------------------------------------------------------------
echo.####优化源 WIM 映像已完成######################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

:: 返回到 WIM 管理器菜单
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 显示 MSMG 工具箱调试信息模组
::-------------------------------------------------------------------------------------------
:Debug

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 调试信息
echo.===============================================================================
echo.
echo. HostArchitecture=%HostArchitecture%
echo. SelectedSourceOS=%SelectedSourceOS%
echo. IsSourceSelected=%IsSourceSelected%
echo. IsDialogsEnabled=%IsDialogsEnabled%
echo. IsLogsEnabled=%IsLogsEnabled%
echo.
echo.
echo.
echo. ImageIndexNo=%ImageIndexNo%
echo. ImageArchitecture=%ImageArchitecture%
echo. ImageBuild=%ImageBuild%
echo. ImageVersion=%ImageVersion%
echo. ImageServicePackBuild=%ImageServicePackBuild%
echo. ImageServicePackLevel=%ImageServicePackLevel%
echo. ImageDefaultLanguage=%ImageDefaultLanguage%
echo. ImageCount=%ImageCount%
echo.
echo.===============================================================================
echo.
pause

:: 返回到工具菜单
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 选项菜单
::-------------------------------------------------------------------------------------------
:Options

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 选项菜单
echo.===============================================================================
echo.
echo.  [1]   配置工具箱颜色设置
echo.
if "%IsDialogsEnabled%" equ "No" echo.  [2]   启用工具箱信息/警告对话框
if "%IsDialogsEnabled%" equ "Yes" echo.  [2]   禁用工具箱信息/警告对话框
echo.
if "%IsLogsEnabled%" equ "No" echo.  [3]   启用工具箱日志生成
if "%IsLogsEnabled%" equ "Yes" echo.  [3]   禁用工具箱日志生成
echo.
if "%IsImageRegistryLoaded%" equ "No" echo.  [4]   加载映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" echo.  [4]   卸载映像注册表
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:1234X /N /M "请输入你的选项 ："
if errorlevel 5 goto :ToolsMenu
if errorlevel 4 (
	if "%IsImageRegistryLoaded%" equ "No" (
		cls
		echo.===============================================================================
		echo.                          MSMG 工具箱 - 映像注册表
		echo.===============================================================================
		echo.
		:: 检查源操作系统是否已选择
		if "%IsSourceSelected%" equ "No" (
			echo.尚未选择源操作系统，请从“源文件”菜单中选择……
			echo.
			echo.===============================================================================
			echo.
			pause
			goto :MainMenu
		)
		
		:: 检查多索引维护模式是否已启用
		if "%ImageIndexNo:~0,1%" equ "," (
			echo.当多索引维护模式已启用时，此功能不可用……
			echo.
			echo.请使用单一索引重新选择源文件……
			goto :Stop
		)

		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%InstallMount%\%%i" (
				echo.正在加载映像注册表……
				call :MountImageRegistry "%InstallMount%\%%i"
			)
		)

		set "IsImageRegistryLoaded=Yes"
		echo.
		echo.[HKEY_LOCAL_MACHINE\TK_SOFTWARE]         -^> [HKEY_LOCAL_MACHINE\SOFTWARE]
		echo.[HKEY_LOCAL_MACHINE\TK_SOFTWARE\Classes] -^> [HKEY_CLASSES_ROOT]
		echo.[HKEY_LOCAL_MACHINE\TK_SYSTEM]           -^> [HKEY_LOCAL_MACHINE\SYSTEM]
		echo.[HKEY_LOCAL_MACHINE\TK_NTUSER]           -^> [HKEY_CURRENT_USER]
		echo.[HKEY_LOCAL_MACHINE\TK_DEFAULT]          -^> [HKEY_USERS\.Default]
		echo.
		echo.加载映像注册表完成……
		echo.
		echo.===============================================================================
		echo.
		pause
	)
	if "%IsImageRegistryLoaded%" equ "Yes" (
		cls
		echo.===============================================================================
		echo.                          MSMG 工具箱 - 映像注册表
		echo.===============================================================================
		echo.
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		set "IsImageRegistryLoaded=No"
		echo.
		echo.卸载映像注册表完成……
		echo.
		echo.===============================================================================
		echo.
		pause
	)
	goto :Toolsmenu
)
if errorlevel 3 (
	if "%IsLogsEnabled%" equ "No" set "IsLogsEnabled=Yes"
	if "%IsLogsEnabled%" equ "Yes" set "IsLogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 2 (
	if "%IsDialogsEnabled%" equ "No" set "IsDialogsEnabled=Yes"
	if "%IsDialogsEnabled%" equ "Yes" set "IsDialogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 1 goto :SetTkColor

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 配置工具箱颜色设置模组
::-------------------------------------------------------------------------------------------
:SetTkColor

cls
echo.===============================================================================
echo.                      MSMG 工具箱 - 配置工具箱配色设置
echo.===============================================================================
echo. 可用于配置的背景色 / 前景色列表 ：
echo.
echo.  [1]  黑色   - 白色                [F]  水蓝色 - 蓝色
echo.  [2]  黑色   - 浅绿色              [G]  水蓝色 - 亮蓝色
echo.  [3]  黑色   - 淡蓝色              [H]  水蓝色 - 亮黄色
echo.  [4]  黑色   - 浅红色              [I]  红色   - 亮绿色
echo.  [5]  黑色   - 浅黄色              [J]  红色   - 淡蓝色
echo.  [6]  黑色   - 亮白色              [K]  红色   - 亮黄色
echo.  [7]  蓝色   - 白色                [L]  红色   - 亮白色
echo.  [8]  蓝色   - 浅绿色              [M]  浅蓝色 - 白色
echo.  [9]  蓝色   - 淡蓝色              [N]  浅蓝色 - 亮绿色
echo.  [A]  蓝色   - 亮红色              [O]  浅蓝色 - 淡蓝色
echo.  [B]  蓝色   - 浅紫色              [P]  浅蓝色 - 亮黄色
echo.  [C]  蓝色   - 浅黄色              [Q]  浅蓝色 - 亮白色
echo.  [D]  蓝色   - 亮白色              [R]  亮白色 - 黑色
echo.  [E]  水蓝色 - 黑色                [S]  亮白色 - 蓝色
echo.
echo.  [X]  返回
echo.===============================================================================
echo.
choice /C:123456789ABCDEFGHIJKLMNoPQRSX /N /M "请输入你的选项 ："
if errorlevel 29 goto :Options
if errorlevel 28 color F1
if errorlevel 27 color F0
if errorlevel 26 color 9F
if errorlevel 25 color 9E
if errorlevel 24 color 9B
if errorlevel 23 color 9A
if errorlevel 22 color 97
if errorlevel 21 color 4F
if errorlevel 20 color 4E
if errorlevel 19 color 4B
if errorlevel 18 color 4A
if errorlevel 17 color 3E
if errorlevel 16 color 39
if errorlevel 15 color 31
if errorlevel 14 color 30
if errorlevel 13 color 1F
if errorlevel 12 color 1E
if errorlevel 11 color 1D
if errorlevel 10 color 1C
if errorlevel 9  color 1B
if errorlevel 8  color 1A
if errorlevel 7  color 17
if errorlevel 6  color 0F
if errorlevel 5  color 0E
if errorlevel 4  color 0C
if errorlevel 3  color 0B
if errorlevel 2  color 0A
if errorlevel 1  color 07

:: 返回到工具菜单
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

:: ############################################################################################
:: MSMG 工具箱 DISM 模组
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: 获取映像索引总数模组
:: 输入参数 [ %~1 ：映像文件名称 ]
::-------------------------------------------------------------------------------------------
:GetImageCount

:: 查找映像中存在的索引总数。
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-ImageInfo /ImageFile:%~1 ^| findstr Index') do (set ImageCount=%%a)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 显示映像信息模组
::-------------------------------------------------------------------------------------------
:ShowImageInfo

set "ImageInfo=%Temp%\ImageInfo.txt"

call :RemoveFile %ImageInfo%

:: 获取映像中存在的索引总数。
call :GetImageCount "%InstallWim%"

echo.
echo.正在读取映像信息……
echo.
:: 列出映像中的所有索引。
echo.===============================================================================>>%ImageInfo%
echo.^|索引    ^| 体系结构    ^| 名称>>%ImageInfo%
echo.===============================================================================>>%ImageInfo%
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% ^| findstr Index') do (
	for /f "tokens=2 delims=: " %%b in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:" %%c in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Name') do (
			if "%%b" neq "arm64" (
				if %%a leq 9 echo.^|   %%a    ^| %%b         ^| %%c>>%ImageInfo%
				if %%a gtr 9 if %%a lss 99 echo.^|   %%a    ^| %%b        ^| %%c>>%ImageInfo%
				if %%a gtr 99 echo.^|   %%a    ^| %%b       ^| %%c>>%ImageInfo%
			)
			if "%%b" equ "arm64" (
				if %%a leq 9 echo.^|   %%a    ^| %%b         ^| %%c>>%ImageInfo%
				if %%a gtr 9 if %%a lss 99 echo.^|   %%a    ^| %%b        ^| %%c>>%ImageInfo%
				if %%a gtr 99 echo.^|   %%a    ^| %%b       ^| %%c>>%ImageInfo%
			)
		)
	)
)

type %ImageInfo%
call :RemoveFile %ImageInfo%

echo.===============================================================================
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取映像索引编号用于服务模组
:: 输入参数 [ %~1 ：映像文件名称 ]
::-------------------------------------------------------------------------------------------
:GetImageIndexNo

:: 显示可用映像索引列表。
call :ShowImageInfo

if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=请输入映像索引编号 # 的 [按‘Q’退出] ：
) else set /p ImageIndexNo=请输入映像索引编号 # 的 [范围 ：1、…%ImageCount% 或者按‘A’选择所有，按‘Q’退出] ：

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取映像索引体系结构模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号 ]
::-------------------------------------------------------------------------------------------
:GetImageArchitecture

for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do (set ImageArchitecture=%%a)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取映像索引信息模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号 ]
::-------------------------------------------------------------------------------------------
:GetImageEdition

for /f "tokens=2 delims=: " %%f in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do (set ImageEdition=%%f)

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取映像索引信息模组
:: 输入参数 [%~1 ：映像文件名称、%~2 ：映像索引编号]
::-------------------------------------------------------------------------------------------
:GetImageIndexInfo

for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Name') do (set ImageName=%%a)
for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Description') do (set ImageDescription=%%b)
for /f "tokens=2 delims=: " %%c in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do (set ImageArchitecture=%%c)
for /f "tokens=2 delims=: " %%d in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Version') do (set ImageVersion=%%d)
for /f "tokens=2 delims=:" %%e in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Build"') do (set ImageServicePackBuild=%%e)
for /f "tokens=2 delims=:" %%f in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Level"') do (set ImageServicePackLevel=%%f)
for /f "tokens=2 delims=: " %%g in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do (set ImageEdition=%%g)
for /f "tokens=2 delims=:<> " %%h in ('%Imagex% /info "%~1" %~2 ^| findstr /i Flag') do (set ImageFlag=%%h)
for /f "tokens=2 delims=:" %%i in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Installation') do (set ImageInstallationType=%%i)
for /f "tokens=* delims=" %%j in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Default') do (set ImageDefaultLanguage=%%j)

set "ImageName=%ImageName:~1%"
set "ImageDescription=%ImageDescription:~1%"

if "%ImageVersion:~0,-6%" neq "10.0" if "%ImageVersion:~0,-6%" neq "11.0" set /A ImageBuild=%ImageVersion:~4,4%
if "%ImageVersion%" neq "6.1.7601" if "%ImageVersion%" neq "6.3.9600" set /A ImageBuild=%ImageVersion:~5,5%

set "ImageServicePackBuild=%ImageServicePackBuild:~1%"
set "ImageServicePackLevel=%ImageServicePackLevel:~1%"
set "ImageInstallationType=%ImageInstallationType:~1%"
set "ImageDefaultLanguage=%ImageDefaultLanguage:~1,-10%"

if "%ImageFlag%" equ "" set "ImageFlag=%ImageEdition%"

if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:(=[%"
if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:)=]%"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取已更新的映像索引信息模组
::-------------------------------------------------------------------------------------------
:GetUpdatedImageInformation

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		call :MountImageRegistry "%InstallMount%\%%i"
		for /f "tokens=3 delims= " %%x in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild" ^| find "REG_SZ"') do (set /a ImageBuild=%%x)
		set "ImageVersion=10.0.!ImageBuild!"
		for /f "tokens=3 delims= " %%y in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "UBR" ^| find "REG_DWORD"') do (set /a ImageServicePackBuild=%%y)
		call :UnMountImageRegistry
	)
)

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 安装映像模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号、%~3 ：映像安装文件夹 ]
::-------------------------------------------------------------------------------------------
:MountImage

%DISM% /Mount-Image /ImageFile:%~1 /Index:%~2 /MountDir:%~3
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 卸载已安装映像模组
:: 输入参数 [ %~1 ：映像安装文件夹、%~2 ：映像提交 / 丢弃选项 ]
::-------------------------------------------------------------------------------------------
:UnMountImage

%DISM% /Unmount-Image /MountDir:%~1 /%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从映像中删除选定映像索引模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号 ]
::-------------------------------------------------------------------------------------------
:DeleteImage

%DISM% /Delete-Image /ImageFile:%~1 /Index:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 重命名选定映像索引信息模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号、%~3 ：映像名称、%~4 ：映像描述 ]
::-------------------------------------------------------------------------------------------
:RenameImage

%Imagex% /Info %~1 %~2 "%~3" "%~4"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 拆分映像模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像拆分文件名称、%~3 ：映像拆分大小，单位 MB ]
::-------------------------------------------------------------------------------------------
:SplitImage

%DISM% /Split-Image /ImageFile:%~1 /SWMFile:%~2 /FileSize:%~3
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 合并已拆分映像模组
:: 输入参数 [ %~1 ：无扩展名的映像拆分文件名、%~2 ：映像文件名称 ]
::-------------------------------------------------------------------------------------------
:MergeImage

%Imagex% /ref %~1*.swm /Check /Export %~1.swm * %~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 应用映像驱动器或文件夹模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：映像索引编号、%~3 ：映像应用驱动器或文件夹名称 ]
::-------------------------------------------------------------------------------------------
:ApplyImage

%DISM% /Apply-Image /ImageFile:%~1 /Index:%~2 /ApplyDir:%~3\ /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 捕获驱动器或文件夹为映像模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：捕获驱动器或文件夹名称、
::            %~3 ：索引名称、%~4 ：索引描述、%~5 ：可启动或未配置 ]
::-------------------------------------------------------------------------------------------
:CaptureImage

if "%~5" equ "Yes" %DISM% /Capture-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Bootable /Compress:Max /CheckIntegrity /Verify
if "%~5" equ "No" %DISM% /Capture-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Compress:Max /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 追加另一个映像到映像模组
:: 输入参数 [ %~1 ：映像文件名称、%~2 ：捕获驱动器或文件夹名称、
::            %~3 ：索引名称、%~4 ：索引描述、%~5 ：可启动或未配置 ]
::-------------------------------------------------------------------------------------------
:AppendImage

if "%~5" equ "Yes" %DISM% /Append-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /Bootable /CheckIntegrity /Verify
if "%~5" equ "No" %DISM% /Append-Image /Imagefile:%~1 /CaptureDir:%~2 /Name:"%~3" /Description:"%~4" /ConfigFile:%WimConfigFile% /CheckIntegrity /Verify
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用最大/恢复压缩导出选定映像索引模组
:: 输入参数 [ %~1 ：源映像文件名称、%~2 ：源映像索引编号、
::            %~3 ：目标映像文件名称、%~4 ：映像格式、%~5 ：可启动或未配置 ]
::-------------------------------------------------------------------------------------------
:ExportImageIndex

if "%~4" equ "WIM" if "%~5" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Max /Bootable
if "%~4" equ "WIM" if "%~5" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Max
if "%~4" equ "ESD" if "%~5" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Recovery /Bootable
if "%~4" equ "ESD" if "%~5" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /SourceIndex:%~2 /DestinationImageFile:%~3 /CheckIntegrity /Compress:Recovery
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 使用最大/恢复压缩导出所有映像索引模组
:: 输入参数 [ %~1 ：源映像文件名称、%~2 ：目标映像文件名称、%~3 ：映像格式、%~4 ：可启动或未配置 ]
::-------------------------------------------------------------------------------------------
:ExportImage

if "%~3" equ "WIM" if "%~4" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Max /Bootable
if "%~3" equ "WIM" if "%~4" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Max
if "%~3" equ "ESD" if "%~4" equ "Yes" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Recovery /Bootable
if "%~3" equ "ESD" if "%~4" equ "No" %DISM% /Export-Image /SourceImageFile:%~1 /All /DestinationImageFile:%~2 /CheckIntegrity /Compress:Recovery
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 清理映像模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：选项  ]
::-------------------------------------------------------------------------------------------
:CleanupImage

setlocal

set "CleanupOption=%~2"

if "%CleanupOption%" equ "SPSupersededHideSP" (
	%DISM% /Image:%~1 /Cleanup-Image /SPSuperseded /HideSP
)

if "%CleanupOption%" equ "ComponentCleanupResetBase" (
	%DISM% /Image:%~1 /Cleanup-Image /StartComponentCleanup /ResetBase
)

if "%CleanupOption%" equ "CheckHealth" (
	%DISM% /Image:%~1 /Cleanup-Image /CheckHealth
)

if "%CleanupOption%" equ "ScanHealth" (
	%DISM% /Image:%~1 /Cleanup-Image /ScanHealth
)

echo.

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 添加驱动包到映像模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：驱动包路径 ]
::-------------------------------------------------------------------------------------------
:AddDriver

%DISM% /Image:%~1 /Add-Driver /Driver:%~2 /ForceUnsigned /Recurse
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 启用映像中的功能模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：功能名称 ]
::-------------------------------------------------------------------------------------------
:EnableFeature

%DISM% /Image:%~1 /Enable-Feature /FeatureName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 禁用映像中的功能模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：功能名称 ]
::-------------------------------------------------------------------------------------------
:DisableFeature

%DISM% /Image:%~1 /Disable-Feature /FeatureName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 导出映像中存在的程序包列表到文件模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：文件名称 ]
::-------------------------------------------------------------------------------------------
:GetPackages

%DISM% /Get-Packages /Image:%~1 > %Logs%\%~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 导出映像中存在的功能列表到文件模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：文件名称 ]
::-------------------------------------------------------------------------------------------
:GetFeatures

%DISM% /Get-Features /Format:Table /Image:%~1 > %Logs%\%~2

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 添加程序包到映像模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：程序包路径 / 程序包名称 ]
::-------------------------------------------------------------------------------------------
:AddPackage

%DISM% /Image:%~1 /Add-Package /PackagePath:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从映像中移除程序包模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：程序包路径 / 程序包名称 ]
::-------------------------------------------------------------------------------------------
:RemovePackage

%DISM% /Image:%~1 /Remove-Package /PackageName:%~2
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 添加预装 Appx 程序包模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：应用名称、%~3 ：应用程序包路径、%~4 ：应用许可路径、%~5 ：应用依赖包程序路径 ]
::-------------------------------------------------------------------------------------------
:AddProvisionedAppxPackage

echo.-------------------------------------------------------------------------------
echo.正在集成%~2预装 Appx 程序包……
echo.-------------------------------------------------------------------------------
%DISM% /Image:%~1 /Add-ProvisionedAppxPackage /PackagePath:%~3 %~4 /LicensePath:%~5
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 移除预装 Appx 程序包模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：应用名称、%~3 ：程序包名称 ]
::-------------------------------------------------------------------------------------------
:RemoveProvisionedAppxPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.正在移除%~2预装 Appx 程序包……
echo.-------------------------------------------------------------------------------

:: 获取预装 Appx 程序包列表
for /f "tokens=2 delims=: " %%a in ('%DISM% /Image:%~1 /Get-ProvisionedAppxPackages ^| find /I "PackageName : %~3"') do (set PackageName=%%a)

if "%PackageName%" equ "" (
	echo.
	echo.指定的预装 Appx 程序包已经被移除……
) else (
	:: 移除映像中的预装 Appx 程序包
	%DISM% /Image:%~1 /Remove-ProvisionedAppxPackage /PackageName:%PackageName%
)

echo.

set PackageName=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从 Windows 映像中移除默认应用关联模组
:: 输入参数 [ %~1 ：映像安装路径 ]
::-------------------------------------------------------------------------------------------
:RemoveDefaultAppAssociations

%DISM% /Image:%~1 /Remove-DefaultAppAssociations

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 将一组默认应用程序关联导入 Windows 映像模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：应用关联 XML 文件名 ]
::-------------------------------------------------------------------------------------------
:ImportDefaultAppAssociations

%DISM% /Image:%~1 /Import-DefaultAppAssociations:%~2

goto :eof
::-------------------------------------------------------------------------------------------

:: ############################################################################################
:: MSMG 工具箱其他模组
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: 用于从映像中移除已锁定/隐藏的 Windows 程序包模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：程序包描述、%~3 ：程序包名称 ]
::-------------------------------------------------------------------------------------------
:RemoveLockedPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.正在移除%~2程序包……
echo.-------------------------------------------------------------------------------

:: 使锁定/隐藏的 Windows 程序包可见
call :UnHidePackage "%~1", %~3

:: 获取 Windows 程序包列表
for /f "tokens=2 delims=:" %%a in ('%DISM% /Image:%~1 /Get-Packages ^| find /I "%~3"') do ( set PackageName=%%a )

if "%PackageName%" neq "" (
	if "%SelectedSourceOS%" equ "w7" (
		for /f "tokens=* delims= " %%a in ("%PackageName%") do set PackageName=%%a
		for /l %%a in (1,1,31) do if "!PackageName:~-1!" equ " " set PackageName=!PackageName:~0,-1!
	)
	if "%SelectedSourceOS%" neq "w7" set PackageName=%PackageName:~1,-1%
)

if "%PackageName%" equ "" (
	echo.
	echo.指定的程序包已经被移除……
	echo.
) else (
	:: 从映像移除 Windows 程序包
	%DISM% /Image:%~1 /Remove-Package /PackageName:%PackageName%
	echo.
)

set PackageName=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 安装映像注册表模组
:: 输入参数 [ %~1 ：映像安装路径 ]
::-------------------------------------------------------------------------------------------
:MountImageRegistry

:: 安装映像注册表用于离线编辑
reg load HKLM\TK_COMPONENTS "%~1\Windows\System32\config\COMPONENTS" >nul
reg load HKLM\TK_DEFAULT "%~1\Windows\System32\config\default" >nul
reg load HKLM\TK_NTUSER "%~1\Users\Default\ntuser.dat" >nul
reg load HKLM\TK_SOFTWARE "%~1\Windows\System32\config\SOFTWARE" >nul
reg load HKLM\TK_SYSTEM "%~1\Windows\System32\config\SYSTEM" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 卸载映像注册表模组
:: 输入参数 [ 无 ]
::-------------------------------------------------------------------------------------------
:UnMountImageRegistry

:: 卸载映像注册表
for /f "tokens=* delims=" %%a in ('reg query "HKLM" ^| findstr "{"') do (
	reg unload "%%a" >nul 2>&1
)

reg unload HKLM\TK_COMPONENTS >nul 2>&1
reg unload HKLM\TK_DRIVERS >nul 2>&1
reg unload HKLM\TK_DEFAULT >nul 2>&1
reg unload HKLM\TK_NTUSER >nul 2>&1
reg unload HKLM\TK_SCHEMA >nul 2>&1
reg unload HKLM\TK_SOFTWARE >nul 2>&1
reg unload HKLM\TK_SYSTEM >nul 2>&1

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 合并注册表设置到映像注册表模组
:: 输入参数 [ %~1 ：要合并的注册表文件名称 ]
::-------------------------------------------------------------------------------------------
:ImportRegistry2Image

:: 合并注册表设置到映像注册表
reg import "%~1"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 创建文件夹模组
:: 输入参数 [ %~1 ：文件夹名称 ]
::-------------------------------------------------------------------------------------------
:CreateFolder

if not exist "%~1" md "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 删除文件模组
:: 输入参数 [ %~1 ：文件名称 ]
::-------------------------------------------------------------------------------------------
:RemoveFile

if exist "%~1" del /f /q "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 删除文件夹模组
:: 输入参数 [ %~1 ：文件夹名称 ]
::-------------------------------------------------------------------------------------------
:RemoveFolder

if exist "%~1" rd /q /s "%~1" >nul

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 取消隐藏 Windows 组件程序包模组
:: 输入参数 [ %~1 ：映像安装路径、%~2 ：程序包名称 ]
::-------------------------------------------------------------------------------------------
:UnHidePackage

setlocal

set RegistryKey=

:: 安装映像注册表
call :MountImageRegistry "%~1" >nul

:: 检索程序包注册表项路径
for /f "tokens=* delims=" %%a in ('reg query "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" /f "%~2" ^| find /I "%~2"') do ( set "RegistryKey=%%a" )

:: 使 Windows 组件包可见
reg add "%RegistryKey%" /v Visibility /t REG_DWORD /d 1 /f >nul 2>&1
reg add "%RegistryKey%" /v DefVis /t REG_DWORD /d 2 /f >nul 2>&1
reg delete "%RegistryKey%\Owners" /f >nul 2>&1

:: 卸载映像注册表
call :UnMountImageRegistry

set RegistryKey=

endlocal

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 清理 MSMG 工具箱的临时文件和文件夹
::-------------------------------------------------------------------------------------------
:CleanUp

echo.正在开始清理……
echo.
echo.正在清理映像注册表安装点……
call :UnMountImageRegistry

echo.
echo.正在清理映像安装点……
Dism.exe /English /Quiet /Unmount-Wim /MountDir:"%BootMount%\1" /Discard >nul
Dism.exe /English /Quiet /Unmount-Wim /MountDir:"%BootMount%\2" /Discard >nul
Dism.exe /English /Unmount-Wim /MountDir:"%WinReMount%" /Discard >nul

for /l %%i in (1, 1, 100) do (
	if exist "%InstallMount%\%%i\Windows" Dism.exe /English /Unmount-Wim /MountDir:"%InstallMount%\%%i" /Discard >nul
)

:: 清理映像安装点文件夹
call :RemoveFolder "%BootMount%"
call :CreateFolder "%BootMount%\1"
call :CreateFolder "%BootMount%\2"
call :RemoveFolder "%InstallMount%"
call :CreateFolder "%InstallMount%"
call :RemoveFolder "%WinReMount%"
call :CreateFolder "%WinReMount%"
echo.

:: 清理日志文件夹
echo.正在清理日志文件……
call :RemoveFolder "%Logs%"
call :CreateFolder "%Logs%"
echo.

:: 清理临时文件、文件夹
echo.正在清理临时文件……
call :RemoveFolder "%Temp%"
call :CreateFolder "%Temp%"

echo.
echo.已完成清理……
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 退出 MSMG 工具箱模组
::-------------------------------------------------------------------------------------------
:Quit

cls
echo.===============================================================================
echo. 	                          MSMG 工具箱 - 退出
echo.===============================================================================
echo.
if "%IsSourceSelected%" equ "Yes" (
	echo.源操作系统已被选择，请从“应用”主菜单中选择保存/丢弃……
	echo.
	echo.===============================================================================
	echo.
	pause

	goto :Mainmenu
)
echo.正在执行后期清理操作，请稍候……
echo.
call :CleanUp
echo.感谢 MDL 的每一位贡献者……
echo.
echo.正在退出 MSMG 工具箱……
echo.
echo.===============================================================================
echo.
pause

:: 恢复 DOS 窗口大小
reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

color 00
endlocal EnableExtensions EnableDelayedExpansion

exit