@echo off

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

color 1f
title MSMG 工具箱 v13.5

cd /D "%~dp0" >nul
set "ROOT=%cd%"
cd /D "%ROOT%\" >nul

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

reg add "HKU\.DEFAULT\Console" /v "FaceName" /t REG_SZ /d "Consolas" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontFamily" /t REG_DWORD /d "0x36" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontSize" /t REG_DWORD /d "0x100000" /f >nul
reg add "HKU\.DEFAULT\Console" /v "FontWeight" /t REG_DWORD /d "0x190" /f >nul
reg add "HKU\.DEFAULT\Console" /v "ScreenBufferSize" /t REG_DWORD /d "0x23290050" /f >nul

setlocal EnableExtensions EnableDelayedExpansion

:: 设置工具箱环境路径变量
set "Bin=%ROOT%\Bin"
set "Custom=%ROOT%\Custom"
set "Drivers=%ROOT%\Drivers"
set "DVD=%ROOT%\DVD"
set "ISO=%ROOT%\ISO"
set "Logs=%ROOT%\Logs"
set "Mount=%ROOT%\Mount"
set "Packs=%ROOT%\Packs"
set "Temp=%ROOT%\Temp"
set "Updates=%ROOT%\Updates"
set "WHD=%ROOT%\WHD"

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

if exist "%WinDir%\SysWOW64" (set "HostArchitecture=x64") else (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 HostBuild=%%i)
for /f "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /f "ReleaseId" ^| find "REG_SZ"') do (set /A HostReleaseVersion=%%j & if "%%j" lss "2004" set /A HostDisplayVersion=%%j)
if "%HostDisplayVersion%" equ "" 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=7 delims=[]. " %%r in ('ver 2^>nul') do (set /A HostServicePackBuild=%%r)
for /f "tokens=4-5 delims=[]. " %%s in ('ver 2^>nul') do (set "HostVersion=%%s.%%t" & set "HostOSVersion=%%s")
if "%HostVersion%" equ "6.1" set "HostOSVersion=7 SP1"
if "%HostVersion%" equ "6.3" set "HostOSVersion=8.1"
if "%HostVersion%" equ "10.0" if "%HostBuild%" geq "21996" set "HostOSVersion=11"
set "HostOSName=Windows %HostOSVersion% %HostEdition% %HostInstallationType%"

for /f "tokens=3 delims=\ " %%o in ('reg query "HKCU\Control Panel\International\User Profile" /s /v "Languages" ^| findstr /I "REG_ _SZ"') do (set "HostLanguage=%%o")
for /f "tokens=6 delims= " %%o in ('DISM /Online /English /Get-Intl ^| findstr /i /C:"Default system UI language"') do (set HostUILanguage=%%o)
if "%HostLanguage%" equ "" set "HostLanguage=%HostUILanguage%"
for /f "tokens=2 delims=:, " %%l in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Partially localized language"') do (set "HostPartiallyLocalized=%%l")
if "%HostPartiallyLocalized%" equ "Partially" for /f "tokens=2 delims=:" %%t in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"language fallback is"') do (set "HostLanguageFallback=%%t")
if "%HostPartiallyLocalized%" equ "Partially" if "%HostLanguageFallback%" equ "" set "HostLanguageFallback= en-US"
if "%HostLanguageFallback%" neq "" set "HostLanguageFallback=%HostLanguageFallback:~1%"

for /f "tokens=3-4 delims=:, " %%k in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Active keyboard(s)"') do (set "HostActiveKeyboard=%%k:%%l")
rem Windows 默认 pt-BR 布局是 ABNT“0416:00000416”。但流行的布局是 ABNT2“0416:00010416”
if "%HostActiveKeyboard%" equ "0416:00000416" set "HostActiveKeyboard=0416:00010416"
for /f "tokens=2 delims=:" %%f in ('DISM /Online /English /Get-Intl ^| findstr /I /C:"Default time zone"') do (set "HostTimeZone=%%f")
set "HostTimeZone=%HostTimeZone:~1%"

:: 设置 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 ImageUILanguage=
set ImageLanguage=
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 "IsCustomRemovalBuild=No"

set "SourceData=Host"
set "Unattend_AutoLogon=Disabled"
set "Unattend_Theme=Dark"
set "Unattend_LocaleLanguage=%HostLanguage%"
set "Unattend_UILanguage=%HostUILanguage%"
set "Unattend_LanguageFallback=%HostLanguageFallback%"
set "Unattend_InputLocale=%HostActiveKeyboard%"
set "Unattend_TimeZone=%HostTimeZone%"
set "UnattendXML_Path=%DVD%\Autounattend.xml"

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 "AppLicense=%Bin%\AppLicense"
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 "EdgeWebView2=%Packs%\EdgeWebView2"
set "Games=%Packs%\Games"
set "IE11=%Packs%\IE11"
set "LanguagePacks=%Packs%\LanguagePacks"
set "MediaFeaturePack=%Packs%\MediaFeaturePack"
set "MMRC=%Packs%\MultimediaRestrictedCodecs"
set "MSPaint=%Packs%\MSPaint"
set "NET6=%Packs%\NET6"
set "NET7=%Packs%\NET7"
set "NETCore31=%Packs%\NETCore31"
set "NetFx35=%Packs%\NetFX35"
set "NetFx462=%Packs%\NetFX462"
set "NetFx48=%Packs%\NetFX48"
set "NetFx481=%Packs%\NetFX481"
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 "ThirdPartyAppPacks=%Packs%\ThirdPartyAppPacks"
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 "EsdDecrypter=%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 (I_3DViewer,I_Alarms,I_AmazonAppStore,I_AV1VideoExtension,I_BingFinance,I_BingFoodDrink,I_BingHealthFitness,I_BingMaps,I_BingNews,I_BingSports,I_BingTravel,I_BingWeather,I_Calculator,I_Camera,I_ClientWebExperience,I_Clipchamp,I_CommunicationsApps,I_Cortana,I_D3DMappingLayers,I_DesktopAppInstaller,I_DirectXRuntime,I_FeedbackHub,I_GamingApp,I_GamingServices,I_GetHelp,I_Getstarted,I_HEIFImageExtension,I_HelpAndTips,I_HEVCVideoExtension,I_Journal,I_Maps,I_Messaging,I_MicrosoftPowerBI,I_MinecraftEducationEdition,I_MixedRealityPortal,I_MPEG2VideoExtension,I_Notepad,I_NVIDIAControlPanel,I_OfficeHub,I_OfficeOneNote,I_OneConnect,I_Paint,I_Paint3D,I_People,I_Photos,I_PowerAutomateDesktop,I_Print3D,I_QuickAssist,I_RawImageExtension,I_Reader,I_ReadingList,I_RealtekAudioControl,I_Scan,I_ScreenSketch,I_SkypeApp,I_SolitaireCollection,I_SoundRecorder,I_StickyNotes,I_StorePurchaseApp,I_TeamsChat,I_Terminal,I_Todos,I_VP9VideoExtensions,I_Wallet,I_WebMediaExtensions,I_WebpImageExtension,I_Whiteboard,I_WindowsDefender,I_WindowsStore,I_WindowsSubsystemForAndroid,I_WindowsSubsystemForLinux,I_Xbox,I_XboxGameOverlay,I_XboxGamingOverlay,I_XboxIdentityProvider,I_XboxLiveGames,I_XboxSpeechToTextOverlay,I_XboxTCUI,I_YourPhone,I_ZuneMusic,I_ZuneVideo) do (
	set "%%i=-"
)

:: 设置组件状态标识
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,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_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2SDK,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,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

	exit
)

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

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

:: 设置 DOS 字符代码页
if "%HostUILanguage%" equ "en-GB" chcp 437 >nul
if "%HostUILanguage%" equ "en-US" chcp 437 >nul
if "%HostUILanguage%" 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.EsdDecrypt.exe     =  %EsdDecrypter%
echo.ToolKitHelper.exe  =  %ToolKitHelper%
echo.ResourceHacker.exe =  %ResourceHacker%
echo.WimlibImagex.exe   =  %WimlibImagex%
echo.
echo.
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 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.                             [8]   工      具
echo.
echo.                             [X]   退      出
echo.
echo.===============================================================================
choice /C:12345678X /N /M "请输入你的选项 ："
if errorlevel 9 goto :Quit
if errorlevel 8 goto :ToolsMenu
if errorlevel 7 goto :TargetMenu
if errorlevel 6 goto :ApplyMenu
if errorlevel 5 goto :UnattendedMenu
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>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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]   从 MCT 或自定义 ESD 映像中解压源文件
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123456X /N /M "请输入你的选项 ："
if errorlevel 7 goto :MainMenu
if errorlevel 6 goto :ExtractSourceESD
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>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Internet Explorer 11
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   第三方应用程序包
	echo.  [I]   远程桌面协议（RDP）8.0 和 8.1
	echo.  [J]   Windows 媒体功能包
	echo.  [K]   Windows Management Framework（WMF）5.1 ^| 依赖于 .NET Framework 4.8
	echo.  [L]   Windows PowerShell 7 ^| 依赖于 Windows Management Framework 5.1
	echo.  [M]   Windows Thin PC 附加功能
	echo.  [N]   远程服务器管理工具（RSAT）
	echo.  [O]   Microsoft DaRT 7.0 工具集
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft 游戏
	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 :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntThinPcPkgs
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntWMF
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntRDP81
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntIE11
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	if errorlevel 1  goto :IntNetFX48
)

:: 检查所选择的源操作系统是否是 Windows Server 2008 R2 Core/非 Core 版本
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" if "%ImageInstallationType%" neq "Embedded" (
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Internet Explorer 11
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   第三方应用程序包
	echo.  [I]   远程桌面协议（RDP）8.0 和 8.1
	echo.  [J]   Windows Management Framework（WMF）5.1 ^| 依赖于 .NET Framework 4.8
	echo.  [K]   Windows PowerShell 7 ^| 依赖于 Windows Management Framework 5.1
	echo.  [L]   Windows 系统恢复
	echo.  [M]   Microsoft DaRT 7.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 :IntSystemRestore
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntWMF
	if errorlevel 9  goto :IntRDP81
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntIE11
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	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 :IntInboxAppsMenu
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 重复数据删除
	echo.  [J]   Windows To Go 工作区
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Microsoft 默认内置应用
	echo.  [M]   Windows Management Framework（WMF）5.1
	echo.  [N]   Windows PowerShell 7
	echo.  [O]   远程服务器管理工具（RSAT）
	echo.  [P]   Microsoft DaRT 8.1 工具集
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft 游戏
	echo.  [S]   Windows 边栏
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "请输入你的选项 ："
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntRSAT
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntWMF
	if errorlevel 12 goto :IntInboxAppsMenu
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   第三方应用程序包
	echo.  [I]   Microsoft 默认内置应用
	echo.  [J]   Windows Management Framework（WMF）5.1
	echo.  [K]   Windows PowerShell 7
	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.===============================================================================
	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 :IntPowerShell7
	if errorlevel 10 goto :IntWMF
	if errorlevel 9  goto :IntInboxAppsMenu
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge 经典浏览器
	echo.  [G]   Microsoft Edge Chromium 浏览器
	echo.  [H]   Microsoft Win32 计算器
	echo.  [I]   第三方应用程序包
	echo.  [J]   Windows To Go 工作区
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   远程服务器管理工具（RSAT）
	echo.  [N]   Microsoft 默认内置应用
	echo.  [O]   Microsoft DaRT 10.0 工具集
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft 游戏
	echo.  [R]   Windows 边栏 ^| 依赖于：Windows 邮件应用
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "请输入你的选项 ："
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 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 :IntInboxAppsMenu
	if errorlevel 13 goto :IntRSAT
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 重复数据删除
	echo.  [J]   Windows To Go 工作区
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   远程服务器管理工具（RSAT）
	echo.  [N]   Microsoft 默认内置应用
	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 :IntInboxAppsMenu
	if errorlevel 13 goto :IntRSAT
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge 经典浏览器
	echo.  [G]   Microsoft Edge Chromium 浏览器
	echo.  [H]   Microsoft Edge WebView 2
	echo.  [I]   Microsoft Win32 计算器
	echo.  [J]   第三方应用程序包
	echo.  [K]   Windows 重复数据删除
	echo.  [L]   Windows To Go 工作区
	echo.  [M]   Windows 媒体功能包
	echo.  [N]   Windows Multimedia Restricted Codec
	echo.  [O]   Windows PowerShell 7
	echo.  [P]   远程服务器管理工具（RSAT）
	echo.  [Q]   Microsoft 默认内置应用
	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 :IntInboxAppsMenu
	if errorlevel 16 goto :IntRSAT
	if errorlevel 15 goto :IntPowerShell7
	if errorlevel 14 goto :IntMMRC
	if errorlevel 13 goto :IntMediaFeaturePack
	if errorlevel 12 goto :IntWinToGo
	if errorlevel 11 goto :IntDedup
	if errorlevel 10 goto :Int3rdPartyAppPacks
	if errorlevel 9  goto :IntWin32Calc
	if errorlevel 8  goto :IntEdgeWebView2
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 盲文辅助功能
	echo.  [J]   Windows 重复数据删除
	echo.  [K]   Windows To Go 工作区
	echo.  [L]   Windows 媒体功能包
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   远程服务器管理工具（RSAT）
	echo.  [O]   Microsoft 默认内置应用
	echo.  [P]   Microsoft DaRT 10.0 工具集
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft 游戏
	echo.  [S]   Windows 边栏
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "请输入你的选项 ："
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntInboxAppsMenu
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntBraille
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 盲文辅助功能
	echo.  [J]   Windows 重复数据删除
	echo.  [K]   Windows To Go 工作区
	echo.  [L]   Windows 媒体功能包
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   远程服务器管理工具（RSAT）
	echo.  [O]   Open Secure Shell（SSH）客户端和服务器端
	echo.  [P]   Microsoft 默认内置应用
	echo.  [Q]   Microsoft DaRT 10.0 工具集
	echo.  [R]   Microsoft DirectX 9.0c
	echo.  [S]   Microsoft 游戏
	echo.  [T]   Windows 边栏
	echo.  [U]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUX /N /M "请输入你的选项 ："
	if errorlevel 22 goto :IntegrateMenu
	if errorlevel 21 goto :IntVCRuntime
	if errorlevel 20 goto :IntSidebar
	if errorlevel 19 goto :IntGames
	if errorlevel 18 goto :IntDirectX9c
	if errorlevel 17 goto :IntDaRT
	if errorlevel 16 goto :IntInboxAppsMenu
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge Chromium 浏览器
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 盲文辅助功能
	echo.  [J]   Windows 重复数据删除
	echo.  [K]   Windows To Go 工作区
	echo.  [L]   Windows 媒体功能包
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   远程服务器管理工具（RSAT）
	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 :IntInboxAppsMenu
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntRSAT
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntMediaFeaturePack
	if errorlevel 11 goto :IntWinToGo
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeChromium
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge 经典浏览器
	echo.  [G]   Microsoft Edge WebView 2
	echo.  [H]   Microsoft Win32 计算器
	echo.  [I]   第三方应用程序包
	echo.  [J]   Windows 盲文辅助功能
	echo.  [K]   Windows 重复数据删除
	echo.  [L]   Windows To Go 工作区
	echo.  [M]   Windows 媒体功能包
	echo.  [N]   Windows 混合现实
	echo.  [O]   Windows Multimedia Restricted Codec
	echo.  [P]   Windows 便携设备
	echo.  [Q]   Windows PowerShell 7
	echo.  [R]   Open Secure Shell（SSH）客户端和服务器端
	echo.  [S]   Microsoft 默认内置应用
	echo.  [T]   Microsoft Office 桌面 UWP 应用
	echo.  [U]   Microsoft DaRT 10.0 工具集
	echo.  [V]   Microsoft DirectX 9.0c
	echo.  [W]   Microsoft 游戏
	echo.  [X]   Windows 边栏
	echo.  [Y]   Microsoft Visual C++ Runtime
	echo.  [1]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXY1 /N /M "请输入你的选项 ："
	if errorlevel 26 goto :IntegrateMenu
	if errorlevel 25 goto :IntVCRuntime
	if errorlevel 24 goto :IntSidebar
	if errorlevel 23 goto :IntGames
	if errorlevel 22 goto :IntDirectX9c
	if errorlevel 21 goto :IntDaRT
	if errorlevel 20 goto :IntOfficeUWPApps
	if errorlevel 19 goto :IntInboxAppsMenu
	if errorlevel 18 goto :IntOpenSSH
	if errorlevel 17 goto :IntPowerShell7
	if errorlevel 16 goto :IntPortableDevices
	if errorlevel 15 goto :IntMMRC
	if errorlevel 14 goto :IntWMR
	if errorlevel 13 goto :IntMediaFeaturePack
	if errorlevel 12 goto :IntWinToGo
	if errorlevel 11 goto :IntDedup
	if errorlevel 10 goto :IntBraille
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntEdgeWebView2
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [C]   Microsoft .NET Desktop Runtime 6
	echo.  [D]   Microsoft .NET Desktop Runtime 7
	echo.  [E]   Microsoft Edge WebView 2
	echo.  [F]   Microsoft Win32 计算器
	echo.  [G]   第三方应用程序包
	echo.  [H]   Windows 盲文辅助功能
	echo.  [I]   Windows 重复数据删除
	echo.  [J]   Windows To Go 工作区
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Windows 便携设备
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Open Secure Shell（SSH）客户端和服务器端
	echo.  [O]   Microsoft 默认内置应用
	echo.  [P]   Microsoft Office 桌面 UWP 应用
	echo.  [Q]   Microsoft DaRT 10.0 工具集
	echo.  [R]   Microsoft DirectX 9.0c
	echo.  [S]   Microsoft 游戏
	echo.  [T]   Windows 边栏
	echo.  [U]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTUX /N /M "请输入你的选项 ："
	if errorlevel 22 goto :IntegrateMenu
	if errorlevel 21 goto :IntVCRuntime
	if errorlevel 20 goto :IntSidebar
	if errorlevel 19 goto :IntGames
	if errorlevel 18 goto :IntDirectX9c
	if errorlevel 17 goto :IntDaRT
	if errorlevel 16 goto :IntOfficeUWPApps
	if errorlevel 15 goto :IntInboxAppsMenu
	if errorlevel 14 goto :IntOpenSSH
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntPortableDevices
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntWinToGo
	if errorlevel 9  goto :IntDedup
	if errorlevel 8  goto :IntBraille
	if errorlevel 7  goto :Int3rdPartyAppPacks
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeWebView2
	if errorlevel 4  goto :IntNET7
	if errorlevel 3  goto :IntNET6
	if errorlevel 2  goto :IntNETCore31
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v2004/v20H2/v21H1/v21H2/v22H2 客户端版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 盲文辅助功能
	echo.  [J]   Windows 重复数据删除
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Windows Multimedia Restricted Codec
	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 :IntInboxAppsMenu
	if errorlevel 15 goto :IntOpenSSH
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntPortableDevices
	if errorlevel 12 goto :IntMMRC
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntDedup
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 11 v21H2 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   Microsoft 画图
	echo.  [H]   Microsoft Win32 计算器
	echo.  [I]   第三方应用程序包
	echo.  [J]   Windows 盲文辅助功能
	echo.  [K]   Windows 媒体功能包
	echo.  [L]   Windows 便携设备
	echo.  [M]   Windows PowerShell 7
	echo.  [N]   Open Secure Shell（SSH）客户端和服务器端
	echo.  [O]   Microsoft 默认内置应用
	echo.  [P]   Microsoft DaRT 11.0 工具集
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft 游戏
	echo.  [S]   Windows 边栏
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "请输入你的选项 ："
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntInboxAppsMenu
	if errorlevel 14 goto :IntOpenSSH
	if errorlevel 13 goto :IntPowerShell7
	if errorlevel 12 goto :IntPortableDevices
	if errorlevel 11 goto :IntMediaFeaturePack
	if errorlevel 10 goto :IntBraille
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntWin32Calc
	if errorlevel 7  goto :IntMSPaint
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 11 v22H2 客户端版本
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" neq "arm64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft 画图
	echo.  [G]   Microsoft Win32 计算器
	echo.  [H]   第三方应用程序包
	echo.  [I]   Windows 盲文辅助功能
	echo.  [J]   Windows 媒体功能包
	echo.  [K]   Windows 便携设备
	echo.  [L]   Windows PowerShell 7
	echo.  [M]   Open Secure Shell（SSH）客户端和服务器端
	echo.  [N]   Microsoft 默认内置应用
	echo.  [O]   Microsoft DaRT 11.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 :IntInboxAppsMenu
	if errorlevel 13 goto :IntOpenSSH
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntPortableDevices
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntBraille
	if errorlevel 8  goto :Int3rdPartyAppPacks
	if errorlevel 7  goto :IntWin32Calc
	if errorlevel 6  goto :IntMSPaint
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows 10 v1803/v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、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 Framework 4.8.1
	echo.
	echo.  [3]   Microsoft 默认内置应用
	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 :IntInboxAppsMenu
	if errorlevel 2 goto :IntNetFX481
	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.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Windows PowerShell 7
	echo.  [G]   适用于 Linux 的 Windows 子系统（WSL）
	echo.  [H]   Microsoft DaRT 10.0 工具集
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJX /N /M "请输入你的选项 ："
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntVCRuntime
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntWSL
	if errorlevel 6  goto :IntPowerShell7
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	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 Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge 经典浏览器
	echo.  [G]   Microsoft Edge Chromium 浏览器
	echo.  [H]   Microsoft Edge WebView 2
	echo.  [I]   第三方应用程序包
	echo.  [J]   Windows Multimedia Restricted Codec
	echo.  [K]   Windows 系统恢复
	echo.  [L]   适用于 Linux 的 Windows 子系统（WSL）
	echo.  [M]   Windows To Go 工作区
	echo.  [N]   Windows PowerShell 7
	echo.  [O]   Microsoft 默认内置应用
	echo.  [P]   Microsoft DaRT 10.0 工具集
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft 游戏
	echo.  [S]   Windows 边栏
	echo.  [T]   Microsoft Visual C++ Runtime
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSTX /N /M "请输入你的选项 ："
	if errorlevel 21 goto :IntegrateMenu
	if errorlevel 20 goto :IntVCRuntime
	if errorlevel 19 goto :IntSidebar
	if errorlevel 18 goto :IntGames
	if errorlevel 17 goto :IntDirectX9c
	if errorlevel 16 goto :IntDaRT
	if errorlevel 15 goto :IntInboxAppsMenu
	if errorlevel 14 goto :IntPowerShell7
	if errorlevel 13 goto :IntWinToGo
	if errorlevel 12 goto :IntWSL
	if errorlevel 11  goto :IntSystemRestore
	if errorlevel 10 goto :IntMMRC
	if errorlevel 9  goto :Int3rdPartyAppPacks
	if errorlevel 8  goto :IntEdgeWebView2
	if errorlevel 7  goto :IntEdgeChromium
	if errorlevel 6  goto :IntEdgeClassic
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2/Windows Server LTSC 2022 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Windows PowerShell 7
	echo.  [G]   适用于 Linux 的 Windows 子系统（WSL）
	echo.  [H]   Microsoft DaRT 10.0 工具集
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	choice /C:ABCDEFGHIJX /N /M "请输入你的选项 ："
	if errorlevel 11 goto :IntegrateMenu
	if errorlevel 10 goto :IntVCRuntime
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntWSL
	if errorlevel 6  goto :IntPowerShell7
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	if errorlevel 1  goto :IntNetFX35
)

:: 检查所选择的源操作系统是否是 Windows Server LTSC 2022 非 Core 版本
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8.1
	echo.  [C]   Microsoft .NET Core Desktop Runtime 3.1
	echo.  [D]   Microsoft .NET Desktop Runtime 6
	echo.  [E]   Microsoft .NET Desktop Runtime 7
	echo.  [F]   Microsoft Edge WebView 2
	echo.  [G]   第三方应用程序包
	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 :IntInboxAppsMenu
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :Int3rdPartyAppPacks
	if errorlevel 6  goto :IntEdgeWebView2
	if errorlevel 5  goto :IntNET7
	if errorlevel 4  goto :IntNET6
	if errorlevel 3  goto :IntNETCore31
	if errorlevel 2  goto :IntNetFX481
	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>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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/2021 LTSC
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   移除 Windows 组件
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

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

:: 检查所选择的源操作系统是否是 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端版本
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" 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 11 v23H2 客户端
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22631" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   使用应用列表移除 Windows 应用
	echo.
	echo.  [2]   使用程序包列表移除 Windows 组件
	echo.
	echo.
	echo.
	echo.
)

:: 检查所选择的源操作系统是否是 Windows 110/11 服务器版本
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/2021 LTSC
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" 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/2021 LTSC
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" 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 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端版本
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" 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 11 v23H2 客户端
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" gtr "22631" 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 110/11 服务器版本
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>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查所选择的源操作系统是否是 Windows 7/Server 2008 R2
if "%SelectedSourceOS%" equ "w7" (
	echo.此功能尚未实现……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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 工具箱 - 无人值守 XML 菜单
::-------------------------------------------------------------------------------------------
:UnattendedMenu
cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 无人值守 XML 菜单
echo.===============================================================================
echo.
echo.  [1]   将个人 ^<\Custom\Autounattend.xml^> 文件复制到 DVD 文件夹
echo.
echo.  [2]   编写“Autounattend.xml”将主机或映像数据发送到 DVD 文件夹
echo.
echo.  [3]   验证 DVD 文件夹中的“Autounattend.xml”文件
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   返回
echo.
echo.===============================================================================
echo.
choice /C:123X /N /M "请输入你的选项 ："
echo.
if errorlevel 4 goto :MainMenu
if errorlevel 3 (
	call :ValidateXML "!UnattendXML_Path!"

	echo.
	TIMEOUT.exe /T -1

	goto :UnattendedMenu
)
if errorlevel 2 goto :UnattendedWriter
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 个人无人值守 XML
::-------------------------------------------------------------------------------------------
:UnattendedPersonalFile
cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 个人无人值守 XML
echo.===============================================================================
echo.

:: 检查 Windows 源启动映像是否存在
if not exist "%Custom%\Autounattend.xml" (
	echo.在 ^<Custom\^> 文件夹中找不到你的个人“Autounattend.xml.xml”文件……
	echo.
	echo.请将你的个人“Autounattend.xml.xml”文件复制到 ^<Custom\^> 文件夹……
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :UnattendedMenu
)

echo.-------------------------------------------------------------------------------
echo.####正在开始将个人无人参与 XML 文件复制到 DVD 文件夹###########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.正在将个人^<\Custom\Autounattend.xml^>文件复制到 DVD 文件夹……
echo.-------------------------------------------------------------------------------
copy /Y "%Custom%\Autounattend.xml" "!UnattendXML_Path!"
echo.
call :ValidateXML "!UnattendXML_Path!"
echo.
echo.-------------------------------------------------------------------------------
echo.####复制个人无人参与 XML 文件到 DVD 文件夹已完成###############################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================

echo.
TIMEOUT.exe /T -1

goto :UnattendedMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - 无人值守 XML 写入程序
::-------------------------------------------------------------------------------------------
:UnattendedWriter
cls
echo.===============================================================================
echo.                     MSMG 工具箱 - 无人值守 XML 写入程序
echo.===============================================================================
echo.

:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

echo.  [F]  （!SourceData!）源数据
echo.-------------------------------------------------------------------------------
if /I "!SourceData!" equ "Host" (
	echo.       HostLanguage                        ："%HostLanguage%"
	echo.       HostUILanguage                      ："%HostUILanguage%"
	echo.       HostLanguageFallback                ："%HostLanguageFallback%"
	echo.       HostActiveKeyboard                  ："%HostActiveKeyboard%"
	echo.       HostTimeZone                        ："%HostTimeZone%"
)
if /I "!SourceData!" equ "Image" (
	echo.       ImageLanguage                       ："!ImageLanguage!"
	echo.       ImageUILanguage                     ："!ImageUILanguage!"
	echo.       ImageLanguageFallback               ："!ImageLanguageFallback!"
	echo.       ImageActiveKeyboard                 ："!ImageActiveKeyboard!"
	echo.       ImageTimeZone                       ："!ImageTimeZone!"
)
echo.-------------------------------------------------------------------------------
echo.
echo.  [S]  请输入你的首选项 ：
echo.
echo.               “计算机名称 - 组织名称 - 帐户名称 - 密码/说明”
echo.-------------------------------------------------------------------------------
echo.  “!SourceData!”源数据定义的值 ：
echo.
echo.       无人值守系统 / 用户位置                  ："!Unattend_LocaleLanguage!"
echo.       无人值守用户界面语言                     ："!Unattend_UILanguage!"
echo.       无人值守系统 / 用户语言回退              ："!Unattend_LanguageFallback!"
echo.       活动键盘 - 输入法区域设置                ："!Unattend_InputLocale!"
echo.
echo.       时区                                     ："!Unattend_TimeZone!"
echo.       计算机名称                               ："!Unattend_MachineName!"
echo.       组织名称                                 ："!Unattend_OrganizationName!"
echo.       帐户名称                                 ："!Unattend_AccountName!"
echo.       密码值                                   ："!Unattend_Password!"
echo.       密码说明                                 ："!Unattend_PasswordDescription!"
echo.-------------------------------------------------------------------------------
if "!Unattend_Password!" neq "" (
	echo.
	if /I "!Unattend_AutoLogon!" equ "Disabled" echo.  [L]  （!Unattend_AutoLogon!）自动登录 [默认选项]
	if /I "!Unattend_AutoLogon!" equ "Enabled" echo.  [L]  （!Unattend_AutoLogon!）自动登录
)
echo.
if /I "!Unattend_Theme!" equ "Light" echo.  [T]  （!Unattend_Theme!）主题 [默认选项]
if /I "!Unattend_Theme!" equ "Dark" echo.  [T]  （!Unattend_Theme!）主题
echo.
echo.  [W]  在手动安装程序 ^<%DVD%^> 中写入 Autounattend.XML
echo.
echo.  [X]  返回
echo.
echo.===============================================================================
echo.
choice /C:FSLTWX /N /M "请输入你的选项 ："
echo.
if errorlevel  6 (
	set Unattend_MachineName=
	set Unattend_OrganizationName=
	set Unattend_AccountName=
	set Unattend_Password=
	set Unattend_PasswordDescription=
	goto :UnattendedMenu
)
if errorlevel  5 goto :UnattendedXML
if errorlevel  4 (
	if /I "!Unattend_Theme!" equ "Dark" (
		set "Unattend_Theme=Light"
	) else (
		set "Unattend_Theme=Dark"
	)
)
if errorlevel  3 (
	if /I "!Unattend_AutoLogon!" equ "Disabled" (
		set "Unattend_AutoLogon=Enabled"
	) else (
		set "Unattend_AutoLogon=Disabled"
	)
)
if errorlevel  2 (
	rem set "Autounattend_MachineName=Machine"
	if "!Unattend_MachineName!" equ "" (
		echo.如果要在多台计算机中使用此 AutoUnattend.xml 文件，请将其留空。
		echo.建议计算机维护技术人员留空。
		set /P "Autounattend_MachineName=请输入你的计算机名称 ："
	)
	rem set "Unattend_OrganizationName=dotOrg"
	if "!Unattend_OrganizationName!" equ "" set /P "Unattend_OrganizationName=请输入你的组织名称 : "
	rem set "Unattend_AccountName=EveryOne"
	if "!Unattend_AccountName!" equ "" set /P "Unattend_AccountName=请输入你的帐户名称 ："
	if "!Unattend_AccountName!" neq "" (
		rem set "Unattend_Password=windows"
		if "!Unattend_Password!" equ "" set /P "Unattend_Password=请输入你的临时用户密码 ："
		if "!Unattend_Password!" neq "" (
			if "!Unattend_PasswordDescription!" equ "" (
				echo.提醒示例：“通过 enter 键登录”。更改密码。
				set /P "Unattend_PasswordDescription=提示：请输入“!Unattend_AccountName! 用户”的帐户密码 ："
			)
		)
	)
)
if errorlevel  1 (
	if /I "!SourceData!" equ "Host" (
		set "SourceData=Image"
		set "Unattend_LocaleLanguage=!ImageLanguage!"
		set "Unattend_UILanguage=!ImageUILanguage!"
		set "Unattend_LanguageFallback=!ImageLanguageFallback!"
		set "Unattend_InputLocale=!ImageActiveKeyboard!"
		set "Unattend_TimeZone=!ImageTimeZone!"
	) else (
		set "SourceData=Host"
		set "Unattend_LocaleLanguage=%HostLanguage%"
		set "Unattend_UILanguage=%HostUILanguage%"
		set "Unattend_LanguageFallback=%HostLanguageFallback%"
		set "Unattend_InputLocale=%HostActiveKeyboard%"
		set "Unattend_TimeZone=%HostTimeZone%"
	)
)

goto :UnattendedWriter
::-------------------------------------------------------------------------------------------

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

cls
echo.===============================================================================
echo.                        MSMG 工具箱 - 应用源文件菜单
echo.===============================================================================
echo.
:: 检查源操作系统是否已选择
if "%IsSourceselected%" equ "No" (
	echo.尚未选择源操作系统，请从“源文件”菜单中选择……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :MainMenu
)

:: 检查是否加载了映像注册表
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.已加载源操作系统映像注册表，请使用工具 -^> 选项卸载……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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]   使用 DISM Cleanup-Image 清理源映像文件
	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>nul|set /p=请按任意键继续执行……
	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%" if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Boot.wim”映像……
	echo.
	echo.请将 Windows 安装程序中的“Boot.wim”映像复制到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

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

:: 检查 Windows 源安装映像是否为 ESD 格式
if exist "%InstallEsd%" (
	:: 获取映像索引名称
	call :GetImageName "%InstallESD%", 1 >nul

	if not exist "%BootWim%" if "!ImageName!" neq "Windows Setup Media" (
		echo.在 ^<DVD\Sources^> 文件夹中无法找到 Windows 安装程序“Boot.wim”映像……
		echo.请将 Windows 安装程序中的“Boot.wim”映像复制到 ^<DVD\Sources^> 文件夹……
		goto :Stop
	)

	echo.工具箱所找到的 Windows 安装映像是 .esd 格式，ESD 映像是高度压缩的映
	echo.像，无法直接维护。
	echo.
	echo.此工具箱要求 Windows 安装映像以 .wim 格式进行维护。
	echo.
	echo.
	echo.请改为使用 .wim 格式的 Windows 安装映像维护，或使用“源文件”菜单中的

	if "!ImageName!" equ "Windows Setup Media" echo.“从应用商店 ESD 映像中解压源文件”菜单项。
	if "!ImageName!" neq "Windows Setup Media" echo..“从 MCT 或自定义 ESD 映像中解压源文件”菜单项。
	goto :Stop
)

:: 检查 Windows 源安装映像是否存在
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	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>nul|set /p=请按任意键继续执行……
	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 "19045" (
		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/11 源操作系统……
	echo.
	echo.工具箱需要主机操作系统为 Windows 8.1/10/11 以维护 Windows 10/11 源操作系统……
	goto :Stop
)

:: 检查所选的源操作系统是否兼容工具箱的自定义组件移除程序
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	if "%ImageServicePackBuild%" equ "1" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" equ "17763" if "%ImageServicePackBuild%" equ "4645" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageServicePackBuild%" equ "2274" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		if "%ImageFlag%" equ "EnterpriseS" if "%ImageServicePackBuild%" equ "1288" set "IsCustomRemovalBuild=Yes"
		if "%ImageFlag%" equ "EnterpriseSN" if "%ImageServicePackBuild%" equ "1288" set "IsCustomRemovalBuild=Yes"
		if "%ImageServicePackBuild%" equ "3208" set "IsCustomRemovalBuild=Yes"
	)
	if "%ImageBuild%" equ "22000" if "%ImageServicePackBuild%" equ "2176" set "IsCustomRemovalBuild=Yes"
	if "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22624" if "%ImageServicePackBuild%" equ "1992" set "IsCustomRemovalBuild=Yes"
)

if "%IsCustomRemovalBuild%" neq "Yes" (
	echo.
	echo.所选源映像版本不支持自定义组件删除，但是，它支持 DISM 组件移除。对于组件移除，
	echo.请使用“使用包列表移除 Windows 组件（DISM 方法）”菜单移除 Windows 组件。
	echo.
	choice /C:YN /N /M "你想要继续吗 ？ [是‘Y’/否‘N’] ："
	if errorlevel 2 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"

:: 获取无人参与文件的信息
call :GetInformation4UnattendedFile >nul 2>&1

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.C从 DVD 驱动器复制可能会需要一些时间，请稍候……
%XCopy% %DriveLetter% "%DVD%" >nul
echo.
echo.复制完成……
echo.
echo.-------------------------------------------------------------------------------
echo.####从 DVD 驱动器复制源文件到 ^<DVD^> 文件夹已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.无法找到指定的 DVD ISO 镜像：“<%ISO%\%ISOFileName%>”……
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.无法找到指定的 DVD ISO 镜像文件 ：“<%ISO%\%IMGFileName%>”……
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set IMGFileName=

endlocal

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

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

setlocal

set ImageBuild=

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

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

:: 获取映像索引名称
call :GetImageName "%InstallESD%", 1 >nul

:: 检查源映像是否是 Windows 应用商店 ESD 映像
if "%ImageName%" neq "Windows Setup Media" (
	echo.指定的源映像不是 Windows 应用商店 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>nul|set /p=请按任意键继续执行……
		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.-------------------------------------------------------------------------------
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
"%WimlibImagex%" info "%InstallEsd%" 4 1>nul 2>nul
if %ERRORLEVEL% equ 74 (
	echo.
	echo.正在解密 Windows 应用商店 ESD 映像……
	"%EsdDecrypter%" "%InstallEsd%" 2>nul
)
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"
echo.-------------------------------------------------------------------------------
echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：2] 为启动映像……
echo.-------------------------------------------------------------------------------
rem call :ExportImageIndex "%InstallEsd%", 2, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
echo.
"%WimlibImagex%" export "%InstallEsd%" 2 "%Temp%\DVD\sources\boot.wim" --boot --compress=LZX
call :DeleteImage "%Temp%\DVD\sources\boot.wim", 1 >nul
echo.
echo.-------------------------------------------------------------------------------
echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：3] 为启动映像……
echo.-------------------------------------------------------------------------------
rem call :ExportImageIndex "%InstallEsd%", 3, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
echo.
"%WimlibImagex%" export "%InstallEsd%" 3 "%Temp%\DVD\sources\boot.wim" --boot --compress=LZX
echo.
if %ImageBuild% equ 9600 (
	echo.-------------------------------------------------------------------------------
	echo.正在导出 Windows 应用商店 ESD 映像 [Install.esd，索引 ：4] 为安装映像……
	echo.-------------------------------------------------------------------------------
	rem call :ExportImageIndex "%InstallEsd%", 4, "%Temp%\DVD\sources\install.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" export "%InstallEsd%" 4 "%Temp%\DVD\sources\install.wim" --compress=LZX
	echo.
)

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

:: 将 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set ImageBuild=

endlocal

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

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

setlocal

cls
echo.===============================================================================
echo.            MSMG 工具箱 - 从 MCT 或自定义 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
)

:: 获取映像索引名称
call :GetImageName "%InstallESD%", 1 >nul

:: 检查源映像是否是 Windows MCT 或自定义 ESD 映像
if "%ImageName%" equ "Windows Setup Media" (
	echo.指定的源映像不是 Windows MCT 或自定义 ESD 映像
	echo.
	echo.请复制一个有效的 Windows MCT 或自定义 ESD 映像文件到 ^<DVD\Sources^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始从 MCT 或自定义 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>nul|set /p=请按任意键继续执行……
	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.####正在从 MCT 或自定义 ESD 安装映像中解压源文件###############################
echo.-------------------------------------------------------------------------------
echo.

:: 转换源 MCT 或自定义 ESD 安装映像为 WIM 映像
for %%i in (%ImageIndexNo%) do (
	echo.-------------------------------------------------------------------------------
	echo.正在导出 [Install.esd，索引 ：%%i] 为安装映像……
	echo.-------------------------------------------------------------------------------
	rem call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
	echo.
	"%WimlibImagex%" export "%InstallEsd%" %%i "%InstallWim%" --compress=LZX
	echo.
)

:: 删除原始源 MCT 或自定义 ESD 安装映像
call :RemoveFile "%InstallEsd%"

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

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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]    拉脱维亚语 - 拉脱维亚    [lt-LT]
	echo. 中文 - 简体              [zh-CN]    立陶宛语 - 立陶宛        [lv-LV]
	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
)

:: 获取源映像索引的体系结构
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%" equ "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 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%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		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 PE 语言或语言功能包文件夹是否是空的
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 "22621" if not exist "%LanguagePacks%\WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-AppxDeployment-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%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		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 "%ImageBuild%" geq "22621" if not exist "%LanguagePacks%\WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows 语言包文件夹缺少以下文件……
		echo.
		echo."WinPE-WindowsUpdate-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%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
			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"
			)
		
			if "%ImageBuild%" geq "22621" if exist "%LanguagePacks%\WinPE-AppxDeployment-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 WinPE - Appx 部署 [%LanguagePackCode%] 到 Windows 恢复映像……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-AppxDeployment-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"
	)

	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"
		)
	)

	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%" 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%" 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%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "22000" (
		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"
	)

	if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "22621" if exist "%LanguagePacks%\WinPE-WindowsUpdate-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~%PackageVersion%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.正在集成 WinPE - Windows 更新包 [%LanguagePackCode%] 到 Windows 恢复映像……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%LanguagePacks%\WinPE-WindowsUpdate-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"

	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.WWindows 驱动文件夹 ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
		if "%DriverType%" equ "Install" echo.WWindows 驱动文件夹 ^<Drivers\Install\%SelectedSourceOS%\%ImageArchitecture%^> 是空的……
		if "%DriverType%" equ "Recovery" echo.WWindows 驱动文件夹 ^<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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 /PackagePath:%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set NetFX48=
set NetFX48Pkg=
set NetFX48LpPkg=

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET Framework 4.8.1 模组
::-------------------------------------------------------------------------------------------
:IntNetFX481

setlocal

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

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

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

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Framework 4.8.1#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Framework 4.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.正在集成 Microsoft .NET Framework 4.8.1 基础包……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%NetFX481%\Microsoft-Windows-NetFX481-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

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

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

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET Core Desktop Runtime 3.1 模组
::-------------------------------------------------------------------------------------------
:IntNETCore31

setlocal

cls
echo.===============================================================================
echo.          MSMG 工具箱 - 集成 Microsoft .NET Core Desktop Runtime 3.1
echo.===============================================================================
echo.

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

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

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

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Core Desktop Runtime 3.1#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Core Desktop Runtime 3.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.正在集成 Microsoft .NET Core Desktop Runtime 3.1 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NETCore31%\NETCore31_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft .NET Core Desktop Runtime 3.1 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%NETCore31%\NETCore31_%SelectedSourceOS%_%ImageArchitecture%.reg"

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

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Core Desktop Runtime 3.1 已完成########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET Desktop Runtime 6 模组
::-------------------------------------------------------------------------------------------
:IntNET6

setlocal

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Microsoft .NET Desktop Runtime 6
echo.===============================================================================
echo.

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

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

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

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Desktop Runtime 6##############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Desktop Runtime 6##################################
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 Desktop Runtime 6 程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%NET6%\NET6_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft .NET Desktop Runtime 6 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%NET6%\NET6_%SelectedSourceOS%_%ImageArchitecture%.reg"

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

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Desktop Runtime 6 已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft .NET Desktop Runtime 7 模组
::-------------------------------------------------------------------------------------------
:IntNET7

setlocal

cls
echo.===============================================================================
echo.             MSMG 工具箱 - 集成 Microsoft .NET Desktop Runtime 7
echo.===============================================================================
echo.

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

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

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

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft .NET Desktop Runtime 7##############################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft .NET Desktop Runtime 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

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

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

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft .NET Desktop Runtime 7 已完成###############################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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-KB2872047-%ImageArchitecture%.cab" (
	echo.Windows Management Framework 5 包文件夹缺少以下文件……
	echo.
	echo."Windows6.1-KB2872047-%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-KB2872047-%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set WMF=

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft 画图模组
::-------------------------------------------------------------------------------------------
:IntMSPaint

setlocal

cls
echo.===============================================================================
echo.                       MSMG 工具箱 - 集成 Microsoft 画图
echo.===============================================================================
echo.

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

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

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

:: 检查 Microsoft 画图包文件是否存在
if not exist "%MSPaint%\MSPaint_%ImageArchitecture%.reg" (
	echo.Microsoft 画图包文件夹缺少以下文件……
	echo.
	echo."MSPaint_%ImageArchitecture%.reg"
	echo.
	echo.请复制上述文件到 ^<Packs\MSPaint^> 文件夹……
	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 "%MSPaint%\MSPaint.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft 画图 [%ImageDefaultLanguage%] 语言包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%MSPaint%\MSPaint_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft 画图注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%MSPaint%\MSPaint_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft 画图已完成##################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set MSPaint=

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 "%ImageArchitecture%" neq "arm64" 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.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" neq "arm64" call :ApplyImage "%Win32Calc%\Win32Calc.tpk", %PackageIndex%, "%InstallMount%\%%i"
		if "%ImageArchitecture%" equ "arm64" call :ApplyImage "%Win32Calc%\Win32Calc.tpk", 3, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------

		if "%ImageArchitecture%" neq "arm64" (
			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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.WWindows 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.WWindows 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set SystemRestore=

endlocal

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

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

setlocal

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

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

:: 设置 Microsoft 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set EdgeClassic=

endlocal

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

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

setlocal

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

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

:: 正在检查 Microsoft Edge 浏览器包文件是否存在
if not exist "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%.tpk" (
	echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
	echo.
	echo.EdgeChromium_%SelectedSourceOS%.tpk
	echo.
	echo.请复制上述文件到 ^<Packs\EdgeChromium^> 文件夹……
	goto :Stop
)

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

if not exist "%EdgeChromium%\EdgeChromiumGP.tpk" (
	echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
	echo.
	echo.EdgeChromiumGP.tpk
	echo.
	echo.请复制上述文件到 ^<Packs\EdgeChromium^> 文件夹……
	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 "%EdgeChromium%\EdgeChromiumGP_%%k.tpk" (
			echo.Microsoft Edge Chromium 浏览器包文件夹缺少以下文件……
			echo.
			echo.EdgeChromiumGP_%%k.tpk
			echo.
			echo.请复制上述文件到 ^<Packs\EdgeChromium^> 文件夹……
			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

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge Chromium 浏览器程序包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge Chromium 浏览器组策略基础数据包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChromium%\EdgeChromiumGP.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 "%EdgeChromium%\EdgeChromiumGP_%%k.tpk", 1, "%InstallMount%\%%i"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft Edge Chromium 浏览器注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%EdgeChromium%\EdgeChromium_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		echo.
	)
)

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

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成 Microsoft Edge WebView 2 浏览器模组
::-------------------------------------------------------------------------------------------
:IntEdgeWebView2

setlocal

cls
echo.===============================================================================
echo.                 MSMG 工具箱 - 集成 Microsoft Edge WebView 2
echo.===============================================================================
echo.

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

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

:: 正在检查 Microsoft Edge WebView 2 包文件是否存在
if not exist "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft Edge WebView 2 包文件夹缺少以下文件……
	echo.
	echo.EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg
	echo.
	echo.请复制上述文件到^<Packs\EdgeWebView2^> 文件夹……
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Microsoft Edge WebView 2######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Microsoft Edge WebView 2##########################################
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

		echo.-------------------------------------------------------------------------------
		echo.正在集成 Microsoft Edge WebView 2 基础包……
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft Edge WebView 2 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%EdgeWebView2%\EdgeWebView2_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft Edge WebView 2 已完成#######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

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

::-------------------------------------------------------------------------------------------
:: 集成第三方应用程序包模组
::-------------------------------------------------------------------------------------------
:Int3rdPartyAppPacks

setlocal

set PackFile=
set PackName=

cls
echo.===============================================================================
echo.                    MSMG 工具箱 - 集成第三方应用程序包
echo.===============================================================================
echo.

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

:: 检查第三方应用程序包文件是否存在
if not exist "%ThirdPartyAppPacks%\*_%SelectedSourceOS%.tpk" (
	echo.第三方应用程序包文件夹缺少包基本文件……
	echo.
	echo.请复制上述文件到 ^<Packs\ThirdPartyAppPacks^> 文件夹……
	goto :Stop
)

if not exist "%ThirdPartyAppPacks%\*_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.第三方应用程序包文件夹缺少包注册表文件……
	echo.
	echo.请复制上述文件到 ^<Packs\ThirdPartyAppPacks^> 文件夹……
	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 :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /f %%j in ('"dir /b %ThirdPartyAppPacks%\*.tpk" 2^>nul') do (
			for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-WimInfo /WimFile:"%ThirdPartyAppPacks%\%%j" /Index:%PackageIndex% ^| findstr /i Name') do (set PackName=%%a)
			set PackFile=%%j
			set PackFile=!PackFile:~0,-4!
			set PackName=!PackName:~1!"
			set PackName=!PackName:~0,-7!
			echo._______________________________________________________________________________
			echo.-------------------------------------------------------------------------------
			echo.正在集成 !PackName! 应用程序包的程序包……
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%ThirdPartyAppPacks%\!PackFile!.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.正在合并 !PackName! 应用程序包注册表设置……
			echo.-------------------------------------------------------------------------------
			echo.
			echo.正在安装映像注册表……
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.正在将注册表设置合并到映像注册表……
			call :ImportRegistry2Image "%ThirdPartyAppPacks%\!PackFile!_%ImageArchitecture%.reg"
			echo.正在卸载映像注册表……
			call :UnMountImageRegistry
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成第三方应用程序包已完成#################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set PackFile=
set PackName=

endlocal

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

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

setlocal

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

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

:: Setting Braille Pack Path
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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set Braille=

endlocal

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

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

setlocal

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

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

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

:: 检查 Windows Multimedia Restricted Codec 包文件是否存在
if not exist "%MMRC%\Multimedia-RestrictedCodecsDolby-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codec 包文件夹缺少以下文件……
	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 Codec 包文件夹缺少以下文件……
	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 Codec 包文件夹缺少以下文件……
		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 Codec 包文件夹缺少以下文件……
		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 Codec 包文件夹缺少以下文件……
		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 Codec 包文件夹缺少以下文件……
		echo.
		echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.请复制上述文件到 ^<Packs\MultimediaRestrictedCodecs\%PackageVersion%^> 文件夹……
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####正在开始集成 Windows Multimedia Restricted Codec###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    映像文件名称             ：Install.wim
echo.    映像索引                 ：%ImageIndexNo%
echo.    映像体系结构             ：%ImageArchitecture%
echo.    映像版本                 ：%ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####正在集成 Windows Multimedia Restricted Codec###############################
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 Codec 基础包……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows Multimedia Restricted Extended Codec [%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 Codec WOW64 基础包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%PackageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows Multimedia Restricted Extended Codec WOW64 [%ImageDefaultLanguage%] 语言包……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%PackageVersion%.%PackageServicePackBuild%.cab"
			)
		)
	)
)

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

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.适用于 Linux 的 Windows 子系统（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.适用于 Linux 的 Windows 子系统（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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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

:: 设置 Open Secure Shell 包路径
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-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
call :RemoveFile "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"

echo.-------------------------------------------------------------------------------
echo.####集成 Open Secure Shell（SSH）客户端和服务器端已完成########################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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, ProfessionalN, 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" if "%SelectedSourceOS%" neq "w11" 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, ProfessionalN, 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set WMR=

endlocal

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

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

setlocal

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

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

:: 检查是否存在支持集成便携设备的 N 版被选为源。
set /A ImageEditionCount=0
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" set /A ImageEditionCount+=1
)

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

:: 设置 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 Universal C Runtime（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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set RSAT=
set RSATType=

endlocal

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

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

cls
echo.===============================================================================
echo.                       MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
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 :IntFeaturesMenu
if errorlevel 2 goto :IntInboxApps
if errorlevel 1 goto :SelectInboxAppsMenu

:SelectInboxAppsMenu
cls
echo.===============================================================================
echo.                MSMG 工具箱 - 集成 Microsoft 默认内置应用菜单
echo.===============================================================================
:: 集成 Windows 8.1 默认内置应用菜单
if "%SelectedSourceOS%" equ "w81" (
	echo.  [ 1] %I_Alarms% 闹钟和时钟
	echo.  [ 2] %I_Calculator% 计算器
	echo.  [ 3] %I_CommunicationsApps% 日历、邮件和人脉
	echo.  [ 4] %I_BingFinance% Bing 财经
	echo.  [ 5] %I_BingFoodDrink% Bing 美食
	echo.  [ 6] %I_BingHealthFitness% Bing 健康
	echo.  [ 7] %I_BingMaps% Bing 地图
	echo.  [ 8] %I_BingNews% Bing 资讯
	echo.  [ 9] %I_BingSports% Bing 体育
	echo.  [10] %I_BingTravel% Bing 旅游
	echo.  [11] %I_BingWeather% Bing 天气
	echo.  [12] %I_HelpTips% 帮助和提示
	echo.  [13] %I_OfficeOneNote% Office OneNote
	echo.  [14] %I_Reader% 阅读器
	echo.  [15] %I_ReadingList% 阅读列表
	echo.  [16] %I_Scan% 扫描
	echo.  [17] %I_SkypeApp% Skype
	echo.  [18] %I_SoundRecorder% 录音机
	echo.  [19] %I_XboxLiveGames% Xbox LIVE 游戏
	echo.  [20] %I_ZuneMusic% Zune 音乐
	echo.  [21] %I_ZuneVideo% Zune 视频
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_BingFinance%" equ "+" ( set "I_BingFinance=-" ) else ( set "I_BingFinance=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_BingFoodDrink%" equ "+" ( set "I_BingFoodDrink=-" ) else ( set "I_BingFoodDrink=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_BingHealthFitness%" equ "+" ( set "I_BingHealthFitness=-" ) else ( set "I_BingHealthFitness=+" ) )
	if "!MenuChoice!" equ "7" ( if "%I_BingMaps%" equ "+" ( set "I_BingMaps=-" ) else ( set "I_BingMaps=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "9" ( if "%I_BingSports%" equ "+" ( set "I_BingSports=-" ) else ( set "I_BingSports=+" ) )
	if "!MenuChoice!" equ "10" ( if "%I_BingTravel%" equ "+" ( set "I_BingTravel=-" ) else ( set "I_BingTravel=+" ) )
	if "!MenuChoice!" equ "11" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "12" ( if "%I_HelpAndTips%" equ "+" ( set "I_HelpAndTips=-" ) else ( set "I_HelpAndTips=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_OfficeOneNote%" equ "+" ( set "I_OfficeOneNote=-" ) else ( set "I_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "14" ( if "%I_Reader%" equ "+" ( set "I_Reader=-" ) else ( set "I_Reader=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_ReadingList%" equ "+" ( set "I_ReadingList=-" ) else ( set "I_ReadingList=+" ) )
	if "!MenuChoice!" equ "16" ( if "%I_Scan%" equ "+" ( set "I_Scan=-" ) else ( set "I_Scan=+" ) )
	if "!MenuChoice!" equ "17" ( if "%I_SkypeApp%" equ "+" ( set "I_SkypeApp=-" ) else ( set "I_SkypeApp=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "19" ( if "%I_XboxLiveGames%" equ "+" ( set "I_XboxLiveGames=-" ) else ( set "I_XboxLiveGames=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_Alarms=+"
		set "I_Calculator=+"
		set "I_CommunicationsApps=+"
		set "I_BingFinance=+"
		set "I_BingFoodDrink=+"
		set "I_BingHealthFitness=+"
		set "I_BingMaps=+"
		set "I_BingNews=+"
		set "I_BingSports=+"
		set "I_BingTravel=+"
		set "I_BingWeather=+"
		set "I_HelpAndTips=+"
		set "I_OfficeOneNote=+"
		set "I_Reader=+"
		set "I_ReadingList=+"
		set "I_Scan=+"
		set "I_SkypeApp=+"
		set "I_SoundRecorder=+"
		set "I_XboxLiveGames=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: 集成 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2 默认内置应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "20348" (
	echo.  [ 1] %I_3DViewer% 3D 查看器
	echo.  [ 2] %I_Alarms% 闹钟和时钟
	echo.  [ 3] %I_AV1VideoExtension% AOMedia Video 1（AV1）编解码器插件
	echo.  [ 4] %I_Calculator% 计算器
	echo.  [ 5] %I_Camera% 相机
	echo.  [ 6] %I_Clipchamp% Clipchamp 视频编辑器
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" echo.  [ 7] %I_Cortana% Cortana
	echo.  [ 8] %I_DesktopAppInstaller% 桌面应用安装程序
	echo.  [ 9] %I_DirectXRuntime% DirectX Runtime
	echo.  [10] %I_FeedbackHub% 反馈中心
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [11] %I_ZuneVideo% 电影和电视
	echo.  [12] %I_GetHelp% 获取帮助
	echo.  [13] %I_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [14] %I_ZuneMusic% Groove 音乐
	echo.  [15] %I_HEIFImageExtension% 高效图像文件（HEIF）编解码器插件
	echo.  [16] %I_HEVCVideoExtension% 高效视频编码（HEVC）编解码器插件
	if "%ImageBuild%" geq "19042" if "%ImageBuild%" leq "20348" echo.  [17] %I_Journal% 日记
	echo.  [18] %I_Maps% 地图
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [19] %I_Messaging% 消息
	echo.  [20] %I_MPEG2VideoExtension% MPEG-2 视频编解码器插件
	echo.  [21] %I_Wallet% Microsoft Pay
	echo.  [22] %I_MicrosoftPowerBI% Microsoft Power BI
	if "%ImageArchitecture%" equ "x64" echo.  [23] %I_MixedRealityPortal% 混合现实门户
	echo.  [24] %I_MinecraftEducationEdition% 我的世界教育版
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [25] %I_OneConnect% 移动套餐
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [26] %I_ZuneVideo% 电影和电视
	echo.  [27] %I_OfficeHub% 我的 Office
	echo.  [28] %I_BingNews% 资讯
	echo.  [29] %I_OfficeOneNote% OneNote
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [30] %I_D3DMappingLayers% OpenCL 和 OpenGL 兼容包
	echo.  [31] %I_Paint3D% 画图 3D
	echo.  [32] %I_People% 人脉
	echo.  [33] %I_YourPhone% 手机连接
	echo.  [34] %I_Photos% 照片
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [35] %I_Print3D% Print 3D
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" echo.  [36] %I_RawImageExtension% Raw 图像插件
	echo.  [37] %I_ScreenSketch% 截图和草图
	echo.  [38] %I_SkypeApp% Skype
	echo.  [39] %I_SolitaireCollection% Solitaire Collection
	echo.  [40] %I_StickyNotes% 便笺
	echo.  [41] %I_StorePurchaseApp% 应用商店体验主机
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" echo.  [42] %I_Terminal% 终端
	echo.  [43] %I_Getstarted% 使用技巧 - 适用于初学者的 Windows 提示和教程
	echo.  [44] %I_Todos% Todos
	echo.  [45] %I_SoundRecorder% 录音机
	echo.  [46] %I_BingWeather% 天气
	echo.  [47] %I_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [48] %I_WebpImageExtension% WebP 图像编解码器插件
	echo.  [49] %I_Whiteboard% 白板
	echo.  [50] %I_CommunicationsApps% Windows 邮件
	echo.  [51] %I_WindowsStore% Windows 应用商店
	echo.  [52] %I_XboxTCUI% Xbox UI（Xbox TCUI）
	echo.  [53] %I_Xbox% Xbox（Xbox 应用）
	echo.  [54] %I_XboxGameOverlay% Xbox Game Bar Plugin（Xbox Game Overlay）
	echo.  [55] %I_XboxGamingOverlay% Xbox Game Bar（Xbox Gaming Overlay）
	echo.  [56] %I_XboxIdentityProvider% Xbox Identity Provider
	echo.  [57] %I_XboxSpeechToTextOverlay% Xbox 游戏内体验（Xbox Speech To TextOverlay）
	echo.
	echo.  [58] %I_AMDLink% AMD Link
	echo.  [59] %I_HPSupportAssistant% HP Support Assistant 9
	echo.  [60] %I_IntelGraphicsCommandCenter% 英特尔显卡控制中心
	echo.  [61] %I_IntelThunderboltController% Intel Thunderbolt 控制器
	echo.  [62] %I_KillerControlCenter% Rivet Networks Killer Control Center
	echo.  [63] %I_NVIDIAControlPanel% NVIDIA 控制浮出控件
	echo.  [64] %I_RealtekAudioControl% Realtek 音频控制台
	echo.  [65] %I_WavesMaxxAudioProforDell% Waves MaxxAudio Pro for Dell 2020
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" ( if "%I_3DViewer%" equ "+" ( set "I_3DViewer=-" ) else ( set "I_3DViewer=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_AV1VideoExtension%" equ "+" ( set "I_AV1VideoExtension=-" ) else ( set "I_AV1VideoExtension=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_Camera%" equ "+" ( set "I_Camera=-" ) else ( set "I_Camera=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_Clipchamp%" equ "+" ( set "I_Clipchamp=-" ) else ( set "I_Clipchamp=+" ) )
	if "!MenuChoice!" equ "7" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" ( if "%I_Cortana%" equ "+" ( set "I_Cortana=-" ) else ( set "I_Cortana=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_DesktopAppInstaller%" equ "+" ( set "I_DesktopAppInstaller=-" ) else ( set "I_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "9" ( if "%I_DirectXRuntime%" equ "+" ( set "I_DirectXRuntime=-" ) else ( set "I_DirectXRuntime=+" ) )
	if "!MenuChoice!" equ "10" ( if "%I_FeedbackHub%" equ "+" ( set "I_FeedbackHub=-" ) else ( set "I_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "11" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "12" ( if "%I_GetHelp%" equ "+" ( set "I_GetHelp=-" ) else ( set "I_GetHelp=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_VP9VideoExtensions%" equ "+" ( set "I_VP9VideoExtensions=-" ) else ( set "I_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "14" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_HEIFImageExtension%" equ "+" ( set "I_HEIFImageExtension=-" ) else ( set "I_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "16" ( if "%I_HEVCVideoExtension%" equ "+" ( set "I_HEVCVideoExtension=-" ) else ( set "I_HEVCVideoExtension=+" ) )
	if "!MenuChoice!" equ "17" if "%ImageBuild%" geq "19042" if "%ImageBuild%" leq "20348" ( if "%I_Journal%" equ "+" ( set "I_Journal=-" ) else ( set "I_Journal=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_Maps%" equ "+" ( set "I_Maps=-" ) else ( set "I_Maps=+" ) )
	if "!MenuChoice!" equ "19" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_Messaging%" equ "+" ( set "I_Messaging=-" ) else ( set "I_Messaging=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_MPEG2VideoExtension%" equ "+" ( set "I_MPEG2VideoExtension=-" ) else ( set "I_MPEG2VideoExtension=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_Wallet%" equ "+" ( set "I_Wallet=-" ) else ( set "I_Wallet=+" ) )
	if "!MenuChoice!" equ "22" ( if "%I_MicrosoftPowerBI%" equ "+" ( set "I_MicrosoftPowerBI=-" ) else ( set "I_MicrosoftPowerBI=+" ) )
	if "!MenuChoice!" equ "23" if "%ImageArchitecture%" equ "x64" ( if "%I_MixedRealityPortal%" equ "+" ( set "I_MixedRealityPortal=-" ) else ( set "I_MixedRealityPortal=+" ) )
	if "!MenuChoice!" equ "24" ( if "%I_MinecraftEducationEdition%" equ "+" ( set "I_MinecraftEducationEdition=-" ) else ( set "I_MinecraftEducationEdition=+" ) )
	if "!MenuChoice!" equ "25" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_OneConnect%" equ "+" ( set "I_OneConnect=-" ) else ( set "I_OneConnect=+" ) )
	if "!MenuChoice!" equ "26" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "27" ( if "%I_OfficeHub%" equ "+" ( set "I_OfficeHub=-" ) else ( set "I_OfficeHub=+" ) )
	if "!MenuChoice!" equ "28" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "29" ( if "%I_OfficeOneNote%" equ "+" ( set "I_OfficeOneNote=-" ) else ( set "I_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "30" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_D3DMappingLayers%" equ "+" ( set "I_D3DMappingLayers=-" ) else ( set "I_D3DMappingLayers=+" ) )
	if "!MenuChoice!" equ "31" ( if "%I_Paint3D%" equ "+" ( set "I_Paint3D=-" ) else ( set "I_Paint3D=+" ) )
	if "!MenuChoice!" equ "32" ( if "%I_People%" equ "+" ( set "I_People=-" ) else ( set "I_People=+" ) )
	if "!MenuChoice!" equ "33" ( if "%I_YourPhone%" equ "+" ( set "I_YourPhone=-" ) else ( set "I_YourPhone=+" ) )
	if "!MenuChoice!" equ "34" ( if "%I_Photos%" equ "+" ( set "I_Photos=-" ) else ( set "I_Photos=+" ) )
	if "!MenuChoice!" equ "35" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%I_Print3D%" equ "+" ( set "I_Print3D=-" ) else ( set "I_Print3D=+" ) )
	if "!MenuChoice!" equ "36" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" ( if "%I_RawImageExtension%" equ "+" ( set "I_RawImageExtension=-" ) else ( set "I_RawImageExtension=+" ) )
	if "!MenuChoice!" equ "37" ( if "%I_ScreenSketch%" equ "+" ( set "I_ScreenSketch=-" ) else ( set "I_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "38" ( if "%I_SkypeApp%" equ "+" ( set "I_SkypeApp=-" ) else ( set "I_SkypeApp=+" ) )
	if "!MenuChoice!" equ "39" ( if "%I_SolitaireCollection%" equ "+" ( set "I_SolitaireCollection=-" ) else ( set "I_SolitaireCollection=+" ) )
	if "!MenuChoice!" equ "40" ( if "%I_StickyNotes%" equ "+" ( set "I_StickyNotes=-" ) else ( set "I_StickyNotes=+" ) )
	if "!MenuChoice!" equ "41" ( if "%I_StorePurchaseApp%" equ "+" ( set "I_StorePurchaseApp=-" ) else ( set "I_StorePurchaseApp=+" ) )
	if "!MenuChoice!" equ "42" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" ( if "%I_Terminal%" equ "+" ( set "I_Terminal=-" ) else ( set "I_Terminal=+" ) )
	if "!MenuChoice!" equ "43" ( if "%I_Getstarted%" equ "+" ( set "I_Getstarted=-" ) else ( set "I_Getstarted=+" ) )
	if "!MenuChoice!" equ "44" ( if "%I_Todos%" equ "+" ( set "I_Todos=-" ) else ( set "I_Todos=+" ) )
	if "!MenuChoice!" equ "45" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "46" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "47" ( if "%I_WebMediaExtensions%" equ "+" ( set "I_WebMediaExtensions=-" ) else ( set "I_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "48" ( if "%I_WebpImageExtension%" equ "+" ( set "I_WebpImageExtension=-" ) else ( set "I_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "49" ( if "%I_Whiteboard%" equ "+" ( set "I_Whiteboard=-" ) else ( set "I_Whiteboard=+" ) )
	if "!MenuChoice!" equ "50" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "51" ( if "%I_WindowsStore%" equ "+" ( set "I_WindowsStore=-" ) else ( set "I_WindowsStore=+" ) )
	if "!MenuChoice!" equ "52" ( if "%I_XboxTCUI%" equ "+" ( set "I_XboxTCUI=-" ) else ( set "I_XboxTCUI=+" ) )
	if "!MenuChoice!" equ "53" ( if "%I_Xbox%" equ "+" ( set "I_Xbox=-" ) else ( set "I_Xbox=+" ) )
	if "!MenuChoice!" equ "54" ( if "%I_XboxGameOverlay%" equ "+" ( set "I_XboxGameOverlay=-" ) else ( set "I_XboxGameOverlay=+" ) )
	if "!MenuChoice!" equ "55" ( if "%I_XboxGamingOverlay%" equ "+" ( set "I_XboxGamingOverlay=-" ) else ( set "I_XboxGamingOverlay=+" ) )
	if "!MenuChoice!" equ "56" ( if "%I_XboxIdentityProvider%" equ "+" ( set "I_XboxIdentityProvider=-" ) else ( set "I_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "57" ( if "%I_XboxSpeechToTextOverlay%" equ "+" ( set "I_XboxSpeechToTextOverlay=-" ) else ( set "I_XboxSpeechToTextOverlay=+" ) )

	if "!MenuChoice!" equ "58" ( if "%I_AMDLink%" equ "+" ( set "I_AMDLink=-" ) else ( set "I_AMDLink=+" ) )
	if "!MenuChoice!" equ "59" ( if "%I_HPSupportAssistant%" equ "+" ( set "I_HPSupportAssistant=-" ) else ( set "I_HPSupportAssistant=+" ) )
	if "!MenuChoice!" equ "60" ( if "%I_IntelGraphicsCommandCenter%" equ "+" ( set "I_IntelGraphicsCommandCenter=-" ) else ( set "I_IntelGraphicsCommandCenter=+" ) )
	if "!MenuChoice!" equ "61" ( if "%I_IntelThunderboltController%" equ "+" ( set "I_IntelThunderboltController=-" ) else ( set "I_IntelThunderboltController=+" ) )
	if "!MenuChoice!" equ "62" ( if "%I_KillerControlCenter%" equ "+" ( set "I_KillerControlCenter=-" ) else ( set "I_KillerControlCenter=+" ) )
	if "!MenuChoice!" equ "63" ( if "%I_NVIDIAControlPanel%" equ "+" ( set "I_NVIDIAControlPanel=-" ) else ( set "I_NVIDIAControlPanel=+" ) )
	if "!MenuChoice!" equ "64" ( if "%I_RealtekAudioControl%" equ "+" ( set "I_RealtekAudioControl=-" ) else ( set "I_RealtekAudioControl=+" ) )
	if "!MenuChoice!" equ "65" ( if "%I_WavesMaxxAudioProforDell%" equ "+" ( set "I_WavesMaxxAudioProforDell=-" ) else ( set "I_WavesMaxxAudioProforDell=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_3DViewer=+"
		set "I_Alarms=+"
		set "I_AV1VideoExtension=+"
		set "I_BingWeather=+"
		set "I_BingNews=+"
		set "I_Calculator=+"
		set "I_Camera=+"
		set "I_Clipchamp=+"
		set "I_CommunicationsApps=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" set "I_Cortana=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_D3DMappingLayers=+"
		set "I_DesktopAppInstaller=+"
		set "I_DirectXRuntime=+"
		set "I_FeedbackHub=+"
		set "I_GetHelp=+"
		set "I_Getstarted=+"
		set "I_HEIFImageExtension=+"
		set "I_HEVCVideoExtension=+"
		if "%ImageBuild%" geq "19042" if "%ImageBuild%" leq "20348" set "I_Journal=+"
		set "I_Maps=+"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "I_Messaging=+"
		set "I_MicrosoftPowerBI=+"
		set "I_MinecraftEducationEdition=+"
		if "%ImageArchitecture%" equ "x64" set "I_MixedRealityPortal=+"
		set "I_MPEG2VideoExtension=+"
		set "I_OfficeHub=+"
		set "I_OfficeOneNote=+"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "I_OneConnect=+"
		set "I_Paint3D=+"
		set "I_People=+"
		set "I_Photos=+"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "I_Print3D=+"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "20348" set "I_RawImageExtension=+"
		set "I_ScreenSketch=+"
		set "I_SkypeApp=+"
		set "I_SolitaireCollection=+"
		set "I_StickyNotes=+"
		set "I_StorePurchaseApp=+"
		set "I_SoundRecorder=+"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "20348" set "I_Terminal=+"
		set "I_Todos=+"
		set "I_VP9VideoExtensions=+"
		set "I_Wallet=+"
		set "I_WebMediaExtensions=+"
		set "I_WebpImageExtension=+"
		set "I_Whiteboard=+"
		set "I_WindowsStore=+"
		set "I_Xbox=+"
		set "I_XboxGameOverlay=+"
		set "I_XboxGamingOverlay=+"
		set "I_XboxIdentityProvider=+"
		set "I_XboxSpeechToTextOverlay=+"
		set "I_XboxTCUI=+"
		set "I_YourPhone=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"

		set "I_AMDLink=+"
		set "I_HPSupportAssistant=+"
		set "I_IntelGraphicsCommandCenter=+"
		set "I_IntelThunderboltController=+"
		set "I_KillerControlCenter=+"
		set "I_NVIDIAControlPanel=+"
		set "I_RealtekAudioControl=+"
		set "I_WavesMaxxAudioProforDell=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: 集成 Windows 11 v21H2/v22H2 默认内置应用菜单
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000" (
	echo.  [ 1] %I_Alarms% 闹钟和时钟
	echo.  [ 2] %I_AV1VideoExtension% AOMedia Video 1（AV1）编解码器插件
	echo.  [ 3] %I_AmazonAppStore% 亚马逊应用商店
	echo.  [ 4] %I_Calculator% 计算器
	echo.  [ 5] %I_Camera% 相机
	echo.  [ 6] %I_Clipchamp% Clipchamp 视频编辑器
	echo.  [ 7] %I_Cortana% Cortana
	echo.  [ 8] %I_DesktopAppInstaller% 桌面应用安装程序
	echo.  [ 9] %I_DirectXRuntime% DirectX Runtime
	echo.  [10] %I_FeedbackHub% 反馈中心
	echo.  [11] %I_ZuneVideo% 电影和电视	
	echo.  [12] %I_GamingApp% Gaming 应用（Xbox 应用）^| 依赖于 DirectX Runtime、游戏服务
	echo.  [13] %I_GamingServices% 游戏服务
	echo.  [14] %I_GetHelp% 获取帮助
	echo.  [15] %I_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [16] %I_HEIFImageExtension% 高效图像文件（HEIF）编解码器插件
	echo.  [17] %I_HEVCVideoExtension% 高效视频编码（HEVC）编解码器插件
	echo.  [18] %I_Journal% 日记
	echo.  [19] %I_Maps% 地图
	echo.  [20] %I_ZuneMusic% Media Player
	echo.  [21] %I_MPEG2VideoExtension% MPEG-2 视频编解码器插件
	echo.  [22] %I_MicrosoftPowerBI% Microsoft Power BI
	echo.  [23] %I_MinecraftEducationEdition% 我的世界教育版
	echo.  [24] %I_OfficeHub% 我的 Office
	echo.  [25] %I_BingNews% 资讯
	echo.  [26] %I_Notepad% 记事本应用
	echo.  [27] %I_D3DMappingLayers% OpenCL 和 OpenGL 兼容包
	echo.  [28] %I_Paint% 画图
	echo.  [29] %I_People% 人脉
	echo.  [30] %I_YourPhone% 手机连接
	echo.  [31] %I_Photos% 照片
	echo.  [32] %I_PowerAutomateDesktop% Power Automate Desktop
	if "%ImageBuild%" geq "22621" echo.  [33] %I_QuickAssist% 快速助手
	echo.  [34] %I_RawImageExtension% Raw 图像插件
	echo.  [35] %I_ScreenSketch% 截图工具应用
	echo.  [36] %I_SolitaireCollection% Solitaire Collection
	echo.  [37] %I_StickyNotes% 便笺
	echo.  [38] %I_StorePurchaseApp% 应用商店体验主机
	echo.  [39] %I_TeamsChat% Teams 聊天
	echo.  [40] %I_Terminal% 终端
	echo.  [41] %I_Getstarted% 入门
	echo.  [42] %I_Todos% Todos
	echo.  [43] %I_SoundRecorder% 录音机
	echo.  [44] %I_BingWeather% 天气
	echo.  [45] %I_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [46] %I_WebpImageExtension% WebP 图像编解码器插件
	echo.  [47] %I_Whiteboard% 白板
	echo.  [48] %I_ClientWebExperience% Windows Web Experience Pack - 资讯和兴趣小组件应用
	echo.  [49] %I_WindowsDefender% Windows Defender Dashboard
	echo.  [50] %I_CommunicationsApps% Windows 邮件
	echo.  [51] %I_WindowsStore% Windows 应用商店
	echo.  [52] %I_WindowsSubsystemForAndroid% 适用于 Android 的 Windows 子系统（WSA）
	echo.  [53] %I_WindowsSubsystemForLinux% 适用于 Linux 的 Windows 子系统（WSL）
	echo.  [54] %I_XboxTCUI% Xbox UI（Xbox TCUI）
	echo.  [55] %I_Xbox% Xbox（Xbox 应用）
	echo.  [56] %I_XboxGameOverlay% Xbox Game Bar Plugin（Xbox Game Overlay）
	echo.  [57] %I_XboxGamingOverlay% Xbox Game Bar（Xbox Gaming Overlay）
	echo.  [58] %I_XboxIdentityProvider% Xbox Identity Provider
	echo.  [59] %I_XboxSpeechToTextOverlay% Xbox 游戏内体验（Xbox Speech To TextOverlay）
	echo.
	echo.  [60] %I_AMDLink% AMD Link
	echo.  [61] %I_HPSupportAssistant% HP Support Assistant 9
	echo.  [62] %I_IntelGraphicsCommandCenter% 英特尔显卡控制中心
	echo.  [63] %I_IntelThunderboltController% Intel Thunderbolt 控制器
	echo.  [64] %I_KillerControlCenter% Rivet Networks Killer Control Center
	echo.  [65] %I_NVIDIAControlPanel% NVIDIA 控制浮出控件
	echo.  [66] %I_RealtekAudioControl% Realtek 音频控制台
	echo.  [67] %I_WavesMaxxAudioProforDell% Waves MaxxAudio Pro for Dell 2020
	echo.
	echo.  [A]    所有内置应用
	echo.  [X]    返回
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" ( if "%I_Alarms%" equ "+" ( set "I_Alarms=-" ) else ( set "I_Alarms=+" ) )
	if "!MenuChoice!" equ "2" ( if "%I_AV1VideoExtension%" equ "+" ( set "I_AV1VideoExtension=-" ) else ( set "I_AV1VideoExtension=+" ) )
	if "!MenuChoice!" equ "3" ( if "%I_AmazonAppStore%" equ "+" ( set "I_AmazonAppStore=-" ) else ( set "I_AmazonAppStore=+" ) )
	if "!MenuChoice!" equ "4" ( if "%I_Calculator%" equ "+" ( set "I_Calculator=-" ) else ( set "I_Calculator=+" ) )
	if "!MenuChoice!" equ "5" ( if "%I_Camera%" equ "+" ( set "I_Camera=-" ) else ( set "I_Camera=+" ) )
	if "!MenuChoice!" equ "6" ( if "%I_Clipchamp%" equ "+" ( set "I_Clipchamp=-" ) else ( set "I_Clipchamp=+" ) )
	if "!MenuChoice!" equ "7" ( if "%I_Cortana%" equ "+" ( set "I_Cortana=-" ) else ( set "I_Cortana=+" ) )
	if "!MenuChoice!" equ "8" ( if "%I_DesktopAppInstaller%" equ "+" ( set "I_DesktopAppInstaller=-" ) else ( set "I_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "9" ( if "%I_DirectXRuntime%" equ "+" ( set "I_DirectXRuntime=-" ) else ( set "I_DirectXRuntime=+" ) )
	if "!MenuChoice!" equ "10" ( if "%I_FeedbackHub%" equ "+" ( set "I_FeedbackHub=-" ) else ( set "I_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "11" ( if "%I_ZuneVideo%" equ "+" ( set "I_ZuneVideo=-" ) else ( set "I_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "12" ( if "%I_GamingApp%" equ "+" ( set "I_GamingApp=-" ) else ( set "I_GamingApp=+" ) )
	if "!MenuChoice!" equ "13" ( if "%I_GamingServices%" equ "+" ( set "I_GamingServices=-" ) else ( set "I_GamingServices=+" ) )
	if "!MenuChoice!" equ "14" ( if "%I_GetHelp%" equ "+" ( set "I_GetHelp=-" ) else ( set "I_GetHelp=+" ) )
	if "!MenuChoice!" equ "15" ( if "%I_VP9VideoExtensions%" equ "+" ( set "I_VP9VideoExtensions=-" ) else ( set "I_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "16" ( if "%I_HEIFImageExtension%" equ "+" ( set "I_HEIFImageExtension=-" ) else ( set "I_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "17" ( if "%I_HEVCVideoExtension%" equ "+" ( set "I_HEVCVideoExtension=-" ) else ( set "I_HEVCVideoExtension=+" ) )
	if "!MenuChoice!" equ "18" ( if "%I_Journal%" equ "+" ( set "I_Journal=-" ) else ( set "I_Journal=+" ) )
	if "!MenuChoice!" equ "19" ( if "%I_Maps%" equ "+" ( set "I_Maps=-" ) else ( set "I_Maps=+" ) )
	if "!MenuChoice!" equ "20" ( if "%I_ZuneMusic%" equ "+" ( set "I_ZuneMusic=-" ) else ( set "I_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "21" ( if "%I_MPEG2VideoExtension%" equ "+" ( set "I_MPEG2VideoExtension=-" ) else ( set "I_MPEG2VideoExtension=+" ) )
	if "!MenuChoice!" equ "22" ( if "%I_MicrosoftPowerBI%" equ "+" ( set "I_MicrosoftPowerBI=-" ) else ( set "I_MicrosoftPowerBI=+" ) )
	if "!MenuChoice!" equ "23" ( if "%I_MinecraftEducationEdition%" equ "+" ( set "I_MinecraftEducationEdition=-" ) else ( set "I_MinecraftEducationEdition=+" ) )
	if "!MenuChoice!" equ "24" ( if "%I_OfficeHub%" equ "+" ( set "I_OfficeHub=-" ) else ( set "I_OfficeHub=+" ) )
	if "!MenuChoice!" equ "25" ( if "%I_BingNews%" equ "+" ( set "I_BingNews=-" ) else ( set "I_BingNews=+" ) )
	if "!MenuChoice!" equ "26" ( if "%I_Notepad%" equ "+" ( set "I_Notepad=-" ) else ( set "I_Notepad=+" ) )
	if "!MenuChoice!" equ "27" ( if "%I_D3DMappingLayers%" equ "+" ( set "I_D3DMappingLayers=-" ) else ( set "I_D3DMappingLayers=+" ) )
	if "!MenuChoice!" equ "28" ( if "%I_Paint%" equ "+" ( set "I_Paint=-" ) else ( set "I_Paint=+" ) )
	if "!MenuChoice!" equ "29" ( if "%I_People%" equ "+" ( set "I_People=-" ) else ( set "I_People=+" ) )
	if "!MenuChoice!" equ "30" ( if "%I_YourPhone%" equ "+" ( set "I_YourPhone=-" ) else ( set "I_YourPhone=+" ) )
	if "!MenuChoice!" equ "31" ( if "%I_Photos%" equ "+" ( set "I_Photos=-" ) else ( set "I_Photos=+" ) )
	if "!MenuChoice!" equ "32" ( if "%I_PowerAutomateDesktop%" equ "+" ( set "I_PowerAutomateDesktop=-" ) else ( set "I_PowerAutomateDesktop=+" ) )
	if "!MenuChoice!" equ "33" if "%ImageBuild%" gtr "20000" ( if "%I_QuickAssist%" equ "+" ( set "I_QuickAssist=-" ) else ( set "I_QuickAssist=+" ) )
	if "!MenuChoice!" equ "34" ( if "%I_RawImageExtension%" equ "+" ( set "I_RawImageExtension=-" ) else ( set "I_RawImageExtension=+" ) )
	if "!MenuChoice!" equ "35" ( if "%I_ScreenSketch%" equ "+" ( set "I_ScreenSketch=-" ) else ( set "I_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "36" ( if "%I_SolitaireCollection%" equ "+" ( set "I_SolitaireCollection=-" ) else ( set "I_SolitaireCollection=+" ) )
	if "!MenuChoice!" equ "37" ( if "%I_StickyNotes%" equ "+" ( set "I_StickyNotes=-" ) else ( set "I_StickyNotes=+" ) )
	if "!MenuChoice!" equ "38" ( if "%I_StorePurchaseApp%" equ "+" ( set "I_StorePurchaseApp=-" ) else ( set "I_StorePurchaseApp=+" ) )
	if "!MenuChoice!" equ "39" ( if "%I_TeamsChat%" equ "+" ( set "I_TeamsChat=-" ) else ( set "I_TeamsChat=+" ) )
	if "!MenuChoice!" equ "40" ( if "%I_Terminal%" equ "+" ( set "I_Terminal=-" ) else ( set "I_Terminal=+" ) )
	if "!MenuChoice!" equ "41" ( if "%I_Getstarted%" equ "+" ( set "I_Getstarted=-" ) else ( set "I_Getstarted=+" ) )
	if "!MenuChoice!" equ "42" ( if "%I_Todos%" equ "+" ( set "I_Todos=-" ) else ( set "I_Todos=+" ) )
	if "!MenuChoice!" equ "43" ( if "%I_SoundRecorder%" equ "+" ( set "I_SoundRecorder=-" ) else ( set "I_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "44" ( if "%I_BingWeather%" equ "+" ( set "I_BingWeather=-" ) else ( set "I_BingWeather=+" ) )
	if "!MenuChoice!" equ "45" ( if "%I_WebMediaExtensions%" equ "+" ( set "I_WebMediaExtensions=-" ) else ( set "I_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "46" ( if "%I_WebpImageExtension%" equ "+" ( set "I_WebpImageExtension=-" ) else ( set "I_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "47" ( if "%I_Whiteboard%" equ "+" ( set "I_Whiteboard=-" ) else ( set "I_Whiteboard=+" ) )
	if "!MenuChoice!" equ "48" ( if "%I_ClientWebExperience%" equ "+" ( set "I_ClientWebExperience=-" ) else ( set "I_ClientWebExperience=+" ) )
	if "!MenuChoice!" equ "49" ( if "%I_WindowsDefender%" equ "+" ( set "I_WindowsDefender=-" ) else ( set "I_WindowsDefender=+" ) )
	if "!MenuChoice!" equ "50" ( if "%I_CommunicationsApps%" equ "+" ( set "I_CommunicationsApps=-" ) else ( set "I_CommunicationsApps=+" ) )
	if "!MenuChoice!" equ "51" ( if "%I_WindowsStore%" equ "+" ( set "I_WindowsStore=-" ) else ( set "I_WindowsStore=+" ) )
	if "!MenuChoice!" equ "52" ( if "%I_WindowsSubsystemForAndroid%" equ "+" ( set "I_WindowsSubsystemForAndroid=-" ) else ( set "I_WindowsSubsystemForAndroid=+" ) )
	if "!MenuChoice!" equ "53" ( if "%I_WindowsSubsystemForLinux%" equ "+" ( set "I_WindowsSubsystemForLinux=-" ) else ( set "I_WindowsSubsystemForLinux=+" ) )
	if "!MenuChoice!" equ "54" ( if "%I_XboxTCUI%" equ "+" ( set "I_XboxTCUI=-" ) else ( set "I_XboxTCUI=+" ) )
	if "!MenuChoice!" equ "55" ( if "%I_Xbox%" equ "+" ( set "I_Xbox=-" ) else ( set "I_Xbox=+" ) )
	if "!MenuChoice!" equ "56" ( if "%I_XboxGameOverlay%" equ "+" ( set "I_XboxGameOverlay=-" ) else ( set "I_XboxGameOverlay=+" ) )
	if "!MenuChoice!" equ "57" ( if "%I_XboxGamingOverlay%" equ "+" ( set "I_XboxGamingOverlay=-" ) else ( set "I_XboxGamingOverlay=+" ) )
	if "!MenuChoice!" equ "58" ( if "%I_XboxIdentityProvider%" equ "+" ( set "I_XboxIdentityProvider=-" ) else ( set "I_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "59" ( if "%I_XboxSpeechToTextOverlay%" equ "+" ( set "I_XboxSpeechToTextOverlay=-" ) else ( set "I_XboxSpeechToTextOverlay=+" ) )

	if "!MenuChoice!" equ "60" ( if "%I_AMDLink%" equ "+" ( set "I_AMDLink=-" ) else ( set "I_AMDLink=+" ) )
	if "!MenuChoice!" equ "61" ( if "%I_HPSupportAssistant%" equ "+" ( set "I_HPSupportAssistant=-" ) else ( set "I_HPSupportAssistant=+" ) )
	if "!MenuChoice!" equ "62" ( if "%I_IntelGraphicsCommandCenter%" equ "+" ( set "I_IntelGraphicsCommandCenter=-" ) else ( set "I_IntelGraphicsCommandCenter=+" ) )
	if "!MenuChoice!" equ "63" ( if "%I_IntelThunderboltController%" equ "+" ( set "I_IntelThunderboltController=-" ) else ( set "I_IntelThunderboltController=+" ) )
	if "!MenuChoice!" equ "64" ( if "%I_KillerControlCenter%" equ "+" ( set "I_KillerControlCenter=-" ) else ( set "I_KillerControlCenter=+" ) )
	if "!MenuChoice!" equ "65" ( if "%I_NVIDIAControlPanel%" equ "+" ( set "I_NVIDIAControlPanel=-" ) else ( set "I_NVIDIAControlPanel=+" ) )
	if "!MenuChoice!" equ "66" ( if "%I_RealtekAudioControl%" equ "+" ( set "I_RealtekAudioControl=-" ) else ( set "I_RealtekAudioControl=+" ) )
	if "!MenuChoice!" equ "67" ( if "%I_WavesMaxxAudioProforDell%" equ "+" ( set "I_WavesMaxxAudioProforDell=-" ) else ( set "I_WavesMaxxAudioProforDell=+" ) )

	if /i "!MenuChoice!" equ "A" (
		set "I_Alarms=+"
		set "I_AmazonAppStore=+"
		set "I_AV1VideoExtension=+"
		set "I_BingNews=+"
		set "I_BingWeather=+"
		set "I_Calculator=+"
		set "I_Camera=+"
		set "I_Clipchamp=+"
		set "I_CommunicationsApps=+"
		set "I_Cortana=+"
		set "I_D3DMappingLayers=+"
		set "I_DesktopAppInstaller=+"
		set "I_DirectXRuntime=+"
		set "I_FeedbackHub=+"
		set "I_GamingApp=+"
		set "I_GamingServices=+"
		set "I_GetHelp=+"
		set "I_Getstarted=+"
		set "I_HEIFImageExtension=+"
		set "I_HEVCVideoExtension=+"
		set "I_Journal=+"
		set "I_Maps=+"
		set "I_MicrosoftPowerBI=+"
		set "I_MinecraftEducationEdition=+"
		set "I_MPEG2VideoExtension=+"
		set "I_Notepad=+"
		set "I_OfficeHub=+"
		if "%ImageBuild%" geq "22621" set "I_QuickAssist=+"
		set "I_Paint=+"
		set "I_People=+"
		set "I_Photos=+"
		set "I_PowerAutomateDesktop=+"
		set "I_RawImageExtension=+"
		set "I_ScreenSketch=+"
		set "I_SolitaireCollection=+"
		set "I_SoundRecorder=+"
		set "I_StickyNotes=+"
		set "I_StorePurchaseApp=+"
		set "I_TeamsChat=+"
		set "I_Terminal=+"
		set "I_Todos=+"
		set "I_VP9VideoExtensions=+"
		set "I_WebMediaExtensions=+"
		set "I_WebpImageExtension=+"
		set "I_Whiteboard=+"
		set "I_Widgets=+"
		set "I_WindowsDefender=+"
		set "I_WindowsStore=+"
		set "I_WindowsSubsystemForAndroid=+"
		set "I_WindowsSubsystemForLinux=+"
		set "I_Xbox=+"
		set "I_XboxGameOverlay=+"
		set "I_XboxGamingOverlay=+"
		set "I_XboxIdentityProvider=+"
		set "I_XboxSpeechToTextOverlay=+"
		set "I_XboxTCUI=+"
		set "I_YourPhone=+"
		set "I_ZuneMusic=+"
		set "I_ZuneVideo=+"

		set "I_AMDLink=+"
		set "I_HPSupportAssistant=+"
		set "I_IntelGraphicsCommandCenter=+"
		set "I_IntelThunderboltController=+"
		set "I_KillerControlCenter=+"
		set "I_NVIDIAControlPanel=+"
		set "I_RealtekAudioControl=+"
		set "I_WavesMaxxAudioProforDell=+"
	)
	if /i "!MenuChoice!" equ "X" goto :IntInboxAppsMenu
)

:: 返回到选择 Microsoft 默认内置应用菜单
goto :SelectInboxAppsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 集成默认内置应用模组
::-------------------------------------------------------------------------------------------
:IntInboxApps

setlocal

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

set Alarms_Appx=
set AV1VideoExtension_Appx=
set AmazonAppStore_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 Clipchamp_Appx=
set CommunicationsApps_Appx=
set Cortana_Appx=
set D3DMappingLayers_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 Journal_Appx=
set Maps_Appx=
set Messaging_Appx=
set MicrosoftPowerBI_Appx=
set MinecraftEducationEdition_Appx=
set MixedRealityPortal_Appx=
set MixedRealityViewer_Appx=
set MPEG2VideoExtension_Appx=
set Notepad_Appx=
set NVIDIAControlPanel_Appx=
set OfficeHub_Appx=
set OneConnect_Appx=
set OneNote_Appx=
set QuickAssist_Appx=
set Paint_Appx=
set Paint3D_Appx=
set People_Appx=
set Photos_Appx=
set PhotosMediaEngine_Appx=
set PowerAutomateDesktop_Appx=
set Print3D_Appx=
set RawImageExtension_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set RealtekAudioControl_Appx=
set ScreenSketch_Appx=
set Skype_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set StorePurchaseApp_Appx=
set Teams_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set Whiteboard_Appx=
set WindowsDefender_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set WindowsSubsystemForLinux_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 AMDLink_Appx=
set HPSupportAssistant_Appx=
set IntelGraphicsCommandCenter_Appx=
set IntelThunderboltController_Appx=
set KillerControlCenter_Appx=
set NVIDIAControlPanel_Appx=
set RealtekAudioControl_Appx=
set WavesMaxxAudioProforDell_Appx=

set "Alarms_License=/LicensePath:%AppLicense%\Microsoft.WindowsAlarms_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "AV1VideoExtension_License=/LicensePath:%AppLicense%\Microsoft.AV1VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "AmazonAppStore_License=/LicensePath:%AppLicense%\Amazon.comServicesLLC.AmazonAppstore_bvztej1py64t8.xml"
set "BingFinance_License=/LicensePath:%AppLicense%\Microsoft.BingFinance_8wekyb3d8bbwe.xml"
set "BingFoodDrink_License=/LicensePath:%AppLicense%\Microsoft.BingFoodAndDrink_8wekyb3d8bbwe.xml"
set "BingHealthFitness_License=/LicensePath:%AppLicense%\Microsoft.BingHealthAndFitness_8wekyb3d8bbwe.xml"
set "BingMaps_License=/LicensePath:%AppLicense%\Microsoft.BingMaps_8wekyb3d8bbwe.xml"
set "BingNews_License=/LicensePath:%AppLicense%\Microsoft.BingNews_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "BingSports_License=/LicensePath:%AppLicense%\Microsoft.BingSports_8wekyb3d8bbwe.xml"
set "BingTravel_License=/LicensePath:%AppLicense%\Microsoft.BingTravel_8wekyb3d8bbwe.xml"
set "BingWeather_License=/LicensePath:%AppLicense%\Microsoft.BingWeather_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Calculator_License=/LicensePath:%AppLicense%\Microsoft.WindowsCalculator_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Camera_License=/LicensePath:%AppLicense%\Microsoft.WindowsCamera_8wekyb3d8bbwe.xml"
set "ClientWebExperience_License=/LicensePath:%AppLicense%\MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy.xml"
set "Clipchamp_License=/LicensePath:%AppLicense%\Clipchamp.Clipchamp_yxz26nhyzhsrt.xml"
set "CommunicationsApps_License=/LicensePath:%AppLicense%\Microsoft.WindowsCommunicationsApps_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "Cortana_License=/LicensePath:%AppLicense%\Microsoft.549981c3f5f10_8wekyb3d8bbwe.xml"
set "D3DMappingLayers_License=/LicensePath:%AppLicense%\Microsoft.D3DMappingLayers_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "DesktopAppInstaller_License=/LicensePath:%AppLicense%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.xml"
set "DirectXRuntime_License=/LicensePath:%AppLicense%\Microsoft.DirectXRuntime_8wekyb3d8bbwe.xml"
set "FeedbackHub_License=/LicensePath:%AppLicense%\Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe.xml"
set "GamingApp_License=/LicensePath:%AppLicense%\Microsoft.GamingApp_8wekyb3d8bbwe.xml"
set "GamingServices_License=/LicensePath:%AppLicense%\Microsoft.GamingServices_8wekyb3d8bbwe.xml"
set "GetHelp_License=/LicensePath:%AppLicense%\Microsoft.GetHelp_8wekyb3d8bbwe.xml"
set "Getstarted_License=/LicensePath:%AppLicense%\Microsoft.Getstarted_8wekyb3d8bbwe.xml"
set "HEIFImageExtension_License=/LicensePath:%AppLicense%\Microsoft.HEIFImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "HelpAndTips_License=/LicensePath:%AppLicense%\Microsoft.HelpAndTips_8wekyb3d8bbwe.xml"
set "HEVCVideoExtension_License=/LicensePath:%AppLicense%\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Journal_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftJournal_8wekyb3d8bbwe.xml"
set "Maps_License=/LicensePath:%AppLicense%\Microsoft.WindowsMaps_8wekyb3d8bbwe.xml"
set "Messaging_License=/LicensePath:%AppLicense%\Microsoft.Messaging_8wekyb3d8bbwe.xml"
set "MicrosoftPowerBI_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftPowerBIForWindows_8wekyb3d8bbwe.xml"
set "MinecraftEducationEdition_License=/LicensePath:%AppLicense%\Microsoft.MinecraftEducationEdition_8wekyb3d8bbwe.xml"
set "MixedRealityPortal_License=/LicensePath:%AppLicense%\Microsoft.MixedReality.Portal_8wekyb3d8bbwe.xml"
set "MixedRealityViewer_License=/LicensePath:%AppLicense%\Microsoft.Microsoft3DViewer_8wekyb3d8bbwe.xml"
set "MPEG2VideoExtension_License=/LicensePath:%AppLicense%\Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Notepad_License=/LicensePath:%AppLicense%\Microsoft.WindowsNotepad_8wekyb3d8bbwe.xml"
set "OfficeHub_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe.xml"
set "OneConnect_License=/LicensePath:%AppLicense%\Microsoft.OneConnect_8wekyb3d8bbwe.xml"
set "OneNote_License=/LicensePath:%AppLicense%\Microsoft.Office.OneNote_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "QuickAssist_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe.xml"
set "Paint_License=/LicensePath:%AppLicense%\Microsoft.Paint_8wekyb3d8bbwe.xml"
set "Paint3D_License=/LicensePath:%AppLicense%\Microsoft.MSPaint_8wekyb3d8bbwe.xml"
set "People_License=/LicensePath:%AppLicense%\Microsoft.People_8wekyb3d8bbwe.xml"
set "Photos_License=/LicensePath:%AppLicense%\Microsoft.Windows.Photos_8wekyb3d8bbwe.xml"
set "PhotosMediaEngine_License=/LicensePath:%AppLicense%\Microsoft.Photos.MediaEngineDLC_8wekyb3d8bbwe.xml"
set "PowerAutomateDesktop_License=/LicensePath:%AppLicense%\Microsoft.PowerAutomateDesktop_8wekyb3d8bbwe.xml"
set "Print3D_License=/LicensePath:%AppLicense%\Microsoft.Print3D_8wekyb3d8bbwe.xml"
set "RawImageExtension_License=/LicensePath:%AppLicense%\Microsoft.RawImageExtension_8wekyb3d8bbwe.xml"
set "Reader_License=/LicensePath:%AppLicense%\Microsoft.Reader_8wekyb3d8bbwe.xml"
set "ReadingList_License=/LicensePath:%AppLicense%\Microsoft.WindowsReadingList_8wekyb3d8bbwe.xml"
set "Scan_License=/LicensePath:%AppLicense%\Microsoft.WindowsScan_8wekyb3d8bbwe.xml"
set "ScreenSketch_License=/LicensePath:%AppLicense%\Microsoft.ScreenSketch_8wekyb3d8bbwe.xml"
set "Skype_License=/LicensePath:%AppLicense%\Microsoft.SkypeApp_kzf8qxf38zg5c_%SelectedSourceOS%.xml"
set "SolitaireCollection_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe.xml"
set "SoundRecorder_License=/LicensePath:%AppLicense%\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "StickyNotes_License=/LicensePath:%AppLicense%\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe.xml"
set "StorePurchaseApp_License=/LicensePath:%AppLicense%\Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml"
set "Teams_License=/LicensePath:%AppLicense%\MicrosoftTeams_8wekyb3d8bbwe.xml"
set "Terminal_License=/LicensePath:%AppLicense%\Microsoft.WindowsTerminal_8wekyb3d8bbwe.xml"
set "Todos_License=/LicensePath:%AppLicense%\Microsoft.Todos_8wekyb3d8bbwe.xml"
set "VP9VideoExtensions_License=/LicensePath:%AppLicense%\Microsoft.VP9VideoExtensions_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Wallet_License=/LicensePath:%AppLicense%\Microsoft.Wallet_8wekyb3d8bbwe.xml"
set "WebMediaExtensions_License=/LicensePath:%AppLicense%\Microsoft.WebMediaExtensions_8wekyb3d8bbwe.xml"
set "WebpImageExtension_License=/LicensePath:%AppLicense%\Microsoft.WebpImageExtension_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "Whiteboard_License=/LicensePath:%AppLicense%\Microsoft.Whiteboard_8wekyb3d8bbwe.xml"
set "WindowsDefender_License=/LicensePath:%AppLicense%\Microsoft.SecHealthUI_8wekyb3d8bbwe.%ImageArchitecture%.xml"
set "WindowsStore_License=/LicensePath:%AppLicense%\Microsoft.WindowsStore_8wekyb3d8bbwe.xml"
set "WindowsSubsystemForAndroid_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe.xml"
set "WindowsSubsystemForLinux_License=/LicensePath:%AppLicense%\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe.xml"
set "Xbox_License=/LicensePath:%AppLicense%\Microsoft.XboxApp_8wekyb3d8bbwe.xml"
set "XboxGameOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxGameOverlay_8wekyb3d8bbwe.xml"
set "XboxGamingOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxGamingOverlay_8wekyb3d8bbwe.xml"
set "XboxIdentityProvider_License=/LicensePath:%AppLicense%\Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml"
set "XboxLiveGames_License=/LicensePath:%AppLicense%\Microsoft.XboxLIVEGames_8wekyb3d8bbwe.xml"
set "XboxSpeechToTextOverlay_License=/LicensePath:%AppLicense%\Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bbwe.xml"
set "XboxTCUI_License=/LicensePath:%AppLicense%\Microsoft.Xbox.TCUI_8wekyb3d8bbwe.xml"
set "YourPhone_License=/LicensePath:%AppLicense%\Microsoft.YourPhone_8wekyb3d8bbwe.xml"
set "ZuneMusic_License=/LicensePath:%AppLicense%\Microsoft.ZuneMusic_8wekyb3d8bbwe_%SelectedSourceOS%.xml"
set "ZuneVideo_License=/LicensePath:%AppLicense%\Microsoft.ZuneVideo_8wekyb3d8bbwe_%SelectedSourceOS%.xml"

set "AMDLink_License=/LicensePath:%AppLicense%\AdvancedMicroDevicesInc-2.AMDLink_0a9344xs7nr4m.xml"
set "HPSupportAssistant_License=/LicensePath:%AppLicense%\AD2F1837.HPSupportAssistant_v10z8vjag6ke6.xml"
set "IntelGraphicsCommandCenter_License=/LicensePath:%AppLicense%\AppUp.IntelGraphicsExperience_8j3eq9eme6ctt.xml"
set "IntelThunderboltController_License=/LicensePath:%AppLicense%\AppUp.ThunderboltControlCenter_8j3eq9eme6ctt.xml"
set "KillerControlCenter_License=/LicensePath:%AppLicense%\RivetNetworks.KillerControlCenter_rh07ty8m5nkag.xml"
set "NVIDIAControlPanel_License=/LicensePath:%AppLicense%\NVIDIACorp.NVIDIAControlPanel_56jybvy8sckqj.xml"
set "RealtekAudioControl_License=/LicensePath:%AppLicense%\RealtekSemiconductorCorp.RealtekAudioControl_dt26b99r8h8gj.xml"
set "WavesMaxxAudioProforDell_License=/LicensePath:%AppLicense%\WavesAudio.MaxxAudioProforDell2020_fh4rh281wavaa.xml"

set AdvertisingXaml_Appx=
set AppRuntime_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 UIXaml28_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=

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

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

:: 检查 Microsoft 默认内置应用文件夹是否是空的

if not exist "%Apps%\*.appx" (
	echo.Microsoft 默认内置应用 .Appx 文件丢失……
	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 *AmazonAppstore*.*xbundle" 2^>nul') do if exist %%i set "AmazonAppStore_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 *Clipchamp*.*xbundle" 2^>nul') do if exist %%i set "Clipchamp_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 *D3DMappingLayers*.*appx" 2^>nul') do if exist %%i set "D3DMappingLayers_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 *MicrosoftJournal*.*xbundle" 2^>nul') do if exist %%i set "Journal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsMaps*.*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 *Microsoft.549981C3F5F10*.*xbundle" 2^>nul') do if exist %%i set "Cortana_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.MicrosoftPowerBIForWindows*.*xbundle" 2^>nul') do if exist %%i set "MicrosoftPowerBI_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.MinecraftEducationEdition*.*xbundle" 2^>nul') do if exist %%i set "MinecraftEducationEdition_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 *QuickAssist*.*xbundle" 2^>nul') do if exist %%i set "QuickAssist_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 *RawImageExtension*.*xbundle" 2^>nul') do if exist %%i set "RawImageExtension_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 *Teams*.*msix" 2^>nul') do if exist %%i set "Teams_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 *Microsoft.Whiteboard*.*xbundle" 2^>nul') do if exist %%i set "Whiteboard_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 *Microsoft.SecHealthUI*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "WindowsDefender_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 *WindowsSubsystemForLinux*.*xbundle" 2^>nul') do if exist %%i set "WindowsSubsystemForLinux_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 *AMDLink*.*msix" 2^>nul') do if exist %%i set "AMDLink_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HPSupportAssistant*.*xbundle" 2^>nul') do if exist %%i set "HPSupportAssistant_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *IntelGraphicsExperience*.*xbundle" 2^>nul') do if exist %%i set "IntelGraphicsCommandCenter_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ThunderboltControlCenter*.*xbundle" 2^>nul') do if exist %%i set "IntelThunderboltController_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *KillerControlCenter*.*xbundle" 2^>nul') do if exist %%i set "KillerControlCenter_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *NVIDIAControlPanel*%ImageArchitecture%*.appx" 2^>nul') do if exist %%i set "NVIDIAControlPanel_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *RealtekAudioControl*.*xbundle" 2^>nul') do if exist %%i set "RealtekAudioControl_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MaxxAudioProforDell*.*xbundle" 2^>nul') do if exist %%i set "WavesMaxxAudioProforDell_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 Microsoft.WindowsAppRuntime.1.1*%ImageArchitecture%*.Appx" 2^>nul') do set "AppRuntime_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.UI.Xaml.2.8*%ImageArchitecture%*.Appx" 2^>nul') do set "UIXaml28_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%\"

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 "%I_Alarms%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "闹钟和时钟", "%Alarms_Appx%", "%VCLibs12_Appx%", "%Alarms_License%"
			if "%I_BingFinance%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 财经", "%BingFinance_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFinance_License%"
			if "%I_BingFoodDrink%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 美食", "%BingFoodDrink_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingFoodDrink_License%"
			if "%I_BingHealthFitness%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 健康", "%BingHealthFitness_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingHealthFitness_License%"
			if "%I_BingMaps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 地图", "%BingMaps_Appx%", "%VCLibs12_Appx%", "%BingMaps_License%"
			if "%I_BingNews%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 资讯", "%BingNews_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingNews_License%"
			if "%I_BingSports%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 体育", "%BingSports_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingSports_License%"
			if "%I_BingTravel%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 旅游", "%BingTravel_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingTravel_License%"
			if "%I_BingWeather%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Bing 天气", "%BingWeather_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%BingWeather_License%"
			if "%I_Calculator%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "计算器", "%Calculator_Appx%", "%VCLibs12_Appx%", "%Calculator_License%"
			if "%I_CommunicationsApps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "日历、邮件和人脉", "%CommunicationsApps_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%CommunicationsApps_License%"
			if "%I_HelpAndTips%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "帮助和提示", "%HelpAndTips_Appx%", "%VCLibs12_Appx%", "%HelpAndTips_License%"
			if "%I_OneNote%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs12_Appx%", "%OneNote_License%"
			if "%I_Reader%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读器", "%Reader_Appx%", "%VCLibs12_Appx%", "%Reader_License%"
			if "%I_ReadingList%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "阅读列表", "%ReadingList_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%ReadingList_License%"
			if "%I_Scan%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "扫描", "%Scan_Appx%", "%VCLibs12_Appx%", "%Scan_License%"
			if "%I_Skype%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype 应用", "%Skype_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%Skype_License%"
			if "%I_SoundRecorder%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%VCLibs12_Appx%", "%SoundRecorder_License%"
			if "%I_XboxLiveGames%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Live 游戏", "%XboxLiveGames_Appx%", "%VCLibs12_Appx% %WinJS20_Appx%", "%XboxLiveGames_License%"
			if "%I_ZuneMusic%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Zune 音乐", "%ZuneMusic_Appx%", "%MediaPlayReadyClient22_Appx% %VCLibs12_Appx% %WinJS20_Appx%", "%ZuneMusic_License%"
			if "%I_ZuneVideo%" equ "+" 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 "%I_Alarms%" equ "+" (
				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% %UIXaml27_Appx% %VCLibs14_Appx%", "%Alarms_License%"
			)
			if "%I_AV1VideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " AV1 视频编解码器插件", "%AV1VideoExtension_Appx%", "%VCLibs14_Appx%", "%AV1VideoExtension_License%"
			if "%I_AmazonAppStore%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "亚马逊应用商店", "%AmazonAppStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "/SkipLicense"
			if "%I_BingNews%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "资讯", "%BingNews_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibs14_Appx%", "%BingNews_License%"
			if "%I_BingWeather%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "天气", "%BingWeather_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%BingWeather_License%"
			if "%I_Calculator%" equ "+" (
				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% %UIXaml27_Appx% %VCLibs14_Appx%", "%Calculator_License%"
			)
			if "%I_Camera%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "相机", "%Camera_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Camera_License%"
			if "%I_ClientWebExperience%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "小组件", "%ClientWebExperience_Appx%", "%VCLibs14_Appx%", "%ClientWebExperience_License%"
			if "%I_Clipchamp%" equ "+" (
				if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Clipchamp 视频编辑器", "%Clipchamp_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Clipchamp_License%"
				if "%ImageBuild%" geq "18362" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Clipchamp 视频编辑器", "%Clipchamp_Appx%", "", "%Clipchamp_License%"
			)
			if "%I_CommunicationsApps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 邮件", "%CommunicationsApps_Appx%", "%UIXaml27_Appx% %VCLibs14_Appx%", "%CommunicationsApps_License%"
			if "%I_Cortana%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Cortana ", "%Cortana_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Cortana_License%"
			if "%I_D3DMappingLayers%" equ "+" if "%ImageArchitecture%" neq "x86" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " OpenCL 和 OpenGL 兼容包", "%D3DMappingLayers_Appx%", "", "%D3DMappingLayers_License%"
			if "%I_DesktopAppInstaller%" equ "+" (
				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用安装程序", "%DesktopAppInstaller_Appx%", "%VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"
				if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用安装程序", "%DesktopAppInstaller_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用安装程序", "%DesktopAppInstaller_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx%", "%DesktopAppInstaller_License%"
			)
			if "%I_DirectXRuntime%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " DirectX Runtime ", "%DirectXRuntime_Appx%", "", "/SkipLicense"
			if "%I_FeedbackHub%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "反馈中心", "%FeedbackHub_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%FeedbackHub_License%"
			if "%I_GamingApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Gaming 应用", "%GamingApp_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%GamingApp_License%"
			if "%I_GamingServices%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "游戏服务", "%GamingServices_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "/SkipLicense"
			if "%I_GetHelp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "获取帮助", "%GetHelp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%GetHelp_License%"
			if "%I_Getstarted%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "使用技巧", "%Getstarted_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%Getstarted_License%"
			if "%I_HEIFImageExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEIF 图像编解码器插件", "%HEIFImageExtension_Appx%", "%VCLibs14_Appx%", "%HEIFImageExtension_License%"
			if "%I_HEVCVideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HEVC 视频编解码器插件", "%HEVCVideoExtension_Appx%", "%VCLibs14_Appx%", "%HEVCVideoExtension_License%"
			if "%I_Journal%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "日记", "%Journal_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%Journal_License%"
			if "%I_Maps%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "地图", "%Maps_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml23_Appx% %VCLibs14_Appx%", "%Maps_License%"
			if "%I_Messaging%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "消息", "%Messaging_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%Messaging_License%"
			if "%I_MicrosoftPowerBI%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "适用于 Windows 的 Microsoft Power BI ", "%MicrosoftPowerBI_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %UIXaml25_Appx% %VCLibs14_Appx%", "%MicrosoftPowerBI_License%"
			if "%I_MinecraftEducationEdition%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "我的世界教育版", "%MinecraftEducationEdition_Appx%", "%VCLibsUWPDesktop14_Appx%", "%MinecraftEducationEdition_License%"
			if "%I_MixedRealityPortal%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "混合现实门户", "%MixedRealityPortal_Appx%", "%VCLibs14_Appx%", "%MixedRealityPortal_License%"
			if "%I_MixedRealityViewer%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " 3D 查看器", "%MixedRealityViewer_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml21_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%MixedRealityViewer_License%"
			if "%I_MPEG2VideoExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " MPEG-2 视频编解码器插件", "%MPEG2VideoExtension_Appx%", "%VCLibs14_Appx%", "%MPEG2VideoExtension_License%"
			if "%I_Notepad%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "记事本", "%Notepad_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Notepad_License%"
			if "%I_OfficeHub%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "我的 Office ", "%OfficeHub_Appx%", "%VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%OfficeHub_License%"
			if "%I_OneConnect%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "移动套餐", "%OneConnect_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%OneConnect_License%"
			if "%I_OneNote%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Office OneNote ", "%OneNote_Appx%", "%VCLibs14_Appx%", "%OneNote_License%"
			if "%I_QuickAssist%" equ "+" if "%ImageBuild%" geq "22621" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "快速助手", "%QuickAssist_Appx%", "", "%QuickAssist_License%"
			if "%I_Paint%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图", "%Paint_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Paint_License%"
			if "%I_Paint3D%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "画图 3D ", "%Paint3D_Appx%", "%UIXaml20_Appx% %VCLibs14_Appx%", "%Paint3D_License%"
			if "%I_People%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "人脉", "%People_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%People_License%"
			if "%I_Photos%" equ "+" (
				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% %ServicesStoreEngagement_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Photos_License%"
			)
			if "%I_PowerAutomateDesktop%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Power Automate Desktop ", "%PowerAutomateDesktop_Appx%", "%VCLibsUWPDesktop14_Appx%", "%PowerAutomateDesktop_License%"
			if "%I_Print3D%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Print 3D ", "%Print3D_Appx%", "%VCLibs14_Appx%", "%Print3D_License%"
			if "%I_RawImageExtension%" equ "+" (
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Raw 图像插件", "%RawImageExtension_Appx%", "%VCLibs14_Appx%", "%RawImageExtension_License%"
				if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" equ "22000" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Raw 图像插件", "%RawImageExtension_Appx%", "%VCLibs14_Appx%", "%RawImageExtension_License%"
				if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22621" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Raw 图像插件", "%RawImageExtension_Appx%", "", "%RawImageExtension_License%"
			)
			if "%I_ScreenSketch%" equ "+" (
				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%", "%AppRuntime_Appx% %UIXaml27_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%ScreenSketch_License%"
			)
			if "%I_Skype%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Skype ", "%Skype_Appx%", "", "%Skype_License%"
			if "%I_SolitaireCollection%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Solitaire Collection ", "%SolitaireCollection_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%SolitaireCollection_License%"
			if "%I_SoundRecorder%" equ "+" (
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%UIXaml23_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "录音机", "%SoundRecorder_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%SoundRecorder_License%"
			)
			if "%I_StickyNotes%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "便笺", "%StickyNotes_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StickyNotes_License%"
			if "%I_StorePurchaseApp%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "应用商店体验主机", "%StorePurchaseApp_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%StorePurchaseApp_License%"
			if "%I_Teams%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Teams 聊天", "%Teams_Appx%", "", "/SkipLicense"
			if "%I_Terminal%" equ "+" (
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "终端", "%Terminal_Appx%", "%VCLibsUWPDesktop14_Appx%", "%Terminal_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "终端", "%Terminal_Appx%", "%UIXaml27_Appx% %VCLibsUWPDesktop14_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 "%I_Todos%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Todos ", "%Todos_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%Todos_License%"
			if "%I_VP9VideoExtensions%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Google 的 VP9 WebM 视频编解码器插件", "%VP9VideoExtensions_Appx%", "%VCLibs14_Appx%", "%VP9VideoExtensions_License%"
			if "%I_Wallet%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Microsoft Pay ", "%Wallet_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%Wallet_License%"
			if "%I_WebMediaExtensions%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Web 媒体编解码器插件", "%WebMediaExtensions_Appx%", "%VCLibs14_Appx%", "%WebMediaExtensions_License%"
			if "%I_WebpImageExtension%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " WebP 图像编解码器插件", "%WebpImageExtension_Appx%", "%VCLibs14_Appx%", "%WebpImageExtension_License%"
			if "%I_Whiteboard%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "白板", "%Whiteboard_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%Whiteboard_License%"
			if "%I_WindowsDefender%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows Defender Dashboard ", "%WindowsDefender_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsDefender_License%"
			if "%I_WindowsStore%" equ "+" (
				if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
				if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "18362" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml24_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
				if "%ImageBuild%" geq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Windows 应用商店", "%WindowsStore_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml27_Appx% %VCLibs14_Appx%", "%WindowsStore_License%"
			)
			if "%I_WindowsSubsystemForAndroid%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "适用于 Android 的 Windows 子系统", "%WindowsSubsystemForAndroid_Appx%", "%UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "/SkipLicense"
			if "%I_WindowsSubsystemForLinux%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "适用于 Linux 的 Windows 子系统", "%WindowsSubsystemForLinux_Appx%", "", "%WindowsSubsystemForLinux_License%"
			if "%I_Xbox%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox ", "%Xbox_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%Xbox_License%"
			if "%I_XboxGameOverlay%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar Plugin ", "%XboxGameOverlay_Appx%", "%VCLibs14_Appx%", "%XboxGameOverlay_License%"
			if "%I_XboxGamingOverlay%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Game Bar ", "%XboxGamingOverlay_Appx%", "%UIXaml24_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%XboxGamingOverlay_License%"
			if "%I_XboxIdentityProvider%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox Identity Provider ", "%XboxIdentityProvider_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxIdentityProvider_License%"
			if "%I_XboxSpeechToTextOverlay%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox 游戏语音窗口", "%XboxSpeechToTextOverlay_Appx%", "%VCLibs14_Appx%", "%XboxSpeechToTextOverlay_License%"
			if "%I_XboxTCUI%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Xbox UI ", "%XboxTCUI_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%XboxTCUI_License%"
			if "%I_YourPhone%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "手机连接", "%YourPhone_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%YourPhone_License%"
			if "%I_ZuneMusic%" equ "+" (
				if "%SelectedSourceOS%" equ "w10" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Groove 音乐", "%ZuneMusic_Appx%", "%UIXaml24_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
				if "%SelectedSourceOS%" equ "w11" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "媒体播放器", "%ZuneMusic_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %UIXaml28_Appx% %VCLibsUWPDesktop14_Appx% %VCLibs14_Appx%", "%ZuneMusic_License%"
			)
			if "%I_ZuneVideo%" equ "+" (
				if "%ImageBuild%" leq "18363" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml27_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
				if "%ImageBuild%" geq "19041" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "电影和电视", "%ZuneVideo_Appx%", "%UIXaml27_Appx% %VCLibs14_Appx%", "%ZuneVideo_License%"
			)

			if "%I_AMDLink%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " AMD Link ", "%AMDLink_Appx%", "%VCLibsUWPDesktop14_Appx%", "%AMDLink_License%"
			if "%I_HPSupportAssistant%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " HP Support Assistant 9 ", "%HPSupportAssistant_Appx%", "%NETNativeFramework13_Appx% %NETNativeRuntime13_Appx% %NETNativeFramework14_Appx% %NETNativeRuntime14_Appx% %VCLibs14_Appx%", "%HPSupportAssistant_License%"
			if "%I_IntelGraphicsCommandCenter%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "英特尔显卡控制中心", "%IntelGraphicsCommandCenter_Appx%", "%NETNativeFramework22_Appx% %NETNativeRuntime22_Appx% %VCLibs14_Appx%", "%IntelGraphicsCommandCenter_License%"
			if "%I_IntelThunderboltController%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Intel Thunderbolt 控制器", "%IntelThunderboltController_Appx%", "%NETNativeFramework21_Appx% %NETNativeRuntime21_Appx% %VCLibs14_Appx%", "%IntelThunderboltController_License%"
			if "%I_KillerControlCenter%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Rivet Networks Killer Control Center ", "%KillerControlCenter_Appx%", "", "%KillerControlCenter_License%"
			if "%I_NVIDIAControlPanel%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " NVIDIA 控制浮出控件", "%NVIDIAControlPanel_Appx%", "", "%NVIDIAControlPanel_License%"
			if "%I_RealtekAudioControl%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Realtek 音频控制台", "%RealtekAudioControl_Appx%", "%VCLibs14_Appx%", "%RealtekAudioControl_License%"
			if "%I_WavesMaxxAudioProforDell%" equ "+" call :AddProvisionedAppxPackage "%InstallMount%\%%i", " Waves MaxxAudio Pro for Dell 2020 ", "%WavesMaxxAudioProforDell_Appx%", "%NETNativeFramework17_Appx% %NETNativeRuntime17_Appx% %VCLibs14_Appx%", "%WavesMaxxAudioProforDell_License%"

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

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

:Stop
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set Apps=

set Alarms_Appx=
set AV1VideoExtension_Appx=
set AmazonAppStore_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 D3DMappingLayers_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 Journal_Appx=
set Maps_Appx=
set Messaging_Appx=
set MicrosoftPowerBI_Appx=
set MinecraftEducationEdition_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 RawImageExtension_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 Teams_Appx=
set Terminal_Appx=
set Todos_Appx=
set VP9VideoExtensions_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_Appx=
set Whiteboard_Appx=
set WindowsDefender_Appx=
set WindowsStore_Appx=
set WindowsSubsystemForAndroid_Appx=
set WindowsSubsystemForLinux_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 AMDLink_Appx=
set HPSupportAssistant_Appx=
set IntelGraphicsCommandCenter_Appx=
set IntelThunderboltController_Appx=
set KillerControlCenter_Appx=
set NVIDIAControlPanel_Appx=
set RealtekAudioControl_Appx=
set WavesMaxxAudioProforDell_Appx=

set AdvertisingXaml_Appx=
set AppRuntime_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 UIXaml28_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

:: 重置 Microsoft 默认内置应用状态标识
for %%i in (I_3DViewer,I_Alarms,I_AmazonAppStore,I_AV1VideoExtension,I_BingFinance,I_BingFoodDrink,I_BingHealthFitness,I_BingMaps,I_BingNews,I_BingSports,I_BingTravel,I_BingWeather,I_Calculator,I_Camera,I_ClientWebExperience,I_Clipchamp,I_CommunicationsApps,I_Cortana,I_D3DMappingLayers,I_DesktopAppInstaller,I_DirectXRuntime,I_FeedbackHub,I_GamingApp,I_GamingServices,I_GetHelp,I_Getstarted,I_HEIFImageExtension,I_HelpAndTips,I_HEVCVideoExtension,I_Journal,I_Maps,I_Messaging,I_MicrosoftPowerBI,I_MinecraftEducationEdition,I_MixedRealityPortal,I_MPEG2VideoExtension,I_Notepad,I_NVIDIAControlPanel,I_OfficeHub,I_OfficeOneNote,I_OneConnect,I_Paint,I_Paint3D,I_People,I_Photos,I_PowerAutomateDesktop,I_Print3D,I_QuickAssist,I_RawImageExtension,I_Reader,I_ReadingList,I_RealtekAudioControl,I_Scan,I_ScreenSketch,I_SkypeApp,I_SolitaireCollection,I_SoundRecorder,I_StickyNotes,I_StorePurchaseApp,I_TeamsChat,I_Terminal,I_Todos,I_VP9VideoExtensions,I_Wallet,I_WebMediaExtensions,I_WebpImageExtension,I_Whiteboard,I_WindowsDefender,I_WindowsStore,I_WindowsSubsystemForAndroid,I_WindowsSubsystemForLinux,I_Xbox,I_XboxGameOverlay,I_XboxGamingOverlay,I_XboxIdentityProvider,I_XboxLiveGames,I_XboxSpeechToTextOverlay,I_XboxTCUI,I_YourPhone,I_ZuneMusic,I_ZuneVideo) do (
	set "%%i=-"
)

:: 返回到集成 Microsoft 默认内置应用菜单
goto :IntInboxAppsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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] 或 Service 包 [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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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_%SelectedSourceOS%.tpk" (
	echo.Microsoft DirectX 9.0c 包文件“DirectX9c_%SelectedSourceOS%.tpk”没有找到……
	echo.
	echo.请复制上述文件到 ^<Packs\DirectX9c^> 文件夹……
	goto :Stop
)

:: 正在检查 Microsoft DirectX 9.0c 包文件是否存在
if not exist "%DirectX9c%\DirectX9c_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft DirectX 9.0c 包文件“DirectX9c_%SelectedSourceOS%_%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_%SelectedSourceOS%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.正在合并 Microsoft DirectX 9.0c 注册表设置……
		echo.-------------------------------------------------------------------------------
		echo.
		echo.正在安装映像注册表……
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.正在将注册表设置合并到映像注册表……
		call :ImportRegistry2Image "%DirectX9c%\DirectX9c_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####集成 Microsoft DirectX 9.0c 已完成#########################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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"
)

:: 检查所选择的源操作系统是否不是 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]  Go Back
	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]  Go Back
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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] 或 Service 包 [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>nul|set /p=请按任意键继续执行……
)
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 更新 Satisfy Update
	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 所有内部版本（包括 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%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2919355-%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-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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   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-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
   if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2919355-%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-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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%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-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   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-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
   if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%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-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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
   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-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

   :: 从 .MSU 程序包文件中复制 .CAB 文件到 CAB 临时文件夹
   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
   if exist "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3014442-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
   if exist "%Updates%\Windows8.1-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%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-KB5018922-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB5018922-%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-KB5018922-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB5018922-%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 "17763" 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" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h1enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-22h1enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-20h2enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-21h1enablement_*.manifest" if exist "%%i\%PackageArchitecture%_microsoft-windows-22h1enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.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%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >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" "WindowsFeatureExperience" >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
	copy "%PSFExtractor%.config" "%Temp%\Updates" >nul

	if exist "%Updates%\*.msu" (
		expand -R "%Updates%\*.msu" -F:SSU*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.cab "%Temp%\Updates" >nul
		expand -R "%Updates%\*.msu" -F:Win*.psf "%Temp%\Updates" >nul
	)

	if exist "%Updates%\*.cab" %XCopy% "%Updates%\*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\*.psf" %XCopy% "%Updates%\*.psf" "%Temp%\Updates" >nul

	if exist "%Temp%\Updates\*.psf" (
		for /f %%i in ('"dir /b %Temp%\Updates\SSU*.psf" 2^>nul') do (
			ren "%%i" "ServicingStack.psf"
			for /f %%j in ('"dir /b %Temp%\Updates\SSU*.cab" 2^>nul') do (ren "%%j" "ServicingStack.cab")
		)

		for /f "tokens=2 delims=-" %%i in ('"dir /b %Temp%\Updates\Windows*.psf" 2^>nul') do (
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.cab" 2^>nul') do (ren "%%j" "Cumulative.cab")
			for /f %%j in ('"dir /b %Temp%\Updates\*%%i*.psf" 2^>nul') do (ren "%%j" "Cumulative.psf")
		)

		if exist "%Temp%\Updates\ServicingStack.psf" (
			md "%Temp%\Updates\ServicingStack"
			expand -f:* ServicingStack.cab "%Temp%\Updates\ServicingStack" >nul

			if exist "%Temp%\Updates\ServicingStack\*cablist.ini" (
				expand -f:* "%Temp%\Updates\ServicingStack\*.cab" "%Temp%\Updates\ServicingStack" >nul
				call :RemoveFile "%Temp%\Updates\ServicingStack\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\ServicingStack\*.cab"
			)

			if not exist "%Temp%\Updates\ServicingStack\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\ServicingStack\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\ServicingStack\%%#" "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
				)
			)

			PSFExtractor.exe ServicingStack.cab >nul
			call :RemoveFile "%Temp%\Updates\ServicingStack\express.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\ServicingStack.*"
		)

		if exist "%Temp%\Updates\Cumulative.psf" (
			md "%Temp%\Updates\Cumulative"
			expand -f:* Cumulative.cab "%Temp%\Updates\Cumulative" >nul

			if exist "%Temp%\Updates\Cumulative\*cablist.ini" (
				expand -f:* "%Temp%\Updates\Cumulative\*.cab" "%Temp%\Updates\Cumulative" >nul
				call :RemoveFile "%Temp%\Updates\Cumulative\*cablist.ini"
				call :RemoveFile "%Temp%\Updates\Cumulative\*.cab"
			)

			if not exist "%Temp%\Updates\Cumulative\express.psf.cix.xml" (
				for /f %%# in ('dir /b /a:-d "%Temp%\Updates\Cumulative\*.psf.cix.xml"') do (
					ren "%Temp%\Updates\Cumulative\%%#" "%Temp%\Updates\Cumulative\express.psf.cix.xml"
				)
			)
			
			PSFExtractor.exe Cumulative.cab >nul
			call :RemoveFile "%Temp%\Updates\Cumulative\*.psf.cix.xml"
			call :RemoveFile "%Temp%\Updates\Cumulative.*"
		)

		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe"
		call :RemoveFile "%Temp%\Updates\PSFExtractor.exe.config"
	)

	if exist "%Temp%\Updates\*.cab" (
		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
		)

		call :RemoveFile "%Temp%\Updates\*.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 更新文件夹名称匹配它们各自的更新类型
	for /f %%i in ('"dir /b *.*" 2^>nul') do (
		if exist "%%i\update.mum" (
			findstr /c:"Package_for_ServicingStack" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "ServicingStack" >nul
		)

		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:"Microsoft .NET Framework 3.0 OnDemand" "%%i\update.mum" >nul
			if not errorlevel 1 ren "%%i" "NET35" >nul
		)

		if exist "%%i\%PackageArchitecture%_wcf-m_sm_cfg_ins_exe_31bf3856ad364e35_10.0.*.manifest" ren "%%i" "NET35CDU" >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-sv2moment1enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if exist "%%i\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" ren "%%i" "Enablement" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-onecore-c..dexperiencehost-api_31bf3856ad364e35_*.manifest" ren "%%i" "OOBE" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-userexperience-desktop_*.manifest" ren "%%i" "WindowsFeatureExperience" >nul
		if "%%i" neq "Cumulative" if exist "%%i\%PackageArchitecture%_microsoft-windows-i..dsetup-rejuvenation_*.manifest" ren "%%i" "SafeOS" >nul
	)

	cd /d "%ROOT%\"
)

echo.
echo.解压 .CAB 程序包文件到临时文件夹已完成……
echo.
if "%UpdateType%" neq "Boot" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" 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" (
			call :RemoveFolder "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_d4e678d60dbf374c"
			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" (
			call :RemoveFolder "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051459c61ca882"
			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" (
			call :RemoveFolder "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051c93c61c9d1e"
			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 基线功能包更新（KB5018922）……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 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" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
					echo.正在集成 Windows 10 v22H2 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
					echo.正在集成 Windows Server 2022 v22H2 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.正在集成 Windows 11 v22H2 Moment 1 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.正在集成 Windows 11 v22H2 Moment 2 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.正在集成 Windows 11 v22H2 Moment 3 功能启用更新程序包……
				)
				if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
					echo.正在集成 Windows 11 v22H2 Moment 4 功能启用更新程序包……
				)
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Enablement"
			)

			if exist "%Temp%\Updates\OOBE\Update.mum" (
				echo.-------------------------------------------------------------------------------
				echo.正在集成 Windows %OSID% OOBE 更新……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\OOBE"
			)
		)
	)

	:: 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" call :RemoveFolder "%DVD%\sources\%%i"
			)

			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 基线功能包更新（KB5018922）……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB5018922-%ImageArchitecture%.cab"
			)

			:: Windows 10
			if "%SelectedSourceOS%" equ "w10" (
				:: 合并注册表修复以启用将 Windows 10 更新集成到 EOL 版本。
				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%" geq "18362" if "%ImageBuild%" leq "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\WindowsFeatureExperience\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows Feature Experience Pack 更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\WindowsFeatureExperience"
				)

				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\NET35CDU\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Microsoft .NET Framework 3.5 关键动态更新程序包……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NET35CDU"
				)

				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" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
						echo.正在集成 Windows 10 v22H2 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
						echo.正在集成 Windows Server 2022 v22H2 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.正在集成 Windows 11 v22H2 Moment 1 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.正在集成 Windows 11 v22H2 Moment 2 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.正在集成 Windows 11 v22H2 Moment 3 功能启用更新程序包……
					)
					if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
						echo.正在集成 Windows 11 v22H2 Moment 4 功能启用更新程序包……
					)
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i",  "%Temp%\Updates\Enablement"
				)

				if exist "%Temp%\Updates\OOBE\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在集成 Windows %OSID% OOBE 更新……
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\OOBE"
				)

				if exist "%Temp%\Updates\Cumulative\Update.mum" if exist "%Temp%\Updates\NET35\Update.mum" if exist "%Temp%\Updates\NetCumulative\Update.mum" (
					echo.-------------------------------------------------------------------------------
					echo.正在重新集成 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 /y "%InstallMount%\%%i\Program Files\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!" >nul
					if "%ImageArchitecture%" equ "x64" Copy /y "%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 /y "%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 /y "%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 /y "%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 基线功能包更新（KB5018922）……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%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 基线功能包更新（KB5018922）……
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%WinReMount%", "%Temp%\Updates\Windows8.1-KB5018922-%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" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v21H2 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-22h2enablement_*.manifest" (
				echo.正在集成 Windows 10 v22H2 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-asosfe22h2enablement_*.manifest" (
				echo.正在集成 Windows Server 2022 v22H2 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment1enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.正在集成 Windows 11 v22H2 Moment 1 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment2enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.正在集成 Windows 11 v22H2 Moment 2 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment3enablement_*.manifest" if not exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.正在集成 Windows 11 v22H2 Moment 3 功能启用更新程序包……
			)
			if exist "%Temp%\Updates\Enablement\%PackageArchitecture%_microsoft-windows-sv2moment4enablement_*.manifest" (
				echo.正在集成 Windows 11 v22H2 Moment 4 功能启用更新程序包……
			)
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\Enablement"
		)

		if exist "%Temp%\Updates\OOBE\Update.mum" (
			echo.-------------------------------------------------------------------------------
			echo.正在集成 Windows %OSID% OOBE 更新……
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%WinReMount%", "%Temp%\Updates\OOBE"
		)
	)
)

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 更新 Satisfy Update
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 更新 Satisfy Update 文件夹
	echo.              ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WU.Satisfy^> 是空的……
	echo.
	echo.           请复制 Windows 更新 Satisfy Update 文件到相应的文件夹……
	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 Security Update###################################
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 更新 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%" 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 更新 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.
:: 创建 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 更新 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 更新 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.-------------------------------------------------------------------------------

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-KB5006749-%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-KB5006743-%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 更新 Satisfy 更新……
					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 更新 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 更新 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 更新 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.正在清理适用于域环境的同步代理临时文件夹。

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 更新 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.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 安装程序启动映像……
   echo.
   pause>nul|set /p=请按任意键继续执行……
   goto :IntWHDUpdatesMenu
)

echo.-------------------------------------------------------------------------------
echo.####正在开始更新 Windows 安装媒介##############################################
echo.-------------------------------------------------------------------------------
echo.
echo.正在获取 Windows 安装媒介语言设置……
echo.
for /f "tokens=1 delims= " %%a in ('%DISM% /Get-WimInfo /WimFile:"%BootWim%" /Index:2 ^| findstr /i "Default"') do (set "ImageDefaultLanguage=%%a")
set "ImageDefaultLanguage=!ImageDefaultLanguage:~1!"
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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到集成自定义功能菜单
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 /y "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc_x.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc64_x.exe" >nul
			copy /y "%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\cmd.exe" "%Temp%\cmd.bak" >nul
copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\SnippingTool.exe" "%Temp%\SnippingTool.bak" >nul
if exist "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\win32calc.exe" "%Temp%\win32calc.bak" >nul

if "%ImageArchitecture%" equ "x64" (
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\cmd.exe" "%Temp%\cmd_wow64.bak" >nul
	if exist "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\win32calc.exe" "%Temp%\win32calc_wow64.bak" >nul
)

if "%ImageBuild%" leq "17763" (
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\imageres.dll" "%Temp%\imageres.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\imagesp1.dll" "%Temp%\imagesp1.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\mydocs.dll" "%Temp%\mydocs.bak" >nul
	rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\shell32.dll" "%Temp%\shell32.bak" >nul
	rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\taskmgr.exe" "%Temp%\taskmgr.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\System32\zipfldr.dll" "%Temp%\zipfldr.bak" >nul
	
	if "%ImageArchitecture%" equ "x64" (
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imageres.dll" "%Temp%\imageres_wow64.bak" >nul
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\imagesp1.dll" "%Temp%\imagesp1_wow64.bak" >nul
		copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\mydocs.dll" "%Temp%\mydocs_wow64.bak" >nul
		rem copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SysWOW64\taskmgr.exe" "%Temp%\taskmgr_wow64.bak" >nul
		copy /y "%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 /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imageres.dll.mun" "%Temp%\imageres.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\imagesp1.dll.mun" "%Temp%\imagesp1.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\mydocs.dll.mun" "%Temp%\mydocs.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\shell32.dll.mun" "%Temp%\shell32.bak" >nul
	copy /y "%InstallMount%\%DefaultIndexNo%\Windows\SystemResources\taskmgr.exe.mun" "%Temp%\taskmgr.bak" >nul
	copy /y "%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 /y "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer64_x.dll" >nul
			copy /y "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer32_x.dll" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz64_x.dll" >nul
			copy /y "%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 /y "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy /y "%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 /y "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy /y "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy /y "%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 /y "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy /y "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc64_x.dll" >nul
			copy /y "%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set Skins=

endlocal

:: 返回到集成自定义功能菜单
goto :IntCustomFeaturesMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 移除 Windows 组件菜单模组
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsMenu

:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	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/v22H2、Windows 11 v21H2/v22H2 客户端
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
	cls
	echo.===============================================================================
	echo.                          MSMG 工具箱 - 移除 Windows 组件菜单
	echo.===============================================================================
	echo.  [1]   Internet
	echo.
	echo.  [2]   多 媒 体
	echo.
	echo.  [3]   网    络
	echo.
	echo.  [4]   隐    私
	echo.
	echo.  [5]   远程处理
	echo.
	echo.  [6]   系    统
	echo.
	echo.  [7]   系统应用
	echo.
	if "%ImageFlag%" equ "EnterpriseS" echo.
	if "%ImageFlag%" equ "EnterpriseSN" echo.

	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
		echo.  [8]   Windows 应用
	)
	echo.
	echo.
	echo.  [X]   返回
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "请输入你的选项 ："
	if errorlevel 9 goto :RemoveWindowsComponentsMenu
	if errorlevel 8 if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" goto :RemoveWindowsAppsMenu
	if errorlevel 7 goto :RemoveSystemAppsMenu
	if errorlevel 6 goto :RemoveSystemMenu
	if errorlevel 5 goto :RemoveRemotingMenu
	if errorlevel 4 goto :RemovePrivacyMenu
	if errorlevel 3 goto :RemoveNetworkMenu
	if errorlevel 2 goto :RemoveMultimediaMenu
	if errorlevel 1 goto :RemoveInternetMenu
)

:RemoveInternetMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端 Internet 菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                    MSMG 工具箱 - 移除 Internet 组件菜单
	echo.===============================================================================
	echo.
	if "%SelectedSourceOS%" equ "w10" echo.  [01] %C_AdobeFlashForWindows% 适用于 Windows 的 Adobe Flash
	if "%SelectedSourceOS%" equ "w11" echo.  [01] %C_EdgeChromium% Edge Chromium 浏览器 ^| 依赖于 ：Edge WebView
	if "%SelectedSourceOS%" equ "w10" echo.  [02] %C_EdgeChromium% Edge Chromium 浏览器
	if "%SelectedSourceOS%" equ "w11" echo.  [02] %C_EdgeWebView% Edge WebView ^| 兼容性 ：Visual Studio
	echo.  [03] %C_InternetExplorer% Internet Explorer
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]    所有 Internet 组件
	echo.  [X]    返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" if "%SelectedSourceOS%" equ "w10" ( if "%C_AdobeFlashForWindows%" equ "+" ( set "C_AdobeFlashForWindows=-" ) else ( set "C_AdobeFlashForWindows=+" ) )
	if "!MenuChoice!" equ "01" if "%SelectedSourceOS%" equ "w11" (
		if "%C_EdgeChromium%" equ "+" (
			set "C_EdgeChromium=-"
		) else ( 
			set "C_EdgeChromium=+"
			set "C_EdgeWebView=+"
		)
	)
	if "!MenuChoice!" equ "02" if "%SelectedSourceOS%" equ "w10" ( if "%C_EdgeChromium%" equ "+" ( set "C_EdgeChromium=-" ) else ( set "C_EdgeChromium=+" ) )
	if "!MenuChoice!" equ "02" if "%SelectedSourceOS%" equ "w11" (
		if "%C_EdgeWebView%" equ "+" (
			set "C_ClientWebExperience=-"
			set "C_EdgeChromium=-"
			set "C_EdgeWebView=-"
		) else ( 
			set "C_EdgeWebView=+"
		)
	)
	if "!MenuChoice!" equ "03" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if /i "!MenuChoice!" equ "A" (
		if "%SelectedSourceOS%" equ "w10" set "C_AdobeFlashForWindows=-"
		set "C_EdgeChromium=-"
		if "%SelectedSourceOS%" equ "w11" (
			set "C_ClientWebExperience=-"
			set "C_EdgeWebView=-"
		)
		set "C_InternetExplorer=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemoveInternetMenu
)

:RemoveMultimediaMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端多媒体菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                      MSMG 工具箱 - 移除多媒体组件菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_FirstLogonAnimation% 首次登录动画 ^| 依赖于 ：开箱即用体验（OOBE）
	echo.  [02] %C_GameExplorer% 游戏浏览器 ^| 兼容性 ：Microsoft 游戏
	echo.  [03] %C_LockScreenBackground% 锁屏背景
	echo.  [04] %C_ScreenSavers% 屏幕保护程序
	if "%SelectedSourceOS%" equ "w10" echo.  [05] %C_SnippingTool% 截图工具
	echo.  [06] %C_SoundThemes% 声音主题
	if "%SelectedSourceOS%" equ "w10" echo.  [07] %C_SpeechRecognition% 语音识别
	if "%SelectedSourceOS%" equ "w11" echo.  [07] %C_SpeechRecognition% 语音识别
	echo.  [08] %C_Wallpapers% 墙纸
	echo.  [09] %C_WindowsMediaPlayer% Windows Media Player
	echo.  [10] %C_WindowsPhotoViewer% Windows 照片查看器
	echo.  [11] %C_WindowsThemes% Windows 主题
	echo.  [12] %C_WindowsTIFFIFilter% Windows TIFF IFilter（OCR）
	echo.  [13] %C_WinSAT% Windows 系统评估工具 ^| 兼容性 ：Microsoft 游戏
	echo.
	echo.  [A]    所有多媒体组件
	echo.  [X]    返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" (
		if "%C_FirstLogonAnimation%" equ "+" ( 
			set "C_FirstLogonAnimation=-"
		) else ( 
			set "C_CloudExperienceHost=+"
			set "C_FirstLogonAnimation=+"
		)
	)
	if "!MenuChoice!" equ "02" ( if "%C_GameExplorer%" equ "+" ( set "C_GameExplorer=-" ) else  ( set "C_GameExplorer=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_LockScreenBackground%" equ "+" ( set "C_LockScreenBackground=-" ) else  ( set "C_LockScreenBackground=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_ScreenSavers%" equ "+" ( set "C_ScreenSavers=-" ) else  ( set "C_ScreenSavers=+" ) )
	if "!MenuChoice!" equ "05" if "%SelectedSourceOS%" equ "w10" ( if "%C_SnippingTool%" equ "+" ( set "C_SnippingTool=-" ) else ( set "C_SnippingTool=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_SoundThemes%" equ "+" ( set "C_SoundThemes=-" ) else  ( set "C_SoundThemes=+" ) )
	if "!MenuChoice!" equ "07" (
		if "%C_SpeechRecognition%" equ "+" ( 
			set "C_Cortana=-"
			set "C_Narrator=-"
			set "C_NarratorQuickStart=-"
			set "C_SpeechRecognition=-"
		) else ( 
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "08" ( if "%C_Wallpapers%" equ "+" ( set "C_Wallpapers=-" ) else ( set "C_Wallpapers=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_WindowsMediaPlayer%" equ "+" ( set "C_WindowsMediaPlayer=-" ) else ( set "C_WindowsMediaPlayer=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_WindowsPhotoViewer%" equ "+" ( set "C_WindowsPhotoViewer=-" ) else ( set "C_WindowsPhotoViewer=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_WindowsThemes%" equ "+" ( set "C_WindowsThemes=-" ) else ( set "C_WindowsThemes=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_WindowsTIFFIFilter%" equ "+" ( set "C_WindowsTIFFIFilter=-" ) else ( set "C_WindowsTIFFIFilter=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_WinSAT%" equ "+" ( set "C_WinSAT=-" ) else ( set "C_WinSAT=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_Cortana=-"
		set "C_FirstLogonAnimation=-"
		set "C_GameExplorer=-"
		set "C_LockScreenBackground=-"
		set "C_ScreenSavers=-"
		if "%SelectedSourceOS%" equ "w10" set "C_SnippingTool=-"
		set "C_SoundThemes=-"
		set "C_SpeechRecognition=-"
		set "C_Wallpapers=-"
		set "C_WindowsMediaPlayer=-"
		set "C_WindowsPhotoViewer=-"
		set "C_WindowsThemes=-"
		set "C_WindowsTIFFIFilter=-"
		set "C_WinSAT=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemoveMultimediaMenu
)

:RemoveNetworkMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端网络菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                        MSMG 工具箱 - 移除网络组件菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_OfflineFiles% 脱机文件 ^| 兼容性 ：应用程序防护 / 容器
	echo.  [02] %C_OpenSSH% Open SSH
	echo.  [03] %C_RemoteDesktopClient% 远程桌面客户端 ^| 兼容性 ：推荐
	echo.  [04] %C_RemoteDifferentialCompression% 远程差分压缩（RDC）
	echo.  [05] %C_SimpleTCPIPServices% 简单 TCP/IP 服务
	echo.  [06] %C_TelnetClient% Telnet 客户端
	echo.  [07] %C_TFTPClient% TFTP 客户端
	echo.  [08] %C_WalletService% 电子钱包服务
	echo.  [09] %C_WindowsMail% Windows 邮件
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有网络组件
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_OfflineFiles%" equ "+" ( set "C_OfflineFiles=-" ) else  ( set "C_OfflineFiles=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_OpenSSH%" equ "+" ( set "C_OpenSSH=-" ) else  ( set "C_OpenSSH=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_RemoteDesktopClient%" equ "+" ( set "C_RemoteDesktopClient=-" ) else ( set "C_RemoteDesktopClient=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_RemoteDifferentialCompression%" equ "+" ( set "C_RemoteDifferentialCompression=-" ) else ( set "C_RemoteDifferentialCompression=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_SimpleTCPIPServices%" equ "+" ( set "C_SimpleTCPIPServices=-" ) else ( set "C_SimpleTCPIPServices=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_TelnetClient%" equ "+" ( set "C_TelnetClient=-" ) else ( set "C_TelnetClient=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_TFTPClient%" equ "+" ( set "C_TFTPClient=-" ) else ( set "C_TFTPClient=+" ) )
	if "!MenuChoice!" equ "08" (
		if "%C_WalletService%" equ "+" (
			set "C_Wallet=-"
			set "C_WalletService=-"
		) else (
			set "C_WalletService=+"
		)
	)
	if "!MenuChoice!" equ "09" (
		if "%C_WindowsMail%" equ "+" (
			set "C_CommunicationsApps=-"
			set "C_WindowsMail=-"
		) else (
			set "C_WindowsMail=+"
		)
	)
	if /i "!MenuChoice!" equ "A" (
		set "C_CommunicationsApps=-"
		set "C_OfflineFiles=-"
		set "C_OpenSSH=-"
		set "C_RemoteDesktopClient=-"
		set "C_RemoteDifferentialCompression=-"
		set "C_SimpleTCPIPServices=-"
		set "C_TelnetClient=-"
		set "C_TFTPClient=-"
		set "C_Wallet=-"
		set "C_WalletService=-"
		set "C_WindowsMail=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemoveNetworkMenu
)

:RemovePrivacyMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端隐私菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                        MSMG 工具箱 - 移除隐私组件菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_AssignedAccess% 分配的访问权限
	echo.  [02] %C_CEIP% 客户体验改善计划（CEIP）
	echo.  [03] %C_FaceRecognition% 人脸识别
	echo.  [04] %C_KernelDebugging% 内核调试 ^| 兼容性 ：应用程序防护 / 容器
	echo.  [05] %C_LocationService% 定位服务
	echo.  [06] %C_PicturePassword% 图片密码
	echo.  [07] %C_PinEnrollment% Pin 登录支持 ^| 兼容性 ：生物识别
	echo.  [08] %C_UnifiedTelemetryClient% 统一遥测客户端（Asimov）^| 依赖于 ：Windows 错误报告
	echo.  [09] %C_WiFiNetworkManager% WiFi 网络管理器（WiFi 感知）
	if "%ImageBuild%" equ "17763" echo.  [10] %C_WindowsErrorReporting% Windows 错误报告
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.  [10] %C_WindowsErrorReporting% Windows 错误报告 ^| 兼容性 ：开箱即用体验（OOBE）
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.  [10] %C_WindowsErrorReporting% Windows 错误报告
	echo.  [11] %C_WindowsInsiderHub% Windows 会员中心
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有隐私组件
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( 
		if "%C_AssignedAccess%" equ "+" ( 
			set "C_AssignedAccess=-"
			if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
		)
	)
	if "!MenuChoice!" equ "02" ( if "%C_CEIP%" equ "+" ( set "C_CEIP=-" ) else ( set "C_CEIP=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_FaceRecognition%" equ "+" ( set "C_FaceRecognition=-" ) else ( set "C_FaceRecognition=+" ) )
	if "!MenuChoice!" equ "04" ( 
		if "%C_KernelDebugging%" equ "+" ( 
			set "C_KernelDebugging=-"
		) else ( 
			set "C_KernelDebugging=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if "!MenuChoice!" equ "05" ( if "%C_LocationService%" equ "+" ( set "C_LocationService=-" ) else ( set "C_LocationService=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_PicturePassword%" equ "+" ( set "C_PicturePassword=-" ) else ( set "C_PicturePassword=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_PinEnrollment%" equ "+" ( set "C_PinEnrollment=-" ) else ( set "C_PinEnrollment=+" ) )
	if "!MenuChoice!" equ "08" ( 
		if "%C_UnifiedTelemetryClient%" equ "+" ( 
			set "C_UnifiedTelemetryClient=-"
		) else ( 
			set "C_UnifiedTelemetryClient=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if "!MenuChoice!" equ "09" ( if "%C_WiFiNetworkManager%" equ "+" ( set "C_WiFiNetworkManager=-" ) else ( set "C_WiFiNetworkManager=+" ) )
	if "!MenuChoice!" equ "10" ( 
		if "%C_WindowsErrorReporting%" equ "+" ( 
			set "C_KernelDebugging=-"
			set "C_UnifiedTelemetryClient=-"
			set "C_WindowsErrorReporting=-"
		) else ( 
			set "C_WindowsErrorReporting=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_WindowsInsiderHub%" equ "+" ( set "C_WindowsInsiderHub=-" ) else ( set "C_WindowsInsiderHub=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_AssignedAccess=-"
		if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" 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 /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemovePrivacyMenu
)

:RemoveRemotingMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端远程处理菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除远程处理组件菜单
	echo.===============================================================================
	echo.
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.  [01] %C_HomeGroup% 家庭组
	echo.  [02] %C_MultiPointConnector% MultiPoint Connector
	echo.  [03] %C_OneDrive% OneDrive 桌面客户端
	echo.  [04] %C_RemoteAssistance% 远程协助
	echo.  [05] %C_RemoteDesktopServer% 远程桌面服务器 ^| 兼容性 ：应用程序防护 / 容器、Hyper-V
	echo.  [06] %C_RemoteRegistry% 远程注册表
	echo.  [07] %C_WorkFoldersClient% 工作文件夹客户端
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有远程处理组件
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" ( if "%C_HomeGroup%" equ "+" ( set "C_HomeGroup=-" ) else ( set "C_HomeGroup=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_MultiPointConnector%" equ "+" ( set "C_MultiPointConnector=-" ) else ( set "C_MultiPointConnector=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_RemoteAssistance%" equ "+" ( set "C_RemoteAssistance=-" ) else ( set "C_RemoteAssistance=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_RemoteDesktopServer%" equ "+" ( set "C_RemoteDesktopServer=-" ) else ( set "C_RemoteDesktopServer=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_RemoteRegistry%" equ "+" ( set "C_RemoteRegistry=-" ) else ( set "C_RemoteRegistry=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_WorkFoldersClient%" equ "+" ( set "C_WorkFoldersClient=-" ) else ( set "C_WorkFoldersClient=+" ) )
	if /i "!MenuChoice!" equ "A" (
		if "%SelectedSourceOS%" equ "w10" set "C_HomeGroup=-"
		set "C_MultiPointConnector=-"
		set "C_OneDrive=-"
		set "C_RemoteAssistance=-"
		set "C_RemoteDesktopServer=-"
		set "C_RemoteRegistry=-"
		set "C_WorkFoldersClient=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemoveRemotingMenu
)

:RemoveSystemMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端系统菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                       MSMG 工具箱 - 移除系统组件菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_AccessibilityTools% 辅助工具
	if "%ImageFlag%" equ "EnterpriseS" echo.  [02] %C_Calculator% 计算器
	if "%ImageFlag%" equ "EnterpriseSN" echo.  [02] %C_Calculator% 计算器
	echo.  [03] %C_DeviceLockdown% 设备锁定（嵌入式体验）
	echo.  [04] %C_EaseOfAccessCursors% 轻松访问光标 ^| 依赖于 ：辅助工具
	echo.  [05] %C_EaseOfAccessThemes% 轻松访问主题 ^| 依赖于 ：辅助工具
	echo.  [06] %C_EasyTransfer% 轻松传送 ^| 兼容性 ：Windows 升级
	echo.  [07] %C_FileHistory% 文件历史记录
	echo.  [08] %C_Magnifier% 放大镜 ^| 依赖于 ：辅助工具
	echo.  [09] %C_ManualSetup% 手动安装程序（就地升级）^| 兼容性 ：Windows 升级
	echo.  [10] %C_Narrator% 讲述人 ^| 依赖于 ：辅助工具、语音识别
	echo.  [11] %C_Notepad% 记事本
	echo.  [12] %C_OnScreenKeyboard% 屏幕键盘 ^| 依赖于 ：辅助工具
	if "%SelectedSourceOS%" equ "w10" echo.  [13] %C_Paint% 画图
	echo.  [14] %C_ProjFS% Projected File System（ProjFS）
	echo.  [15] %C_SecurityCenter% 安全中心 ^| 依赖于 ：Windows Defender ^| 兼容性 ：应用程序防护 / 容器
	echo.  [16] %C_StepsRecorder% 步骤记录器
	echo.  [17] %C_StorageSpaces% 存储空间
	echo.  [18] %C_SystemRestore% 系统恢复
	echo.  [19] %C_WindowsBackup% Windows 备份
	echo.  [20] %C_WindowsFirewall% Windows 防火墙 ^| 兼容性 ：推荐
	echo.  [21] %C_WindowsSubsystemForLinux% 适用于 Linux 的 Windows 子系统
	echo.  [22] %C_WindowsToGo% Windows To Go
	echo.  [23] %C_WindowsUpdate% Windows 更新 ^| 兼容性 ：Windows 更新
	echo.  [24] %C_Wordpad% 写字板
	echo.
	echo.  [A]   所有系统组件
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( 
		if "%C_AccessibilityTools%" equ "+" (
			set "C_AccessibilityTools=-"
			set "C_EaseOfAccessCursors=-"
			set "C_EaseOfAccessThemes=-"
			set "C_Magnifier=-"
			set "C_Narrator=-"
			set "C_OnScreenKeyboard=-"
		) else (
			set "C_AccessibilityTools=+"
		)
	)
	if "!MenuChoice!" equ "02" if "%ImageFlag%" equ "EnterpriseS" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "02" if "%ImageFlag%" equ "EnterpriseSN" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_DeviceLockdown%" equ "+" ( set "C_DeviceLockdown=-" ) else ( set "C_DeviceLockdown=+" ) )
	if "!MenuChoice!" equ "04" (
		if "%C_EaseOfAccessCursors%" equ "+" (
			set "C_EaseOfAccessCursors=-"
		) else (
			set "C_AccessibilityTools=+"
			set "C_EaseOfAccessCursors=+"
		)
	)
	if "!MenuChoice!" equ "05" (
		if "%C_EaseOfAccessThemes%" equ "+" (
			set "C_EaseOfAccessThemes=-"
		) else (
			set "C_AccessibilityTools=+"
			set "C_EaseOfAccessThemes=+"
		)
	)
	if "!MenuChoice!" equ "06" ( if "%C_EasyTransfer%" equ "+" ( set "C_EasyTransfer=-" ) else ( set "C_EasyTransfer=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_FileHistory%" equ "+" ( set "C_FileHistory=-" ) else ( set "C_FileHistory=+" ) )
	if "!MenuChoice!" equ "08" (
		if "%C_Magnifier%" equ "+" (
			set "C_Magnifier=-"
		) else (
			set "C_AccessibilityTools=+"
			set "C_Magnifier=+"
		)
	)
	if "!MenuChoice!" equ "09" ( if "%C_ManualSetup%" equ "+" ( set "C_ManualSetup=-" ) else ( set "C_ManualSetup=+" ) )
	if "!MenuChoice!" equ "10" (
		if "%C_Narrator%" equ "+" (
			set "C_Narrator=-"
		) else (
			set "C_AccessibilityTools=+"
			set "C_Narrator=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_Notepad%" equ "+" ( set "C_Notepad=-" ) else ( set "C_Notepad=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_OnScreenKeyboard%" equ "+" (
			set "C_OnScreenKeyboard=-"
		) else (
			set "C_AccessibilityTools=+"
			set "C_OnScreenKeyboard=+"
		)
	)
	if "!MenuChoice!" equ "13" if "%SelectedSourceOS%" equ "w10" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_ProjFS%" equ "+" ( set "C_ProjFS=-" ) else ( set "C_ProjFS=+" ) )
	if "!MenuChoice!" equ "15" (
		if "%C_SecurityCenter%" equ "+" ( 
			set "C_SecurityCenter=-"
		) else ( 
			set "C_SecurityCenter=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "16" ( if "%C_StepsRecorder%" equ "+" ( set "C_StepsRecorder=-" ) else ( set "C_StepsRecorder=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_StorageSpaces%" equ "+" ( set "C_StorageSpaces=-" ) else ( set "C_StorageSpaces=+" ) )
	if "!MenuChoice!" equ "18" ( 
		if "%C_SystemRestore%" equ "+" ( 
			set "C_SystemRestore=-"
		) else ( 
			set "C_SystemRestore=+"
		)
	)
	if "!MenuChoice!" equ "19" ( 
		if "%C_WindowsBackup%" equ "+" ( 
			set "C_WindowsBackup=-"
		) else ( 
			set "C_WindowsBackup=+"
		)
	)
	if "!MenuChoice!" equ "20" ( if "%C_WindowsFirewall%" equ "+" ( set "C_WindowsFirewall=-" ) else ( set "C_WindowsFirewall=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_WindowsSubsystemForLinux%" equ "+" ( set "C_WindowsSubsystemForLinux=-" ) else ( set "C_WindowsSubsystemForLinux=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_WindowsToGo%" equ "+" ( set "C_WindowsToGo=-" ) else ( set "C_WindowsToGo=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_WindowsUpdate%" equ "+" ( set "C_WindowsUpdate=-" ) else ( set "C_WindowsUpdate=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_Wordpad%" equ "+" ( set "C_Wordpad=-" ) else ( set "C_Wordpad=+" ) )
	if /i "!MenuChoice!" equ "A" (
		set "C_AccessibilityTools=-"
		if "%ImageFlag%" equ "EnterpriseS" set "C_Calculator=-"
		if "%ImageFlag%" equ "EnterpriseSN" set "C_Calculator=-"
		set "C_DeviceLockdown=-"
		set "C_EaseOfAccessCursors=-"
		set "C_EaseOfAccessThemes=-"
		set "C_EasyTransfer=-"
		set "C_FileHistory=-"
		set "C_Magnifier=-"
		set "C_ManualSetup=-"
		set "C_Narrator=-"
		set "C_Notepad=-"
		set "C_OnScreenKeyboard=-"
		if "%SelectedSourceOS%" equ "w10" set "C_Paint=-"
		set "C_ProjFS=-"
		set "C_SecurityCenter=-"
		set "C_StepsRecorder=-"
		set "C_StorageSpaces=-"
		set "C_SystemRestore=-"
		set "C_WindowsBackup=-"
		set "C_WindowsFirewall=-"
		set "C_WindowsSubsystemForLinux=-"
		set "C_WindowsToGo=-"
		set "C_WindowsUpdate=-"
		set "C_Wordpad=-"
	)
	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu

	goto :RemoveSystemMenu
)

:RemoveSystemAppsMenu
:: 移除 Windows 10 v1809/v1903/v1909/v2004/v20H2/v21H1/v21H2/v22H2、Windows 11 v21H2/v22H2 客户端版本系统应用菜单
if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                        MSMG 工具箱 - 移除系统应用菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_AADBrokerPlugin% AAD Broker Plugin - 用于 Microsoft Azure 登录的凭据处理程序  ^| 兼容性 ：Windows 应用商店
	echo.  [02] %C_AccountsControl% 帐户控制 - 用于为 Microsoft 应用添加 Microsoft 帐户的应用 ^| 兼容性 ：Windows 应用商店
	echo.  [03] %C_AddSuggestedFoldersToLibraryDialog% 将建议的文件夹添加到库对话框
	echo.  [04] %C_AppResolverUX% App Resolver UX - 现代打开方式对话框
	if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" echo.  [05] %C_AssignedAccessLockApp% “指定访问锁定”应用 - Windows 展台模式 ^| 依赖于 ：分配的访问权限
	echo.  [06] %C_AsyncTextService% Async Text 服务 - 人脉和地图应用的消息扩展
	echo.  [07] %C_BioEnrollment% 生物注册 - Windows Hello 安装程序 ^| 兼容性 ：生物识别
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" echo.  [08] %C_CallingShellApp% Calling Shell 应用 - 用于在 shell 上托管呼叫进度的应用
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [09] %C_CapturePicker% Capture Picker - 一个系统选择器 UI 控件，用于在屏幕上选择要捕获的项目
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.  [09] %C_CapturePicker% Capture Picker - 一个系统选择器 UI 控件，用于在屏幕上选择要捕获的项目 ^| 依赖于 ：Client CBS
	echo.  [10] %C_CBSPreview% CBSPreview - 相机条形码扫描仪应用
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22621" echo.  [11] %C_ClientCBS% ClientCBS -  适用于 Windows 的用户体验（包括 InputApp、屏幕剪辑、Windows 11 开始菜单）^| 需要：Touch screen devices、Windows 应用商店
	echo.  [12] %C_CloudExperienceHost% CloudExperienceHost - 开箱即用体验（OOBE）^| 兼容性 ：开箱即用体验（OOBE）、推荐、Windows 应用商店
	echo.  [13] %C_ContentDeliveryManager% Content Delivery Manager - 自动安装赞助或推广的应用、建议和广告 ^| 依赖于：OOBE 和 Microsoft 帐户
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [14] %C_Cortana% Cortana - 个人助理、开始菜单、任务栏和设置搜索应用 ^| 依赖于 ：语音识别 ^| 兼容性 ：Shell Search
	echo.  [15] %C_CredDialogHost% Credential Dialog 主机 - Windows Hello 的身份验证（登录）shell 支持
	echo.  [16] %C_ECApp% ECApp - 用于眼球运动控制的 Modern UI 对话框应用 ^| 依赖于 ：Windows 混合现实
	echo.  [17] %C_Edge% Edge 经典浏览器
	echo.  [18] %C_EdgeDevToolsClient% Edge 开发者工具客户端 - 包含 Web 开发人员工具的 Edge 扩展 ^| 依赖于 ：Edge
	echo.  [19] %C_FileExplorer% 文件资源管理器 - 现代文件资源管理器应用
	echo.  [20] %C_FilePicker% 文件选取器 - Modern 文件选取器对话框
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [21] %C_InputApp% Input App - 输入应用 ^| 需要：Onscreen Keyboard TabletPC、Touch screen devices、Office
	echo.  [22] %C_LockApp% 锁屏应用 - 锁屏上的应用和消息的容器应用
	echo.  [23] %C_MapControl% 地图控件
	echo.  [24] %C_NarratorQuickStart% Narrator Quick Start - 讲述人快速入门指南 ^| 依赖于 ：SpeechRecognition
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.  [25] %C_NcsiUwpApp% NcsiUwpApp - 网络连接状态指示器（NCSI）
	echo.  [26] %C_OOBENetworkCaptivePortal% OOBE Network Captive Portal - Windows 的 OOBE 阶段期间的强制网络门户支持 ^| 依赖于 ：CloudExperienceHost
	echo.  [27] %C_OOBENetworkConnectionFlow% OOBE Network Captive Portal - Windows 的 OOBE 阶段期间的强制网络门户支持 ^| 依赖于 ：CloudExperienceHost
	echo.  [28] %C_ParentalControls% 家长控制 - 用于家长控制的应用
	echo.  [29] %C_PeopleExperienceHost% People Experience 主机 - 人脉栏（People Hub）
	echo.  [30] %C_PinningConfirmationDialog% 固定确认对话框
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" echo.  [31] %C_PPIProjection% PPI Projection - 将屏幕投影到无线显示器的应用（连接应用）
	echo.  [32] %C_PrintDialog% 打印对话框 - 现代打印对话框 ^| 依赖于：打印
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" echo.  [33] %C_QuickAssist% 快速助手应用 - 现代远程协助应用
	echo.  [34] %C_RetailDemoContent% 零售演示内容
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" echo.  [35] %C_SearchApp% “搜索”应用 - 开始菜单、任务栏和设置搜索应用 ^| 依赖于 ：WebView2SDK
	if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [36] %C_SecureAssessmentBrowser% Secure Assessment Browser - 用于考试的特殊 Windows 模式（Take Test 应用）
	if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" if "%ImageBuild%" geq "19041" echo.  [36] %C_SecureAssessmentBrowser% Secure Assessment Browser - 用于考试的特殊 Windows 模式（Take Test 应用） ^| 依赖于 ：WebView2SDK
	echo.  [37] %C_SettingSync% 设置同步 - 在 Windows 电脑和设备之间同步设置
	echo.  [38] %C_ShellExperienceHost% ShellExperienceHost - Shell 体验主机 ^| 需要：开始菜单、任务栏日历、时钟、网络浮出控件
	echo.  [39] %C_SkypeORTC% Skype ORTC
	echo.  [40] %C_SmartScreen% Smart Screen - 适用于现代应用的 Windows Defender SmartScreen 功能
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" echo.  [41] %C_StartMenuExperienceHost% StartMenuExperienceHost - 开始菜单 ^| 依赖于 ：ShellExperienceHost
	rem if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" echo.  [42] %C_UndockedDevKit% UndockedDevKit - Shell 服务 ^| 需要：设置-^>系统-^>系统信息页面、OOBE
	echo.  [43] %C_WebcamExperience% Webcam 体验
	if "%ImageBuild%" geq "19041" echo.  [44] %C_WebView2SDK% WebView2 Runtime
	echo.  [45] %C_Win32WebViewHost% Win32 WebView 主机 - 桌面应用 Web 查看器
	echo.  [46] %C_WindowsDefender% Windows Defender 应用
	echo.  [47] %C_WindowsMixedReality% Windows 混合现实
	echo.  [48] %C_WindowsReaderPDF% Windows 阅读器（PDF）^| 依赖于 ：Edge
	echo   [49] %C_WindowsStoreCore% Windows 应用商店后台客户端
	echo   [50] %C_XboxCore% Xbox 主机小帮手后台客户端
	echo.  [51] %C_XboxGameCallableUI% Xbox Game Callable UI - Xbox Live
	echo.  [52] %C_XGpuEjectDialog% XGpu Eject Dialog - 用于安全移除外部 GPU 的现代对话应用
	echo.
	echo.  [A]    所有多媒体组件
	echo.  [X]    返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "01" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AccountsControl%" equ "+" ( set "C_AccountsControl=-" ) else ( set "C_AccountsControl=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_AddSuggestedFoldersToLibraryDialog%" equ "+" ( set "C_AddSuggestedFoldersToLibraryDialog=-" ) else ( set "C_AddSuggestedFoldersToLibraryDialog=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_AppResolverUX%" equ "+" ( set "C_AppResolverUX=-" ) else ( set "C_AppResolverUX=+" ) )
	if "!MenuChoice!" equ "05" if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)
	if "!MenuChoice!" equ "06" ( if "%C_AsyncTextService%" equ "+" ( set "C_AsyncTextService=-" ) else ( set "C_AsyncTextService=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "08" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" ( if "%C_CallingShellApp%" equ "+" ( set "C_CallingShellApp=-" ) else ( set "C_CallingShellApp=+" ) )
	if "!MenuChoice!" equ "09" (
		if "%C_CapturePicker%" equ "+" ( 
			set "C_CapturePicker=-"
		) else ( 
			set "C_CloudExperienceHost=+"
			set "C_CapturePicker=+"
		)
	)
	if "!MenuChoice!" equ "10" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "11" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" ( if "%C_ClientCBS%" equ "+" ( set "C_ClientCBS=-" ) else ( set "C_ClientCBS=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_CloudExperienceHost%" equ "+" ( 
			set "C_CloudExperienceHost=-"
			set "C_CapturePicker=-"
			set "C_FirstLogonAnimation=-"
			set "C_OOBENetworkCaptivePortal=-"
			set "C_OOBENetworkConnectionFlow=-"
		) else ( 
			set "C_CloudExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "13" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "14" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "15" ( if "%C_CredDialogHost%" equ "+" ( set "C_CredDialogHost=-" ) else ( set "C_CredDialogHost=+" ) )
	if "!MenuChoice!" equ "16" ( 
		if "%C_ECApp%" equ "+" ( 
			set "C_ECApp=-" 
		) else ( 
			set "C_ECApp=+" 
			set "C_WindowsMixedReality=+"
		) 
	)
	if "!MenuChoice!" equ "17" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "18" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "19" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_FilePicker%" equ "+" ( set "C_FilePicker=-" ) else ( set "C_FilePicker=+" ) )
	if "!MenuChoice!" equ "21" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%C_InputApp%" equ "+" ( set "C_InputApp=-" ) else ( set "C_InputApp=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "23" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "24" (
		if "%C_NarratorQuickStart%" equ "+" ( 
			set "C_NarratorQuickStart=-"
		) else (
			set "C_NarratorQuickStart=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "25" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" ( if "%C_NcsiUwpApp%" equ "+" ( set "C_NcsiUwpApp=-" ) else ( set "C_NcsiUwpApp=+" ) )
	if "!MenuChoice!" equ "26" (
		if "%C_OOBENetworkCaptivePortal%" equ "+" ( 
			set "C_OOBENetworkCaptivePortal=-"
		) else ( 
			set "C_CloudExperienceHost=+"
			set "C_OOBENetworkCaptivePortal=+"
		)
	)
	if "!MenuChoice!" equ "27" (
		if "%C_OOBENetworkConnectionFlow%" equ "+" ( 
			set "C_OOBENetworkConnectionFlow=-"
		) else ( 
			set "C_CloudExperienceHost=+"
			set "C_OOBENetworkConnectionFlow=+"
		)
	)
	if "!MenuChoice!" equ "28" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "29" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "30" ( if "%C_PinningConfirmationDialog%" equ "+" ( set "C_PinningConfirmationDialog=-" ) else ( set "C_PinningConfirmationDialog=+" ) )
	if "!MenuChoice!" equ "31" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_PrintDialog%" equ "+" ( set "C_PrintDialog=-" ) else ( set "C_PrintDialog=+" ) )
	if "!MenuChoice!" equ "33" ( if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "35" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" (
		if "%C_SearchApp%" equ "+" ( 
			set "C_SearchApp=-" 
		) else ( 
			set "C_SearchApp=+" 
			set "C_WebView2SDK=+"
		)
	)
	if "!MenuChoice!" equ "36" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" ( 
		if "%C_SecureAssessmentBrowser%" equ "+" ( 
			set "C_SecureAssessmentBrowser=-" 
		) else ( 
			set "C_SecureAssessmentBrowser=+" 
			if "%ImageBuild%" geq "19041" set "C_WebView2SDK=+"
		)
	)
	if "!MenuChoice!" equ "37" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "38" (
		if "%C_ShellExperienceHost%" equ "+" ( 
			set "C_ShellExperienceHost=-"
			if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_StartMenuExperienceHost=-"
		) else ( 
			set "C_ShellExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "39" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "40" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "41" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" (
		if "%C_StartMenuExperienceHost%" equ "+" ( 
			set "C_StartMenuExperienceHost=-"
		) else ( 
			set "C_ShellExperienceHost=+"
			set "C_StartMenuExperienceHost=+"
		)
	)
	rem if "!MenuChoice!" equ "42" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" ( if "%C_UndockedDevKit%" equ "+" ( set "C_UndockedDevKit=-" ) else ( set "C_UndockedDevKit=+" ) )
	if "!MenuChoice!" equ "43" ( if "%C_WebcamExperience%" equ "+" ( set "C_WebcamExperience=-" ) else ( set "C_WebcamExperience=+" ) )
	if "!MenuChoice!" equ "44" (
		if "%C_WebView2SDK%" equ "+" ( 
			set "C_SearchApp=-"
			set "C_SecureAssessmentBrowser=-"
			set "C_WebView2SDK=-"
		) else ( 
			set "C_WebView2SDK=+"
		)
	)
	if "!MenuChoice!" equ "45" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "46" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "47" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			if "%SelectedSourceOS%" equ "w10" set "C_3DViewer=-"
			set "C_ECApp=-"
			if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "48" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "49" (
		if "%C_WindowsStoreCore%" equ "+" (
			if "%SelectedSourceOS%" equ "w10" set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStore=-"
			set "C_WindowsStoreCore=-"
		) else (
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "50" (
		if "%C_XboxCore%" equ "+" (
			if "%ImageBuild%" geq "22000" set "C_GamingApp=-"
			if "%ImageBuild%" leq "19045" set "C_XboxApp=-"
			set "C_XboxCore=-"
			set "C_XboxGameOverlay=-"
			set "C_XboxGamingOverlay=-"
			set "C_XboxIdentityProvider=-"
			set "C_XboxSpeechToTextOverlay=-"
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxCore=+"
		)
	)
	if "!MenuChoice!" equ "51" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "52" ( if "%C_XGpuEjectDialog%" equ "+" ( set "C_XGpuEjectDialog=-" ) else ( set "C_XGpuEjectDialog=+" ) )
	if /i "!MenuChoice!" equ "A" (
		if "%SelectedSourceOS%" equ "w10" set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AccountsControl=-"
		set "C_AddSuggestedFoldersToLibraryDialog=-"
		set "C_AppResolverUX=-"
		if "%ImageFlag%" neq "Core" if "%ImageFlag%" neq "CoreN" if "%ImageFlag%" neq "CoreSingleLanguage" set "C_AssignedAccessLockApp=-"
		set "C_AsyncTextService=-"
		set "C_BioEnrollment=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_CallingShellApp=-"
		set "C_CapturePicker=-"
		set "C_CBSPreview=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_ClientCBS=-"
		set "C_CloudExperienceHost=-"
		set "C_ContentDeliveryManager=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_Cortana=-"
		set "C_CredDialogHost=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_FilePicker=-"
		set "C_FirstLogonAnimation=-"
		if "%ImageBuild%" geq "22000" set "C_GamingApp=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_InputApp=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%SelectedSourceOS%" equ "w10" if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_NcsiUwpApp=-"
		set "C_OOBENetworkCaptivePortal=-"
		set "C_OOBENetworkConnectionFlow=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_PinningConfirmationDialog=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" set "C_PPIProjection=-"
		set "C_PrintDialog=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22000" set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22000" set "C_SearchApp=-"
		if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		if "%SelectedSourceOS%" equ "w10" set "C_ServicesStoreEngagement=-"
		set "C_SettingSync=-"
		set "C_ShellExperienceHost=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_SolitaireCollection=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "22631" set "C_StickyNotes=-"
		if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "22631" set "C_StartMenuExperienceHost=-"
		set "C_StorePurchaseApp=-"
		rem if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "22631" set "C_UndockedDevKit=-"
		set "C_WebcamExperience=-"
		if "%ImageBuild%" geq "19041" set "C_WebView2SDK=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_WindowsStore=-"
		set "C_WindowsStoreCore=-"
		if "%ImageBuild%" leq "19045" set "C_XboxApp=-"
		set "C_XboxCore=-"
		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/v2004/v20H2/v21H1/v21H2/v22H2 客户端 Windows 应用菜单
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19045" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 应用菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_3DViewer% 3D 查看器 ^| 依赖于 ：Windows 混合现实
	echo.  [02] %C_AdvertisingXaml% Advertising Xaml
	echo.  [03] %C_Alarms% 闹钟和时钟
	echo.  [04] %C_CalculatorApp% 计算器应用
	echo.  [05] %C_Camera% 相机
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" echo.  [06] %C_Cortana% Cortana ^| 依赖于 ：语音识别
	echo.  [07] %C_DesktopAppInstaller% 桌面应用安装程序
	echo.  [08] %C_FeedbackHub% 反馈中心
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [09] %C_ZuneVideo% 电影和电视
	echo.  [10] %C_GetHelp% 获取帮助
	echo.  [11] %C_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [12] %C_ZuneMusic% Groove 音乐
	echo.  [13] %C_HEIFImageExtension% 高效图像文件（HEIF）编解码器插件
	echo.  [14] %C_Maps% 地图 ^| 依赖于 ：地图控件
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [15] %C_Messaging% 消息
	echo.  [16] %C_Wallet% Microsoft Pay ^| 依赖于 ：电子钱包服务
	if "%ImageArchitecture%" equ "x64" echo.  [17] %C_MixedRealityPortal% 混合现实门户 ^| 依赖于 ：Windows 混合现实
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" echo.  [18] %C_ZuneVideo% 电影和电视应用
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [19] %C_OneConnect% 移动套餐
	echo.  [20] %C_OfficeHub% 我的 Office
	echo.  [21] %C_OfficeOneNote% OneNote
	echo.  [22] %C_Paint3D% 画图 3D
	echo.  [23] %C_People% 人脉 ^| 依赖于 ：人脉栏
	echo.  [24] %C_YourPhone% 手机连接
	echo.  [25] %C_Photos% 照片
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [26] %C_Print3D% Print 3D
	echo.  [27] %C_ScreenSketch% 屏幕和草图
	echo.  [28] %C_ServicesStoreEngagement% Services Store Engagement ^| 依赖于 ：Windows 应用商店应用
	echo.  [29] %C_SkypeApp% Skype
	if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" echo.  [30] %C_SolitaireCollection% Solitaire Collection ^| 依赖于 ：Advertising Xaml、Services Store Engagement、Xbox Live
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" echo.  [30] %C_SolitaireCollection% Solitaire Collection ^| 依赖于 ：Xbox Live
	echo.  [31] %C_StickyNotes% 便笺 ^| 依赖于 ：Windows 应用商店应用
	echo.  [32] %C_StorePurchaseApp% 应用商店体验主机 ^| 依赖于 ：Windows 应用商店应用
	echo.  [33] %C_Getstarted% 使用技巧 - Windows 提示和教程应用
	echo.  [34] %C_SoundRecorder% 录音机
	echo.  [35] %C_BingWeather% 天气 ^| 依赖于 ：Advertising Xaml
	echo.  [36] %C_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [37] %C_WebpImageExtension% WebP 图像编解码器插件
	echo.  [38] %C_CommunicationsApps% Windows 邮件应用 ^| 依赖于 ：Advertising Xaml、Windows 邮件
	echo.  [39] %C_WindowsStore% Windows 应用商店应用 ^| 依赖于 ：Windows 应用商店后台客户端、Xbox Identity Provider
	echo.  [40] %C_XboxApp% Xbox 主机小帮手 ^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [41] %C_XboxGameOverlay% Xbox Game Bar Plugin ^| 依赖于 ：Xbox 主机小帮手
	echo.  [42] %C_XboxGamingOverlay% Xbox Game Bar ^| 依赖于 ：Xbox 主机小帮手
	echo.  [43] %C_XboxIdentityProvider% Xbox Identity Provider ^| 依赖于 ：Xbox 主机小帮手
	echo.  [44] %C_XboxSpeechToTextOverlay% Xbox Game Speech Window ^| 依赖于 ：Xbox 主机小帮手
	echo.  [45] %C_XboxTCUI% Xbox UI ^| 依赖于 ：Xbox 主机小帮手
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.
	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_CalculatorApp%" equ "+" ( set "C_CalculatorApp=-" ) else ( set "C_CalculatorApp=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "06" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" (
		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 "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "14" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "15" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%C_Messaging%" equ "+" ( set "C_Messaging=-" ) else ( set "C_Messaging=+" ) )
	if "!MenuChoice!" equ "16" ( 
		if "%C_Wallet%" equ "+" ( 
			set "C_Wallet=-"
		) else (
			set "C_Wallet=+"
			set "C_WalletService=+"
		)
	)
	if "!MenuChoice!" equ "17" if "%ImageArchitecture%" equ "x64" (
		if "%C_MixedRealityPortal%" equ "+" (
			set "C_MixedRealityPortal=-"
		) else (
			set "C_MixedRealityPortal=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "18" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "19" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%C_OneConnect%" equ "+" ( set "C_OneConnect=-" ) else ( set "C_OneConnect=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "23" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "24" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "25" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "26" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" ( if "%C_Print3D%" equ "+" ( set "C_Print3D=-" ) else ( set "C_Print3D=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "28" (
		if "%C_ServicesStoreEngagement%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" set "C_StickyNotes=-"
		) else ( 
			set "C_ServicesStoreEngagement=+"
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "29" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "30" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			if "%ImageBuild%" equ "17763" (
				set "C_AdvertisingXaml=+"
				set "C_ServicesStoreEngagement=+"
				set "C_WindowsStore=+"
				set "C_WindowsStoreCore=+"
			)
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "31" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_ServicesStoreEngagement=+"
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "32" (
		if "%C_StorePurchaseApp%" equ "+" (
			set "C_StorePurchaseApp=-"
		) else (
			set "C_StorePurchaseApp=+"
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "33" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "35" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "36" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "37" ( if "%C_WebpImageExtension%" equ "+" ( set "C_WebpImageExtension=-" ) else ( set "C_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "38" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
			set "C_WindowsMail=+"
		)
	)
	if "!MenuChoice!" equ "39" (
		if "%C_WindowsStore%" equ "+" ( 
			set "C_ServicesStoreEngagement=-"
			if "%ImageBuild%" equ "17763" set "C_SolitaireCollection=-"
			if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "40" (
		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_XboxCore=+"
		)
	)
	if "!MenuChoice!" equ "41" (
		if "%C_XboxGameOverlay%" equ "+" ( 
			set "C_XboxGameOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxCore=+"
			set "C_XboxGameOverlay=+"
		)
	)
	if "!MenuChoice!" equ "42" (
		if "%C_XboxGamingOverlay%" equ "+" ( 
			set "C_XboxGamingOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxCore=+"
			set "C_XboxGamingOverlay=+"
		)
	)
	if "!MenuChoice!" equ "43" (
		if "%C_XboxIdentityProvider%" equ "+" ( 
			set "C_XboxIdentityProvider=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxCore=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "44" (
		if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
			set "C_XboxSpeechToTextOverlay=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxCore=+"
			set "C_XboxSpeechToTextOverlay=+"
		)
	)
	if "!MenuChoice!" equ "45" (
		if "%C_XboxTCUI%" equ "+" ( 
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxApp=+"
			set "C_XboxCore=+"
			set "C_XboxTCUI=+"
		)
	)
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_CalculatorApp=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19045" set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_Messaging=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" set "C_OneConnect=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" 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_WindowsStore=-"
		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

	goto :RemoveWindowsAppsMenu
)

:: 移除 Windows 11 v21H2/v22H2 客户端 Windows 应用菜单
if "%SelectedSourceOS%" equ "w11" if "%ImageBuild%" geq "22000" if "%ImageBuild%" leq "22631" (
	cls
	echo.===============================================================================
	echo.                     MSMG 工具箱 - 移除 Windows 应用菜单
	echo.===============================================================================
	echo.
	echo.  [01] %C_Alarms% 闹钟和时钟
	echo.  [02] %C_DesktopAppInstaller% 应用安装程序
	echo.  [03] %C_CalculatorApp% 计算器应用
	echo.  [04] %C_Camera% 相机
	if "%ImageBuild%" geq "22621" echo.  [05] %C_Clipchamp% Clipchamp 视频编辑器
	echo.  [06] %C_Cortana% Cortana ^| 依赖于 ：语音识别
	if "%ImageBuild%" geq "22621" echo.  [07] %C_Family% 家庭
	echo.  [08] %C_FeedbackHub% 反馈中心
	echo.  [09] %C_ZuneVideo% 电影和电视
	echo.  [10] %C_GamingApp% Gaming 应用（Xbox 应用）^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [11] %C_GetHelp% 获取帮助
	echo.  [12] %C_VP9VideoExtensions% Google 的 VP9 WebM 视频编解码器插件
	echo.  [13] %C_HEIFImageExtension% 高效图像文件（HEIF）编解码器插件
	if "%ImageBuild%" geq "22621" echo.  [14] %C_HEVCVideoExtension% 高效视频编解码器（HEVC）插件
	echo.  [15] %C_Maps% Maps ^| 依赖于 ：地图控件
	echo.  [16] %C_ZuneMusic% 媒体播放器
	echo.  [17] %C_OfficeHub% 我的 Office
	echo.  [18] %C_BingNews% 资讯
	echo.  [19] %C_NotepadApp% 记事本应用
	echo.  [20] %C_Paint% 画图
	echo.  [21] %C_People% 人脉 ^| 依赖于 ：人脉栏
	echo.  [22] %C_YourPhone% 手机连接
	echo.  [23] %C_Photos% 照片
	echo.  [24] %C_PowerAutomateDesktop% Power Automate Desktop
	if "%ImageBuild%" geq "22621" echo.  [25] %C_QuickAssist% 快速助手
	if "%ImageBuild%" geq "22621" echo.  [26] %C_RawImageExtension% Raw 图像插件
	echo.  [27] %C_ScreenSketch% 屏幕和草图
	echo.  [28] %C_SolitaireCollection% Solitaire Collection ^| 依赖于 ：Xbox Live
	echo.  [29] %C_StickyNotes% 便笺 ^| 依赖于 ：Windows 应用商店应用
	echo.  [30] %C_StorePurchaseApp% 应用商店体验主机 ^| 依赖于 ：Windows 应用商店应用
	echo.  [31] %C_Terminal% 终端
	echo.  [32] %C_Getstarted% 使用技巧 - Windows 提示和教程应用
	echo.  [33] %C_Todos% Todos
	echo.  [34] %C_SoundRecorder% 录音机
	echo.  [35] %C_BingWeather% 天气
	echo.  [36] %C_WebMediaExtensions% Web 媒体编解码器插件
	echo.  [37] %C_WebpImageExtension% WebP 图像编解码器插件
	echo.  [38] %C_ClientWebExperience% Windows Web Experience Pack - 资讯和兴趣小组件应用 ^| 依赖于 ：Edge WebView
	echo.  [39] %C_CommunicationsApps% Windows 邮件应用 ^| 依赖于 ：Windows 邮件
	echo.  [40] %C_WindowsStore% Windows 应用商店应用 ^| 依赖于 ：Windows 应用商店后台客户端、Xbox Identity Provider
	echo.  [41] %C_XboxGameOverlay% Xbox Game Bar Plugin ^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [42] %C_XboxGamingOverlay% Xbox Game Bar ^|依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [43] %C_XboxIdentityProvider% Xbox Identity Provider ^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [44] %C_XboxSpeechToTextOverlay% Xbox Game Speech Window ^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.  [45] %C_XboxTCUI% Xbox UI ^| 依赖于 ：Xbox 主机小帮手后台客户端
	echo.
	echo.  [A]    所有 Windows 应用
	echo.  [X]    返回
	echo.
	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_CalculatorApp%" equ "+" ( set "C_CalculatorApp=-" ) else ( set "C_CalculatorApp=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "05" if "%ImageBuild%" geq "22621" ( if "%C_Clipchamp%" equ "+" ( set "C_Clipchamp=-" ) else ( set "C_Clipchamp=+" ) )
	if "!MenuChoice!" equ "06" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else (
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "07" if "%ImageBuild%" geq "22621" ( if "%C_Family%" equ "+" ( set "C_Family=-" ) else ( set "C_Family=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "10" (
		if "%C_GamingApp%" equ "+" ( 
			set "C_GamingApp=-"
		) else (
			set "C_GamingApp=+"
			set "C_XboxCore=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "14" if "%ImageBuild%" geq "22621" (
		if "%C_HEVCVideoExtension%" equ "+" ( 
			set "C_HEVCVideoExtension=-"
		) else (
			set "C_HEVCVideoExtension=+"
		)
	)
	if "!MenuChoice!" equ "15" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "16" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_BingNews%" equ "+" ( set "C_BingNews=-" ) else ( set "C_BingNews=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_NotepadApp%" equ "+" ( set "C_NotepadApp=-" ) else ( set "C_NotepadApp=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "22" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_PowerAutomateDesktop%" equ "+" ( set "C_PowerAutomateDesktop=-" ) else ( set "C_PowerAutomateDesktop=+" ) )
	if "!MenuChoice!" equ "25" if "%ImageBuild%" geq "22621" (
		if "%C_QuickAssist%" equ "+" ( 
			set "C_QuickAssist=-"
		) else (
			set "C_QuickAssist=+"
		)
	)
	if "!MenuChoice!" equ "26" if "%ImageBuild%" geq "22621" (
		if "%C_RawImageExtension%" equ "+" ( 
			set "C_RawImageExtension=-"
		) else (
			set "C_RawImageExtension=+"
		)
	)
	if "!MenuChoice!" equ "27" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "28" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "29" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "30" (
		if "%C_StorePurchaseApp%" equ "+" (
			set "C_StorePurchaseApp=-"
		) else (
			set "C_StorePurchaseApp=+"
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
		)
	)
	if "!MenuChoice!" equ "31" ( if "%C_Terminal%" equ "+" ( set "C_Terminal=-" ) else ( set "C_Terminal=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "33" ( if "%C_Todos%" equ "+" ( set "C_Todos=-" ) else ( set "C_Todos=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "35" ( if "%C_BingWeather%" equ "+" ( set "C_BingWeather=-" ) else ( set "C_BingWeather=+"	) )
	if "!MenuChoice!" equ "36" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "37" ( if "%C_WebpImageExtension%" equ "+" ( set "C_WebpImageExtension=-" ) else ( set "C_WebpImageExtension=+" ) )
	if "!MenuChoice!" equ "38" (
		if "%C_ClientWebExperience%" equ "+" (
			set "C_ClientWebExperience=-"
		) else (
			set "C_ClientWebExperience=+"
			set "C_EdgeWebView=+"
		)
	)
	if "!MenuChoice!" equ "39" (
		if "%C_CommunicationsApps%" equ "+" (
			set "C_CommunicationsApps=-"
		) else (
			set "C_CommunicationsApps=+"
			set "C_WindowsMail=+"
		)
	)
	if "!MenuChoice!" equ "40" (
		if "%C_WindowsStore%" equ "+" ( 
			if "%ImageBuild%" neq "17763" set "C_StickyNotes=-"
			set "C_StorePurchaseApp=-"
			set "C_WindowsStore=-"
		) else (
			set "C_WindowsStore=+"
			set "C_WindowsStoreCore=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "41" (
		if "%C_XboxGameOverlay%" equ "+" ( 
			set "C_XboxGameOverlay=-"
		) else (
			set "C_XboxCore=+"
			set "C_XboxGameOverlay=+"
		)
	)
	if "!MenuChoice!" equ "42" (
		if "%C_XboxGamingOverlay%" equ "+" ( 
			set "C_XboxGamingOverlay=-"
		) else (
			set "C_XboxCore=+"
			set "C_XboxGamingOverlay=+"
		)
	)
	if "!MenuChoice!" equ "43" (
		if "%C_XboxIdentityProvider%" equ "+" ( 
			set "C_XboxIdentityProvider=-"
		) else (
			set "C_XboxCore=+"
			set "C_XboxIdentityProvider=+"
		)
	)
	if "!MenuChoice!" equ "44" (
		if "%C_XboxSpeechToTextOverlay%" equ "+" ( 
			set "C_XboxSpeechToTextOverlay=-"
		) else (
			set "C_XboxCore=+"
			set "C_XboxSpeechToTextOverlay=+"
		)
	)
	if "!MenuChoice!" equ "45" (
		if "%C_XboxTCUI%" equ "+" ( 
			set "C_XboxTCUI=-"
		) else (
			set "C_XboxCore=+"
			set "C_XboxTCUI=+"
		)
	)
	if /i "!MenuChoice!" equ "A" (
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_BingNews=-"
		set "C_CalculatorApp=-"
		set "C_Camera=-"
		if "%ImageBuild%" geq "22621" set "C_Clipchamp=-"
		set "C_CommunicationsApps=-"
		set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		if "%ImageBuild%" geq "22621" set "C_Family=-"
		set "C_FeedbackHub=-"
		set "C_GamingApp=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		if "%ImageBuild%" geq "22621" set "C_HEVCVideoExtension=-"
		set "C_Maps=-"
		set "C_OfficeHub=-"
		set "C_NotepadApp=-"
		set "C_Paint=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_PowerAutomateDesktop=-"
		if "%ImageBuild%" geq "22621" set "C_QuickAssist=-"
		if "%ImageBuild%" geq "22621" set "C_RawImageExtension=-"
		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_WindowsStore=-"
		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

	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_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,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_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2SDK,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,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!" equ "-" (
		for /f "tokens=2 delims=_" %%j in ("%%i") do (
			set "Components=!Components!%%j;"
		)
	)
)

if "%Components%" equ "" if "%C_ManualSetup%" 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.-------------------------------------------------------------------------------

if "%Components%" neq "" (
	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 组件
			"%ToolKitHelper%" "%InstallMount%\%%i" "%Components%"
		)
	)
)

if "%C_ManualSetup%" equ "-" (
	echo.
	"%ToolKitHelper%" "%InstallMount%\%DefaultIndexNo%" "ManualSetup"
	echo.
)

echo.-------------------------------------------------------------------------------
echo.####移除 Windows 组件功能已完成################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set Components=

endlocal

:: 重置组件状态标识
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_EdgeWebView,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_LockScreenBackground,C_ScreenSavers,C_SnippingTool,C_SoundThemes,C_SpeechRecognition,C_Wallpapers,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WindowsThemes,C_WindowsTIFFIFilter,C_WinSAT,C_OfflineFiles,C_OpenSSH,C_RemoteDesktopClient,C_RemoteDifferentialCompression,C_SimpleTCPIPServices,C_TelnetClient,C_TFTPClient,C_WalletService,C_WindowsMail,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_OneDrive,C_RemoteAssistance,C_RemoteDesktopServer,C_RemoteRegistry,C_WorkFoldersClient,C_AccessibilityTools,C_Calculator,C_DeviceLockdown,C_EaseOfAccessCursors,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_Magnifier,C_ManualSetup,C_Narrator,C_Notepad,C_OnScreenKeyboard,C_Paint,C_ProjFS,C_SecurityCenter,C_StepsRecorder,C_StorageSpaces,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_WindowsUpdate,C_Wordpad,C_AADBrokerPlugin,C_AccountsControl,C_AddSuggestedFoldersToLibraryDialog,C_AppResolverUX,C_AssignedAccessLockApp,C_AsyncTextService,C_BioEnrollment,C_CallingShellApp,C_CapturePicker,C_CBSPreview,C_ClientCBS,C_CloudExperienceHost,C_ContentDeliveryManager,C_Cortana,C_CredDialogHost,C_ECApp,C_Edge,C_EdgeDevToolsClient,C_FileExplorer,C_FilePicker,C_InputApp,C_LockApp,C_MapControl,C_NarratorQuickStart,C_NcsiUwpApp,C_OOBENetworkCaptivePortal,C_OOBENetworkConnectionFlow,C_ParentalControls,C_PeopleExperienceHost,C_PinningConfirmationDialog,C_PrintDialog,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SearchApp,C_SecureAssessmentBrowser,C_SettingSync,C_ShellExperienceHost,C_SkypeORTC,C_SmartScreen,C_StartMenuExperienceHost,C_UndockedDevKit,C_WebcamExperience,C_WebView2SDK,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_WindowsStoreCore,C_XboxCore,C_XboxGameCallableUI,C_XGpuEjectDialog,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingNews,C_BingWeather,C_CalculatorApp,C_Camera,C_ClientWebExperience,C_Clipchamp,C_CommunicationsApps,C_DesktopAppInstaller,C_Family,C_FeedbackHub,C_GamingApp,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_HEVCVideoExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_NETNativeFramework16,C_NETNativeFramework17,C_NETNativeFramework22,C_NETNativeRuntime16,C_NETNativeRuntime17,C_NETNativeRuntime22,C_NotepadApp,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_People,C_Photos,C_PowerAutomateDesktop,C_Print3D,C_RawImageExtension,C_ScreenSketch,C_ServicesStoreEngagement,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_StorePurchaseApp,C_Terminal,C_Todos,C_UIXaml20,C_UIXaml24,C_UIXaml27,C_VCLibs140UWP,C_VCLibs140UWPDesktop,C_VP9VideoExtensions,C_Wallet,C_WebMediaExtensions,C_WebpImageExtension,C_WindowsStore,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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.
	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 "22631" (
		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 "22631" (
	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.-------------------------------------------------------------------------------

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" (
			echo.
			for /f %%z IN ('"type %RemovePkgsList%" 2^>nul') do (
				call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z
			)
		)

		if "%RemovalMethod%" equ "ToolKitHelper" (
			echo.
			"%ToolKitHelper%" "%InstallMount%\%%i" "%RemovePkgsList%"
			echo.
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####使用程序包列表移除 Windows 组件已完成######################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.-------------------------------------------------------------------------------
echo.
%DISM% /Image:"%InstallMount%\%DefaultIndexNo%" /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%\%DefaultIndexNo%" /Get-DefaultAppAssociations | findstr "<" >> "%DefaultMetroAppsAssociationXML%"
	echo.
	echo.-------------------------------------------------------------------------------
	echo.####导出默认内置应用关联 XML 文件已完成########################################
	echo.-------------------------------------------------------------------------------
	goto :Stop
)
if not errorlevel 1 (
	echo.默认内置应用关联是空的……
	echo.
	echo.-------------------------------------------------------------------------------
	echo.####导出默认内置应用关联 XML 文件已停止########################################
	echo.-------------------------------------------------------------------------------
	goto :Stop
)

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 从 XML 文件合并自定义开始菜单布局模组
::-------------------------------------------------------------------------------------------
:ImportStartMenuLayout

setlocal

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.正在复制自定义开始菜单布局……
		echo.
		copy /y "%XMLs%\DefaultLayouts.xml" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
		copy /y "%XMLs%\LayoutModification.xml" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
		if "%SelectedSourceOS%" == "w11" copy /y "%XMLs%\LayoutModification.json" "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####从 XML 文件合并自定义开始菜单布局已完成####################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set CustomRegistry=

endlocal

:: 返回到自定义定制菜单
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 应用调整菜单模组
::-------------------------------------------------------------------------------------------
:ApplyTweaksMenu

setlocal

set Tweak=

cls
echo.===============================================================================
echo.                             MSMG 工具箱 - 应用调整菜单
echo.===============================================================================
echo.

if "%SelectedSourceOS%" equ "w81" (
	echo.  [ 1]   禁止通过 Windows 更新自动更新驱动
	echo.  [ 2]   禁用自动下载并安装第三方应用
	echo.  [ 3]   禁用 Windows Defender
	echo.  [ 4]   禁用 Windows 防火墙
	echo.  [ 5]   禁用 Windows SmartScreen
	echo.  [ 6]   禁用自动执行 Windows 升级
	echo.  [ 7]   禁用 Windows 更新
	echo.  [ 8]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [ 9]   启用 Windows 照片查看器
	echo.  [10]   启用 Fraunhofer MP3 Professional Codec
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   所有调整
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "4" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "5" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "6" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "7" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "8" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "9" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "10" set "Tweak=EnableFMP3ProCodec"
	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if "%SelectedSourceOS%" equ "w10" (
	echo.  [ 1]   禁止通过 Windows 更新自动更新驱动
	echo.  [ 2]   禁用自动下载并安装第三方应用
	echo.  [ 3]   禁用自动执行 Windows 升级
	echo.  [ 4]   禁用 Cortana 应用
	echo.  [ 5]   禁用下载文件夹自动按日期分组布局
	echo.  [ 6]   禁用 Microsoft 用于 Windows 更新保留的存储空间
	echo.  [ 7]   禁用 Windows Defender
	echo.  [ 8]   禁用 Windows 防火墙
	echo.  [ 9]   禁用 Windows SmartScreen
	echo.  [10]   禁用 Windows 更新
	echo.  [11]   使用完整 ResetBase 启用 DISM 映像清理
	echo.  [12]   启用 Fraunhofer MP3 Professional Codec
	echo.  [13]   启用 Windows 照片查看器
	echo.  [14]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [15]   隐藏任务栏 Cortana 图标
	echo.  [16]   隐藏任务栏立即开会图标
	echo.  [17]   隐藏任务栏资讯和兴趣
	echo   [18]   隐藏任务栏搜索栏
	echo.  [19]   隐藏任务栏任务视图图标
	echo.
	echo.  [A]   所有调整
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "4" set "Tweak=DisableCortanaApp"
	if "!MenuChoice!" equ "5" set "Tweak=DisableDownloadsLayout"
	if "!MenuChoice!" equ "6" set "Tweak=DisableReservedStorage"
	if "!MenuChoice!" equ "7" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "8" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "9" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "10" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "11" set "Tweak=EnableFullResetBase"
	if "!MenuChoice!" equ "12" set "Tweak=EnableFMP3ProCodec"
	if "!MenuChoice!" equ "13" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "14" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "15" set "Tweak=HideCortanaIcon"
	if "!MenuChoice!" equ "16" set "Tweak=HideMeetNowIcon"
	if "!MenuChoice!" equ "17" set "Tweak=HideNewsAndInterests"
	if "!MenuChoice!" equ "18" set "Tweak=HideSearchBar"
	if "!MenuChoice!" equ "19" set "Tweak=HideTaskViewIcon"
	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if "%SelectedSourceOS%" equ "w11" (
	echo.  [ 1]   禁止通过 Windows 更新自动更新驱动
	echo.  [ 2]   禁用自动下载并安装第三方应用
	echo.  [ 3]   Disable Automatic Download and Install of Microsoft Teams App
	echo.  [ 4]   禁用自动执行 Windows 升级
	echo.  [ 5]   禁用 Cortana 应用
	echo.  [ 6]   禁用下载文件夹自动按日期分组布局
	echo.  [ 7]   禁用 Microsoft 用于 Windows 更新保留的存储空间
	echo.  [ 8]   禁用 Windows 11 安装程序硬件检查
	echo.  [ 9]   禁用 Windows Defender
	echo.  [10]   禁用 Windows 防火墙
	echo.  [11]   禁用 Windows SmartScreen
	echo.  [12]   禁用 Windows 更新
	echo.  [13]   使用完整 ResetBase 启用 DISM 映像清理
	echo.  [14]   启用 Fraunhofer MP3 Professional Codec
	echo.  [15]   启用 Windows 经典上下文菜单
	echo.  [16]   启用 Windows 本地帐户
	echo.  [17]   启用 Windows 照片查看器
	echo.  [18]   强制让 .NET 程序使用最新的 .NET Framework
	echo.  [19]   隐藏任务栏聊天图标
	echo.  [20]   隐藏任务栏 Cortana 图标
	echo.  [21]   隐藏任务栏立即开会图标
	echo.  [22]   隐藏任务栏资讯和兴趣
	echo   [23]   隐藏任务栏搜索栏
	echo.  [24]   隐藏任务栏任务视图图标
	echo.  [25]   隐藏任务栏小组件图标
	echo.  [26]   设置任务栏对齐方式为左对齐
	echo.
	echo.  [A]   所有调整
	echo.  [X]   返回
	echo.
	echo.===============================================================================
	set /p MenuChoice=请输入你的选项 ：

	if "!MenuChoice!" equ "1" set "Tweak=DisableDriversUpdates"
	if "!MenuChoice!" equ "2" set "Tweak=Disable3RDPartyApps"
	if "!MenuChoice!" equ "3" set "Tweak=DisableTeamsApp"
	if "!MenuChoice!" equ "4" set "Tweak=DisableWindowsUpgrade"
	if "!MenuChoice!" equ "5" set "Tweak=DisableCortanaApp"
	if "!MenuChoice!" equ "6" set "Tweak=DisableDownloadsLayout"
	if "!MenuChoice!" equ "7" set "Tweak=DisableReservedStorage"
	if "!MenuChoice!" equ "8" set "Tweak=DisableW11InstHardwareCheck"
	if "!MenuChoice!" equ "9" set "Tweak=DisableWindowsDefender"
	if "!MenuChoice!" equ "10" set "Tweak=DisableWindowsFirewall"
	if "!MenuChoice!" equ "11" set "Tweak=DisableWindowsSmartScreen"
	if "!MenuChoice!" equ "12" set "Tweak=DisableWindowsUpdate"
	if "!MenuChoice!" equ "13" set "Tweak=EnableFullResetBase"
	if "!MenuChoice!" equ "14" set "Tweak=EnableFMP3ProCodec"
	if "!MenuChoice!" equ "15" set "Tweak=EnableClassicContextMenu"
	if "!MenuChoice!" equ "16" set "Tweak=EnableLocalAccount"
	if "!MenuChoice!" equ "17" set "Tweak=EnablePhotoViewer"
	if "!MenuChoice!" equ "18" set "Tweak=ForceLatestNetFramework"
	if "!MenuChoice!" equ "19" set "Tweak=HideChatIcon"
	if "!MenuChoice!" equ "20" set "Tweak=HideCortanaIcon"
	if "!MenuChoice!" equ "21" set "Tweak=HideMeetNowIcon"
	if "!MenuChoice!" equ "22" set "Tweak=HideNewsAndInterests"
	if "!MenuChoice!" equ "23" set "Tweak=HideSearchBar"
	if "!MenuChoice!" equ "24" set "Tweak=HideTaskViewIcon"
	if "!MenuChoice!" equ "25" set "Tweak=HideWidgetsIcon"
	if "!MenuChoice!" equ "26" set "Tweak=SetTaskbarAlignLeft"

	if /i "!MenuChoice!" equ "A" set "Tweak=AllTweaks"
	if /i "!MenuChoice!" equ "X" goto :CustomizeMenu
)

if /i "%Tweak%" equ "" goto :ApplyTweaksMenu

cls
echo.===============================================================================
echo.                           MSMG 工具箱 - 应用调整
echo.===============================================================================
echo.
:: Get updated Image Information
if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19045" (
	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 "DisableDownloadsLayout" echo.####正在应用禁用下载文件夹自动按日期分组布局调整###############################
if "%Tweak%" equ "DisableDriversUpdates" echo.####正在应用禁止通过 Windows 更新自动更新驱动调整##############################
if "%Tweak%" equ "DisableReservedStorage" echo.####正在应用禁用 Microsoft 用于进行 Windows 更新保留的存储空间#################
if "%Tweak%" equ "DisableTeamsApp" echo.####正在应用禁用自动下载并安装 Teams 应用调整##################################
if "%Tweak%" equ "DisableW11InstHardwareCheck" echo.####正在应用禁用 Windows 11 安装程序硬件检查###################################
if "%Tweak%" equ "DisableWindowsDefender" echo.####正在应用禁用 Windows Defender 调整#########################################
if "%Tweak%" equ "DisableWindowsFirewall" echo.####正在应用禁用 Windows 防火墙调整############################################
if "%Tweak%" equ "DisableWindowsSmartScreen" echo.####正在应用禁用 Windows SmartScreen 调整######################################
if "%Tweak%" equ "DisableWindowsUpdate" echo.####正在应用禁用 Windows 更新调整##############################################
if "%Tweak%" equ "DisableWindowsUpgrade" echo.####正在应用禁用自动升级 Windows 操作系统调整##################################
if "%Tweak%" equ "EnableClassicContextMenu" echo.####正在应用启用 Windows 经典上下文菜单########################################
if "%Tweak%" equ "EnableFMP3ProCodec" echo.####正在应用启用 Fraunhofer MP3 Professional Codec 调整########################
if "%Tweak%" equ "EnableFullResetBase" echo.####正在应用使用完整 ResetBase 启用 DISM 映像清理调整##########################
if "%Tweak%" equ "EnableLocalAccount" echo.####正在应用启用 Windows 本地帐户调整##########################################
if "%Tweak%" equ "EnablePhotoViewer" echo.####正在应用启用 Windows 照片查看器调整########################################
if "%Tweak%" equ "ForceLatestNetFramework" echo.####正在应用强制 .NET 程序使用最新的 .NET Framework 调整#######################
if "%Tweak%" equ "HideChatIcon" echo.####正在应用隐藏任务栏聊天图标调整#############################################
if "%Tweak%" equ "HideCortanaIcon" echo.####正在应用隐藏任务栏 Cortana 图标调整########################################
if "%Tweak%" equ "HideMeetNowIcon" echo.####正在应用隐藏任务栏立即开会图标调整#########################################
if "%Tweak%" equ "HideNewsAndInterests" echo.####正在应用隐藏任务栏资讯和兴趣调整###########################################
if "%Tweak%" equ "HideSearchBar" echo.####正在应用隐藏任务栏上的搜索栏调整###########################################
if "%Tweak%" equ "HideTaskViewIcon" echo.####正在应用隐藏任务栏任务视图图标调整#########################################
if "%Tweak%" equ "HideWidgetsIcon" echo.####正在应用隐藏任务栏小组件图标调整###########################################
if "%Tweak%" equ "SetTaskbarAlignLeft" echo.####正在应用设置任务栏对齐方式为左对齐调整#####################################
echo.-------------------------------------------------------------------------------

if "%Tweak%" equ "DisableW11InstHardwareCheck" (
	echo.
	if not %%i gtr 9 echo.===========================[Boot.wim，索引 ：2]============================
	echo.
	echo.正在安装映像注册表……
	echo.正在应用禁用 Windows 11 安装程序硬件检查调整……
	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.正在卸载映像注册表……
	Reg unload "HKLM\TK_BOOT_SYSTEM" >nul 2>&1
	if exist "%DVD%\sources\appraiserres.dll" move "%DVD%\sources\appraiserres.dll" "%DVD%\sources\appraiserres.dll.bak"
)

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 "DisableW11InstHardwareCheck" (
			Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		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 "DisableDownloadsLayout" (
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "GroupBy" /t REG_SZ /d "System.None" /f >nul 2>&1
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "PrimaryProperty" /t REG_SZ /d "System.Name" /f >nul 2>&1
			Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "SortByList" /t REG_SZ /d "prop:System.Name" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideChatIcon" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v "ChatIcon" /t REG_DWORD /d "3" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d "0" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideCortanaIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCortanaButton" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "HideMeetNowIcon" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		if "%Tweak%" equ "HideNewsAndInterests" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v "ShellFeedsTaskbarViewMode" /t REG_DWORD /d "2" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "HeadlinesOnboardingComplete" /t REG_DWORD /d "0" /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 2>&1
		if "%Tweak%" equ "HideSearchBar" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "HideWidgetsIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "DisableDriversUpdates" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
		)

		if "%Tweak%" equ "Disable3RDPartyApps" (
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul 2>&1

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d "{\"pinnedList\": [{}]}" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins_ProviderSet" /t REG_DWORD /d "0" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "DisableTeamsApp" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d "0" /f >nul 2>&1

		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_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 安全中心\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender 安全中心\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /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 安全中心\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
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\CI\Policy" /v "VerifiedAndReputablePolicyState" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\Microsoft-Antimalware-ShieldProvider" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\MsSecFlt" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\Sense" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdBoot" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdFilter" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /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 "DisableWindowsFirewall" (
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PublicProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PrivateProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "DisableFirewall" /t REG_SZ /d "%%windir%%\System32\netsh.exe advfirewall set allprofiles state off" /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 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			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 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" /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%" geq "17134" if "%ImageBuild%" leq "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ProductVersion" /t REG_SZ /d "Windows 10" /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 "19045" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /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 "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /f >nul 2>&1
			)
		)

		if "%Tweak%" equ "DisableWindowsUpdate" (
			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 "0" /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 "3" /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 2>&1
		if "%Tweak%" equ "ForceLatestNetFramework" Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul 2>&1
		if "%Tweak%" equ "EnableLocalAccount" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f >nul 2>&1

		if "%Tweak%" equ "EnablePhotoViewer" (
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
		)

		if "%Tweak%" equ "EnableClassicContextMenu" Reg add "HKLM\TK_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f >nul 2>&1

		if "%Tweak%" equ "EnableFMP3ProCodec" (
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul 2>&1

			if "%ImageArchitecture%" equ "x64" (
				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 2>&1
				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 2>&1
			)
		)

		if "%Tweak%" equ "EnableFullResetBase" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul 2>&1
		if "%Tweak%" equ "SetTaskbarAlignLeft" Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarAl" /t REG_DWORD /d "0" /f >nul 2>&1

		if "%Tweak%" equ "AllTweaks" (
			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_DEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" (
				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\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "GroupBy" /t REG_SZ /d "System.None" /f >nul 2>&1
				Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "PrimaryProperty" /t REG_SZ /d "System.Name" /f >nul 2>&1
				Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" /v "SortByList" /t REG_SZ /d "prop:System.Name" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v "ChatIcon" /t REG_DWORD /d "3" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCortanaButton" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w10" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "HideSCAMeetNow" /t REG_DWORD /d "1" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" /v "ShellFeedsTaskbarViewMode" /t REG_DWORD /d "2" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "HeadlinesOnboardingComplete" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontPromptForWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DontSearchWindowsUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "DriverUpdateWizardWuSearchEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d "1" /f >nul 2>&1


			if "%SelectedSourceOS%" neq "w7"  if "%SelectedSourceOS%" neq "w81" (
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OemPreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			if "%SelectedSourceOS%" equ "w11" (
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins" /t REG_SZ /d "{\"pinnedList\": [{}]}" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v "ConfigureStartPins_ProviderSet" /t REG_DWORD /d "0" /f >nul 2>&1
				Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v "ConfigureChatAutoInstall" /t REG_DWORD /d "0" /f >nul 2>&1
			)

			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_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 安全中心\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender 安全中心\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /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 安全中心\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
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\CI\Policy" /v "VerifiedAndReputablePolicyState" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\Microsoft-Antimalware-ShieldProvider" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\EventLog\System\WinDefend" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\MsSecFlt" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\Sense" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdBoot" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdFilter" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
			Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /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_SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PrivateProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\PublicProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" /v "EnableFirewall" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "DisableFirewall" /t REG_SZ /d "%%windir%%\System32\netsh.exe advfirewall set allprofiles state off" /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 2>&1
				Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul 2>&1
			)

			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 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" /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%" geq "17134" if "%ImageBuild%" leq "20348" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ProductVersion" /t REG_SZ /d "Windows 10" /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 "19045" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /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 "%ImageBuild%" geq "22621" if "%ImageBuild%" leq "22631" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "22H2" /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
			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 "0" /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 "3" /f >nul 2>&1
			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v "BypassNRO" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul 2>&1
			Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f >nul 2>&1
			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 2>&1
			Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul 2>&1

			if "%ImageArchitecture%" equ "x64" (
				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 2>&1
				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 2>&1
			)

			if "%SelectedSourceOS%" neq "w7" if "%SelectedSourceOS%" neq "w81" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" /v "DisableResetbase" /t REG_DWORD /d "0" /f >nul 2>&1
			if "%SelectedSourceOS%" equ "w11" Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarAl" /t REG_DWORD /d "0" /f >nul 2>&1
		)

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

echo.
echo.-------------------------------------------------------------------------------
echo.####应用调整已完成#############################################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set Tweaks=

endlocal

:: 返回到应用调整菜单
goto :ApplyTweaksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 无人应答 XML
::-------------------------------------------------------------------------------------------
:UnattendedXML

if "!Unattend_AccountName!" neq "" if "!Unattend_Password!" equ "" set "Unattend_AutoLogon=Enabled"

cls
echo.===============================================================================
echo.                         MSMG 工具箱 - 无人应答 XML
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.### 正在开始将无人应答 XML 文件写入到源 DVD 文件夹 ############################
echo.-------------------------------------------------------------------------------

(
	echo.^<^?xml version="1.0" encoding="utf-8"^?^>
	echo.
	echo.^<^^!-- *************************************************
	echo.安装说明：
	echo.- - - - - - - - - - - - - - - - - - - - - - - - -
	echo.此“Autounattend.xml”文件适用于两种安装模式：基于旧版 BIOS（MBR）和基于 UEFI 的（GPT）。
	echo.此方法将显示 UI（用户界面）：在 INDEX（Windows 版本）选择、磁盘配置（分区设置）和用户帐
	echo.户中。
	echo.如果需要设置自动磁盘分区的首选项，则需要为每个安装介质创建一个 Autounattend.xml 文件：
	echo.  1^) 用于 MBR 模式（based on legacy BIOS）
	echo.  2^) 用于 UEFI-based 模式（GPT）
	echo.这是由于每个分区表的配置中所需的特定差异。
	echo.************************************************** --^>
	echo.
	echo.^<unattend xmlns="urn:schemas-microsoft-com:unattend"^>
	echo.	^<settings pass="windowsPE"^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SetupUILanguage^>
		echo.				^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		echo.			^</SetupUILanguage^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SetupUILanguage^>
	echo.				^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	echo.			^</SetupUILanguage^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableFirewall^>true^</EnableFirewall^>
		echo.			^<EnableNetwork^>false^</EnableNetwork^>
		echo.			^<UseConfigurationSet^>true^</UseConfigurationSet^>
		echo.			^<ComplianceCheck^>
		echo.				^<DisplayReport^>OnError^</DisplayReport^>
		echo.			^</ComplianceCheck^>
		echo.			^<Diagnostics^>
		echo.				^<OptIn^>false^</OptIn^>
		echo.			^</Diagnostics^>
		echo.			^<DynamicUpdate^>
		echo.				^<Enable^>false^</Enable^>
		echo.				^<WillShowUI^>OnError^</WillShowUI^>
		echo.			^</DynamicUpdate^>
		echo.			^<UpgradeData^>
		echo.				^<Upgrade^>true^</Upgrade^>
		echo.				^<WillShowUI^>OnError^</WillShowUI^>
		echo.			^</UpgradeData^>
		echo.			^<UserData^>
		echo.				^<AcceptEula^>true^</AcceptEula^>
		if "!Unattend_AccountName!" neq "" echo.				^<FullName^>!Unattend_AccountName!^</FullName^>
		if "!Unattend_OrganizationName!" neq "" echo.				^<Organization^>!Unattend_OrganizationName!^</Organization^>
		echo.				^<ProductKey^>
		echo.					^<Key^>^</Key^>
		echo.					^<WillShowUI^>OnError^</WillShowUI^>
		echo.				^</ProductKey^>
		echo.			^</UserData^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableFirewall^>true^</EnableFirewall^>
	echo.			^<EnableNetwork^>false^</EnableNetwork^>
	echo.			^<UseConfigurationSet^>true^</UseConfigurationSet^>
	echo.			^<ComplianceCheck^>
	echo.				^<DisplayReport^>OnError^</DisplayReport^>
	echo.			^</ComplianceCheck^>
	echo.			^<Diagnostics^>
	echo.				^<OptIn^>false^</OptIn^>
	echo.			^</Diagnostics^>
	echo.			^<DynamicUpdate^>
	echo.				^<Enable^>false^</Enable^>
	echo.				^<WillShowUI^>OnError^</WillShowUI^>
	echo.			^</DynamicUpdate^>
	echo.			^<UpgradeData^>
	echo.				^<Upgrade^>true^</Upgrade^>
	echo.				^<WillShowUI^>OnError^</WillShowUI^>
	echo.			^</UpgradeData^>
	echo.			^<UserData^>
	echo.				^<AcceptEula^>true^</AcceptEula^>
	if "!Unattend_AccountName!" neq "" echo.				^<FullName^>!Unattend_AccountName!^</FullName^>
	if "!Unattend_OrganizationName!" neq "" echo.				^<Organization^>!Unattend_OrganizationName!^</Organization^>
	echo.				^<ProductKey^>
	echo.					^<Key^>^</Key^>
	echo.					^<WillShowUI^>OnError^</WillShowUI^>
	echo.				^</ProductKey^>
	echo.			^</UserData^>
	echo.		^</component^>
	echo.	^</settings^>
	if "%ImageBuild%" geq "21996" echo.	^<^^!-- ^<settings pass="offlineServicing" wasPassProcessed="true"^> --^>
	echo.	^<settings pass="offlineServicing"^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableLUA^>true^</EnableLUA^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableLUA^>true^</EnableLUA^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<DesktopOptimization^>
		echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
		echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
		echo.			^</DesktopOptimization^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<DesktopOptimization^>
	echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
	echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
	echo.			^</DesktopOptimization^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="generalize"^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-PnpSysprep" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PersistAllDeviceInstalls^>false^</PersistAllDeviceInstalls^>
		echo.			^<DoNotCleanUpNonPresentDevices^>false^</DoNotCleanUpNonPresentDevices^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PersistAllDeviceInstalls^>false^</PersistAllDeviceInstalls^>
	echo.			^<DoNotCleanUpNonPresentDevices^>false^</DoNotCleanUpNonPresentDevices^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Security-SPP" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<SkipRearm^>1^</SkipRearm^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipRearm^>1^</SkipRearm^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-WorkstationService" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<OtherDomains^>^</OtherDomains^>
		echo.			^<AllowInsecureGuestAuth^>0^</AllowInsecureGuestAuth^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-WorkstationService" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<OtherDomains^>^</OtherDomains^>
	echo.			^<AllowInsecureGuestAuth^>0^</AllowInsecureGuestAuth^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="specialize"^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Audio-AudioCore" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<DisableSpatialOnComboEndpoints^>false^</DisableSpatialOnComboEndpoints^>
		echo.			^<EnableCaptureMonitor^>false^</EnableCaptureMonitor^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Audio-AudioCore" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<DisableSpatialOnComboEndpoints^>false^</DisableSpatialOnComboEndpoints^>
	echo.			^<EnableCaptureMonitor^>false^</EnableCaptureMonitor^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Audio-VolumeControl" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<EnableVolumeControlWhileLocked^>true^</EnableVolumeControlWhileLocked^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Audio-VolumeControl" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<EnableVolumeControlWhileLocked^>true^</EnableVolumeControlWhileLocked^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<ExtendOSPartition^>
		echo.				^<Extend^>true^</Extend^>
		echo.			^</ExtendOSPartition^>
		echo.			^<^^!-- ^<RunAsynchronous^>
		echo.				^<RunAsynchronousCommand wcm:action="add"^>
		echo.					^<WillReboot^>OnRequest^</WillReboot^>
		echo.				^</RunAsynchronousCommand^>
		echo.			^</RunAsynchronous^> --^>
		echo.			^<^^!-- ^<RunSynchronous^>
		echo.				^<RunSynchronousCommand wcm:action="add"^>
		echo.					^<WillReboot^>OnRequest^</WillReboot^>
		echo.				^</RunSynchronousCommand^>
		echo.			^</RunSynchronous^> --^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<^^!-- ^<RunAsynchronous^>
	echo.				^<RunAsynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunAsynchronousCommand^>
	echo.			^</RunAsynchronous^> --^>
	echo.			^<^^!-- ^<RunSynchronous^>
	echo.				^<RunSynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunSynchronousCommand^>
	echo.			^</RunSynchronous^> --^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<^^!-- ^<RunAsynchronous^>
	echo.				^<RunAsynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunAsynchronousCommand^>
	echo.			^</RunAsynchronous^> --^>
	echo.			^<^^!-- ^<RunSynchronous^>
	echo.				^<RunSynchronousCommand wcm:action="add"^>
	echo.					^<WillReboot^>OnRequest^</WillReboot^>
	echo.				^</RunSynchronousCommand^>
	echo.			^</RunSynchronous^> --^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<AllSitesCompatibilityMode^>false^</AllSitesCompatibilityMode^>
		echo.			^<BlockPopups^>yes^</BlockPopups^>
		echo.			^<CommandLabelDisplay^>0^</CommandLabelDisplay^>
		echo.			^<DisableAccelerators^>false^</DisableAccelerators^>
		echo.			^<DisableDataExecutionPrevention^>false^</DisableDataExecutionPrevention^>
		echo.			^<DisableDevTools^>true^</DisableDevTools^>
		echo.			^<DisableFirstRunWizard^>true^</DisableFirstRunWizard^>
		echo.			^<DisableOOBAccelerators^>false^</DisableOOBAccelerators^>
		echo.			^<DisableWelcomePage^>true^</DisableWelcomePage^>
		echo.			^<FavoritesDelete^>false^</FavoritesDelete^>
		echo.			^<FavoritesOnTop^>false^</FavoritesOnTop^>
		echo.			^<FilterLevel^>Medium^</FilterLevel^>
		echo.			^<GroupTabs^>true^</GroupTabs^>
		echo.			^<IntranetCompatibilityMode^>true^</IntranetCompatibilityMode^>
		echo.			^<LockToolbars^>false^</LockToolbars^>
		echo.			^<MSCompatibilityMode^>false^</MSCompatibilityMode^>
		echo.			^<NoDial^>false^</NoDial^>
		echo.			^<PlaySound^>true^</PlaySound^>
		echo.			^<PrivacyAdvisorMode^>2^</PrivacyAdvisorMode^>
		echo.			^<ShowCompatibilityViewButton^>true^</ShowCompatibilityViewButton^>
		echo.			^<ShowInformationBar^>true^</ShowInformationBar^>
		echo.			^<ShowLeftAddressToolbar^>false^</ShowLeftAddressToolbar^>
		echo.			^<SmallCommandBarIcons^>true^</SmallCommandBarIcons^>
		echo.			^<SuggestedSitesEnabled^>true^</SuggestedSitesEnabled^>
		echo.			^<TabProcessGrowth^>Medium^</TabProcessGrowth^>
		echo.		^</component^>
		echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<SkipAutoActivation^>true^</SkipAutoActivation^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		if "!Unattend_AccountName!" neq "" (
			echo.			^<AutoLogon^>
			if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
			if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
			echo.				^<Username^>!Unattend_AccountName!^</Username^>
			echo.				^<Password^>
			echo.					^<PlainText^>true^</PlainText^>
			echo.					^<Value^>!Unattend_Password!^</Value^>
			echo.				^</Password^>
			echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
			echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
			echo.			^</AutoLogon^>
		)
		echo.			^<DesktopOptimization^>
		echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
		echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
		echo.			^</DesktopOptimization^>
		echo.			^<Themes^>
		if /I "!Unattend_Theme!" equ "Light" (
			echo.				^<DefaultThemesOff^>true^</DefaultThemesOff^>
			if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>true^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
			echo.				^<WindowColor^>Automatic^</WindowColor^>
		)
		if /I "!Unattend_Theme!" equ "Dark" (
			echo.				^<DefaultThemesOff^>false^</DefaultThemesOff^>
			if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>false^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
			echo.				^<UWPAppsUseLightTheme^>false^</UWPAppsUseLightTheme^>
			echo.				^<WindowColor^>0XC44C4A48^</WindowColor^>
			echo.				^<^^!-- ^<ThemeName^>Windows ^(DarkTheme^)^</ThemeName^> --^>
		)
		echo.			^</Themes^>
		echo.			^<StartTiles^>
		echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
		echo.			^</StartTiles^>
		echo.			^<^^!-- ^<ProductKey^>^</ProductKey^> --^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
		echo.			^<CopyProfile^>false^</CopyProfile^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
		echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
		echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
		echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	if "!Unattend_AccountName!" neq "" (
		echo.			^<AutoLogon^>
		if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
		if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
		echo.				^<Username^>!Unattend_AccountName!^</Username^>
		echo.				^<Password^>
		echo.					^<PlainText^>true^</PlainText^>
		echo.					^<Value^>!Unattend_Password!^</Value^>
		echo.				^</Password^>
		echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
		echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
		echo.			^</AutoLogon^>
	)
	echo.			^<DesktopOptimization^>
	echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
	echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
	echo.			^</DesktopOptimization^>
	echo.			^<Themes^>
	if /I "!Unattend_Theme!" equ "Light" (
		echo.				^<DefaultThemesOff^>true^</DefaultThemesOff^>
		if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>true^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
		echo.				^<WindowColor^>Automatic^</WindowColor^>
	)
	if /I "!Unattend_Theme!" equ "Dark" (
		echo.				^<DefaultThemesOff^>false^</DefaultThemesOff^>
		if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>false^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
		echo.				^<UWPAppsUseLightTheme^>false^</UWPAppsUseLightTheme^>
		echo.				^<WindowColor^>0XC44C4A48^</WindowColor^>
		echo.				^<^^!-- ^<ThemeName^>Windows ^(DarkTheme^)^</ThemeName^> --^>
	)
	echo.			^</Themes^>
	echo.			^<StartTiles^>
	echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
	echo.			^</StartTiles^>
	echo.			^<^^!-- ^<ProductKey^>^</ProductKey^> --^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
	echo.			^<CopyProfile^>false^</CopyProfile^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	if "!Unattend_MachineName!" neq "" echo.			^<ComputerName^>!Unattend_MachineName!^</ComputerName^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
	echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
	echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
	echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Networking-MPSSVC-Svc" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<^^!-- ^<FirewallGroups^>
		echo.				^<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"^>
		echo.					^<Active^>true^</Active^>
		echo.					^<Group^>@FirewallAPI.dll,-28752^</Group^>
		echo.					^<Profile^>all^</Profile^>
		echo.				^</FirewallGroup^>
		echo.			^</FirewallGroups^> --^>
		echo.			^<DomainProfile_EnableFirewall^>true^</DomainProfile_EnableFirewall^>
		echo.			^<PrivateProfile_EnableFirewall^>true^</PrivateProfile_EnableFirewall^>
		echo.			^<PublicProfile_EnableFirewall^>true^</PublicProfile_EnableFirewall^>
		echo.			^<PrivateProfile_DisableNotifications^>false^</PrivateProfile_DisableNotifications^>
		echo.		^</component^>
	)
	echo.		^<component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<^^!-- ^<FirewallGroups^>
	echo.				^<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"^>
	echo.					^<Active^>true^</Active^>
	echo.					^<Group^>@FirewallAPI.dll,-28752^</Group^>
	echo.					^<Profile^>all^</Profile^>
	echo.				^</FirewallGroup^>
	echo.			^</FirewallGroups^> --^>
	echo.			^<DomainProfile_EnableFirewall^>true^</DomainProfile_EnableFirewall^>
	echo.			^<PrivateProfile_EnableFirewall^>true^</PrivateProfile_EnableFirewall^>
	echo.			^<PublicProfile_EnableFirewall^>true^</PublicProfile_EnableFirewall^>
	echo.			^<PrivateProfile_DisableNotifications^>false^</PrivateProfile_DisableNotifications^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.	^<settings pass="oobeSystem"^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<ExtendOSPartition^>
		echo.				^<Extend^>true^</Extend^>
		echo.			^</ExtendOSPartition^>
		echo.			^<Reseal^>
		echo.				^<ForceShutdownNow^>false^</ForceShutdownNow^>
		echo.				^<Mode^>OOBE^</Mode^>
		echo.			^</Reseal^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.			^<Reseal^>
	echo.				^<ForceShutdownNow^>false^</ForceShutdownNow^>
	echo.				^<Mode^>OOBE^</Mode^>
	echo.			^</Reseal^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-Deployment" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<ExtendOSPartition^>
	echo.				^<Extend^>true^</Extend^>
	echo.			^</ExtendOSPartition^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
		echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
		echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
		if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
		echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-International-Core" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<InputLocale^>!Unattend_InputLocale!^</InputLocale^>
	echo.			^<SystemLocale^>!Unattend_LocaleLanguage!^</SystemLocale^>
	echo.			^<UILanguage^>!Unattend_UILanguage!^</UILanguage^>
	if /I "%ImageLanguage%" neq "en-US" echo.			^<UILanguageFallback^>!Unattend_LanguageFallback!^</UILanguageFallback^>
	echo.			^<UserLocale^>!Unattend_LocaleLanguage!^</UserLocale^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
		echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-SecureStartup-FilterDriver" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<PreventDeviceEncryption^>true^</PreventDeviceEncryption^>
	echo.			^<NvcUserDataAllow^>true^</NvcUserDataAllow^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
	echo.		^</component^>
	echo.		^<component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="wow64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<UninstallWindowsRE^>false^</UninstallWindowsRE^>
	echo.		^</component^>
	if "%ImageBuild%" lss "21996" (
		echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
		echo.			^<OOBE^>
		echo.				^<HideEULAPage^>true^</HideEULAPage^>
		echo.				^<HideOEMRegistrationScreen^>true^</HideOEMRegistrationScreen^>
		echo.				^<HideOnlineAccountScreens^>true^</HideOnlineAccountScreens^>
		if "!Unattend_AccountName!" equ "" echo.				^<HideLocalAccountScreen^>false^</HideLocalAccountScreen^>
		if "!Unattend_AccountName!" neq "" echo.				^<HideLocalAccountScreen^>true^</HideLocalAccountScreen^>
		echo.				^<HideWirelessSetupInOOBE^>true^</HideWirelessSetupInOOBE^>
		echo.				^<NetworkLocation^>Other^</NetworkLocation^>
		if "!Unattend_AccountName!" equ "" (
			echo.				^<SkipUserOOBE^>false^</SkipUserOOBE^>
			echo.				^<SkipMachineOOBE^>false^</SkipMachineOOBE^>
		)
		if "!Unattend_AccountName!" neq "" (
			echo.				^<SkipUserOOBE^>true^</SkipUserOOBE^>
			echo.				^<SkipMachineOOBE^>true^</SkipMachineOOBE^>
		)
		echo.				^<ProtectYourPC^>3^</ProtectYourPC^>
		echo.				^<UnattendEnableRetailDemo^>false^</UnattendEnableRetailDemo^>
		echo.				^<VMModeOptimizations^>
		echo.					^<SkipAdministratorProfileRemoval^>false^</SkipAdministratorProfileRemoval^>
		echo.					^<SkipNotifyUILanguageChange^>true^</SkipNotifyUILanguageChange^>
		echo.					^<SkipWinREInitialization^>false^</SkipWinREInitialization^>
		echo.				^</VMModeOptimizations^>
		echo.			^</OOBE^>
		if "!Unattend_AccountName!" neq "" (
			echo.			^<AutoLogon^>
			if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
			if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
			echo.				^<Username^>!Unattend_AccountName!^</Username^>
			echo.				^<Password^>
			echo.					^<PlainText^>true^</PlainText^>
			echo.					^<Value^>!Unattend_Password!^</Value^>
			echo.				^</Password^>
			echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
			echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
			echo.			^</AutoLogon^>
			echo.			^<UserAccounts^>
			echo.				^<LocalAccounts^>
			echo.					^<LocalAccount wcm:action="add"^>
			echo.						^<DisplayName^>!Unattend_AccountName!^</DisplayName^>
			echo.						^<Name^>!Unattend_AccountName!^</Name^>
			echo.						^<Group^>Administrators;Power Users^</Group^>
			echo.						^<Password^>
			echo.							^<PlainText^>true^</PlainText^>
			echo.							^<Value^>!Unattend_Password!^</Value^>
			echo.						^</Password^>
			echo.						^<Description^>!Unattend_PasswordDescription!^</Description^>
			echo.					^</LocalAccount^>
			echo.				^</LocalAccounts^>
			echo.			^</UserAccounts^>
		)
		echo.			^<Themes^>
		if /I "!Unattend_Theme!" equ "Light" (
			echo.				^<DefaultThemesOff^>true^</DefaultThemesOff^>
			if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>true^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
			echo.				^<WindowColor^>Automatic^</WindowColor^>
		)
		if /I "!Unattend_Theme!" equ "Dark" (
			echo.				^<DefaultThemesOff^>false^</DefaultThemesOff^>
			if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>false^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
			echo.				^<UWPAppsUseLightTheme^>false^</UWPAppsUseLightTheme^>
			echo.				^<WindowColor^>0XC44C4A48^</WindowColor^>
			echo.				^<^^!-- ^<ThemeName^>Windows ^(DarkTheme^)^</ThemeName^> --^>
		)
		echo.			^</Themes^>
		echo.			^<VisualEffects^>
		echo.				^<FontSmoothing^>Standard^</FontSmoothing^>
		echo.			^</VisualEffects^>
		echo.			^<DesktopOptimization^>
		echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
		echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
		echo.			^</DesktopOptimization^>
		echo.			^<StartTiles^>
		echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
		echo.			^</StartTiles^>
		echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
		echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
		echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
		echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
		echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
		if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
		if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
		echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
		echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
		echo.			^<SignInMode^>2^</SignInMode^>
		echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
		echo.		^</component^>
	)
	echo.		^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^>
	echo.			^<OOBE^>
	echo.				^<HideEULAPage^>true^</HideEULAPage^>
	echo.				^<HideOEMRegistrationScreen^>true^</HideOEMRegistrationScreen^>
	echo.				^<HideOnlineAccountScreens^>true^</HideOnlineAccountScreens^>
	if "!Unattend_AccountName!" equ "" echo.				^<HideLocalAccountScreen^>false^</HideLocalAccountScreen^>
	if "!Unattend_AccountName!" neq "" echo.				^<HideLocalAccountScreen^>true^</HideLocalAccountScreen^>
	echo.				^<HideWirelessSetupInOOBE^>true^</HideWirelessSetupInOOBE^>
	echo.				^<NetworkLocation^>Other^</NetworkLocation^>
	if "!Unattend_AccountName!" equ "" (
		echo.				^<SkipUserOOBE^>false^</SkipUserOOBE^>
		echo.				^<SkipMachineOOBE^>false^</SkipMachineOOBE^>
	)
	if "!Unattend_AccountName!" neq "" (
		echo.				^<SkipUserOOBE^>true^</SkipUserOOBE^>
		echo.				^<SkipMachineOOBE^>true^</SkipMachineOOBE^>
	)
	echo.				^<ProtectYourPC^>3^</ProtectYourPC^>
	echo.				^<UnattendEnableRetailDemo^>false^</UnattendEnableRetailDemo^>
	echo.				^<VMModeOptimizations^>
	echo.					^<SkipAdministratorProfileRemoval^>false^</SkipAdministratorProfileRemoval^>
	echo.					^<SkipNotifyUILanguageChange^>true^</SkipNotifyUILanguageChange^>
	echo.					^<SkipWinREInitialization^>false^</SkipWinREInitialization^>
	echo.				^</VMModeOptimizations^>
	echo.			^</OOBE^>
	if "!Unattend_AccountName!" neq "" (
		echo.			^<AutoLogon^>
		if /I "!Unattend_AutoLogon!" equ "Disabled" echo.				^<Enabled^>false^</Enabled^>
		if /I "!Unattend_AutoLogon!" equ "Enabled" echo.				^<Enabled^>true^</Enabled^>
		echo.				^<Username^>!Unattend_AccountName!^</Username^>
		echo.				^<Password^>
		echo.					^<PlainText^>true^</PlainText^>
		echo.					^<Value^>!Unattend_Password!^</Value^>
		echo.				^</Password^>
		echo.				^<^^!-- ^<Domain^>DomainName^</Domain^> --^>
		echo.				^<^^!-- ^<LogonCount^>9999999999^</LogonCount^> --^>
		echo.			^</AutoLogon^>
		echo.			^<UserAccounts^>
		echo.				^<LocalAccounts^>
		echo.					^<LocalAccount wcm:action="add"^>
		echo.						^<DisplayName^>!Unattend_AccountName!^</DisplayName^>
		echo.						^<Name^>!Unattend_AccountName!^</Name^>
		echo.						^<Group^>Administrators;Power Users^</Group^>
		echo.						^<Password^>
		echo.							^<PlainText^>true^</PlainText^>
		echo.							^<Value^>!Unattend_Password!^</Value^>
		echo.						^</Password^>
		echo.						^<Description^>!Unattend_PasswordDescription!^</Description^>
		echo.					^</LocalAccount^>
		echo.				^</LocalAccounts^>
		echo.			^</UserAccounts^>
	)
	echo.			^<Themes^>
	if /I "!Unattend_Theme!" equ "Light" (
		echo.				^<DefaultThemesOff^>true^</DefaultThemesOff^>
		if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>true^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
		echo.				^<WindowColor^>Automatic^</WindowColor^>
	)
	if /I "!Unattend_Theme!" equ "Dark" (
		echo.				^<DefaultThemesOff^>false^</DefaultThemesOff^>
		if "%ImageBuild%" geq "18362" echo.				^<SystemUsesLightTheme^>false^</SystemUsesLightTheme^> ^<^^!-- For Builds greater than 1809 17763 LTSC --^>
		echo.				^<UWPAppsUseLightTheme^>false^</UWPAppsUseLightTheme^>
		echo.				^<WindowColor^>0XC44C4A48^</WindowColor^>
		echo.				^<^^!-- ^<ThemeName^>Windows ^(DarkTheme^)^</ThemeName^> --^>
	)
	echo.			^</Themes^>
	echo.			^<VisualEffects^>
	echo.				^<FontSmoothing^>Standard^</FontSmoothing^>
	echo.			^</VisualEffects^>
	echo.			^<DesktopOptimization^>
	echo.				^<GoToDesktopOnSignIn^>true^</GoToDesktopOnSignIn^>
	echo.				^<ShowWindowsStoreAppsOnTaskbar^>false^</ShowWindowsStoreAppsOnTaskbar^>
	echo.			^</DesktopOptimization^>
	echo.			^<StartTiles^>
	echo.				^<PromoteOEMTiles^>false^</PromoteOEMTiles^>
	echo.			^</StartTiles^>
	echo.			^<BluetoothTaskbarIconEnabled^>true^</BluetoothTaskbarIconEnabled^>
	echo.			^<ConvertibleSlateModePromptPreference^>1^</ConvertibleSlateModePromptPreference^>
	echo.			^<DisableAutoDaylightTimeSet^>true^</DisableAutoDaylightTimeSet^>
	echo.			^<DoNotCleanTaskBar^>true^</DoNotCleanTaskBar^>
	echo.			^<EnableStartMenu^>true^</EnableStartMenu^>
	if "!Unattend_OrganizationName!" neq "" echo.			^<RegisteredOrganization^>!Unattend_OrganizationName!^</RegisteredOrganization^>
	if "!Unattend_AccountName!" neq "" echo.			^<RegisteredOwner^>!Unattend_AccountName!^</RegisteredOwner^>
	echo.			^<ShowPowerButtonOnStartScreen^>true^</ShowPowerButtonOnStartScreen^>
	echo.			^<ShowWindowsLive^>false^</ShowWindowsLive^>
	echo.			^<SignInMode^>2^</SignInMode^>
	echo.			^<TimeZone^>!Unattend_TimeZone!^</TimeZone^>
	echo.		^</component^>
	echo.	^</settings^>
	echo.^</unattend^>
	echo.
)>"!UnattendXML_Path!"

echo.
echo.-------------------------------------------------------------------------------
echo.### 无人参与 XML 文件写入源 DVD 文件夹已完成 ##################################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================
echo.

call :ValidateXML "!UnattendXML_Path!"

echo.
TIMEOUT.exe /T -1

goto :UnattendedMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 验证 DVD 文件夹中的“Autounattend.xml”文件模组
:: 输入参数 [ %~1 : XML 文件路径]
::-------------------------------------------------------------------------------------------
:ValidateXML

:: 读取内容并将其转换为 XML 文档
if /I exist "%~1" PowerShell.exe -Command "try {$null = [System.Xml.XmlDocument]$(Get-Content -Path '%~1' -ErrorAction 'Stop'); Write-Host -Object $('信息：XML 内容语法验证成功完成') -ForegroundColor 'Gray'} catch {Write-Host -Object $('出现错误：XML 内容语法验证失败') -ForegroundColor 'Red'; Write-Host -Object $('ERROR: ' + $($_.Exception.Message -Join ' ')) -ForegroundColor 'Red'}"

goto :EOF
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 清理源映像模组
::-------------------------------------------------------------------------------------------
: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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到应用菜单
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 (call :RemoveFolder %%i)
				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%\%%i\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，索引 ：索引编号] 映像 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 (call :RemoveFolder %%j)
			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" call :RemoveFolder "%InstallMount%\%%i\$Recycle.Bin"
			if exist "%InstallMount%\%%i\PerfLogs" call :RemoveFolder "%InstallMount%\%%i\PerfLogs"
			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 (call :RemoveFolder %%i)
				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.-------------------------------------------------------------------------------
	rem call :ExportImage "%BootWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%BootWim%"
	echo.
)

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.-------------------------------------------------------------------------------
	rem call :ExportImage "%InstallMount%\%DefaultIndexNo%\%WinReWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%InstallMount%\%DefaultIndexNo%\%WinReWim%"
	echo.
	copy /y "%InstallMount%\%DefaultIndexNo%\%WinReWim%" "%Temp%\rebuild.wim"
)

:: 保存并卸载源安装和恢复映像
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 (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%Temp%\rebuild.wim", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%Temp%\rebuild.wim" --compress=LZX
		echo.
	)
	move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul
)

if "%TrimEditions%" equ "No" (
	rem call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
	echo.
	"%WimlibImagex%" optimize "%InstallWim%"
	echo.
)

echo.-------------------------------------------------------------------------------
echo.####应用并保存更改到源映像已完成###############################################
echo.-------------------------------------------------------------------------------
echo.

:Stop
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%BootWim%" (
	echo.Windows 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" if not exist "%DVD%\sources\*.swm" (
	echo.Windows 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<DVD^> 文件夹……
	goto :Stop
)

:: 检查 Windows 源 DVD 文件夹是否是空的
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows 安装程序 Source 文件夹 ^<DVD^> 是空的……
	echo.
	echo.请复制安装程序 Source 文件到 ^<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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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 闪存驱动器卷标。
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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

set USBDriveLetter=
set USBDriveLabel=

endlocal

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

::-------------------------------------------------------------------------------------------
:: 列出所有磁盘和卷模组
::-------------------------------------------------------------------------------------------
:ListDisks

set "DiskTemp=C:"
call :RemoveFile "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList1.txt"

echo.list volume>> "%DiskTemp%\DiskList.txt"
diskpart /s "%DiskTemp%\DiskList.txt" >> "%DiskTemp%\DiskList1.txt"
call :RemoveFile "%DiskTemp%\DiskList.txt"
echo.>> "%DiskTemp%\DiskList.txt"

echo.===============================================================================>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "en-US" echo.  Volume #  Letter Label      file Sys Type         Size    Status     Info>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "fr-FR" echo.  N# volume   Ltr  Nom          Fs     Type        Taille   Statut     Info>> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "zh-CN" echo.  卷     #    盘符   标签     文件系统  类型          大小     状态       信息>> "%DiskTemp%\DiskList.txt"
echo.------------------------------------------------------------------------------->> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "en-US" findstr "Removable" "%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "fr-FR" findstr "Amovible" "%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
if "%HostUILanguage%" equ "zh-CN" findstr "可移动"%DiskTemp%\DiskList1.txt" >> "%DiskTemp%\DiskList.txt"
echo.===============================================================================>> "%DiskTemp%\DiskList.txt"

type "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList.txt"
call :RemoveFile "%DiskTemp%\DiskList1.txt"
echo.

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 格式化硬盘/卷模组
:: 输入参数 [ %~1 ：USB 盘符、%~2 ：格式类型、%~3 ：卷标]
::-------------------------------------------------------------------------------------------
:FormatDisk

set "DiskTemp=C:"

:: 写入 DiskPart.txt 脚本文件。
call :RemoveFile "%DiskTemp%\DiskPart.txt"
echo.select volume ^%~1>> "%DiskTemp%\DiskPart.txt"
echo.clean>> "%DiskTemp%\DiskPart.txt"
echo.create partition primary>> "%DiskTemp%\DiskPart.txt"
echo.select partition ^1>> "%DiskTemp%\DiskPart.txt"
echo.active>> "%DiskTemp%\DiskPart.txt"
echo.format fs=%~2 quick label=%~3>> "%DiskTemp%\DiskPart.txt"
echo.exit>> "%DiskTemp%\DiskPart.txt"
echo.exit>> "%DiskTemp%\DiskPart.txt"
echo.
echo.-------------------------------------------------------------------------------
echo.####正在格式化 USB 闪存驱动器##################################################
echo.-------------------------------------------------------------------------------
echo.
:: 使用 Diskpart 执行 DiskPart.txt 脚本文件。
echo.正在格式化 USB 闪存驱动器 [%~1] 为 %~2 格式，请稍等……
start /B /wait diskpart /s "%DiskTemp%\DiskPart.txt" >nul
echo.
echo.格式化 USB 闪存驱动器 [%~1] 为 %~2 格式，完成……
call :RemoveFile "%DiskTemp%\DiskPart.txt"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG 工具箱 - WIM 管理器
::-------------------------------------------------------------------------------------------
:WIMManager

cls
echo.===============================================================================
echo.                          MSMG 工具箱 - WIM 管理器
echo.===============================================================================
echo.

:: 检查源文件是否被应用。
if "%IsSourceSelected%" equ "Yes" (
	echo.当源操作系统被选择时，无法使用此功能……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……

:: 返回到 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>nul|set /p=请按任意键继续执行……
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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'uit]
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到 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>nul|set /p=请按任意键继续执行……
	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" (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%DVD%\sources\%WimImageFileName%", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%DVD%\sources\%WimImageFileName%" --compress=LZX
		echo.
	)
	if "!Export2NewImage!" equ "No" (
		rem call :ExportImageIndex "%InstallWim%", %%i, "%InstallWim%", "WIM", "No"
		echo.
		"%WimlibImagex%" export "%InstallWim%" %%i "%InstallWim%" --compress=LZX
		echo.
	)
)
echo.-------------------------------------------------------------------------------
echo.####导出源 WIM 映像索引已完成##################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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>nul|set /p=请按任意键继续执行……
	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 (
	rem call :ExportImageIndex "%InstallWim%", %%i, "%InstallEsd%", "ESD", "No"
	echo.
	"%WimlibImagex%" export "%InstallWim%" %%i "%InstallEsd%" --compress=LZMS --solid
	echo.
)

:: 删除源映像文件
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####转换 WIM 映像为 ESD 映像已完成#############################################
echo.-------------------------------------------------------------------------------

:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到 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>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 N
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 7 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 K
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseK" (
	echo.Windows 7 企业版 K 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 企业版 KN
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseKN" (
	echo.Windows 7 企业版 KN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Ultimate" (
	echo.Windows 7 旗舰版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 N
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateN" (
	echo.Windows 7 旗舰版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 K
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateK" (
	echo.Windows 7 旗舰版 K 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 7 旗舰版 KN
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateKN" (
	echo.Windows 7 旗舰版 KN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版（含 Media Center）
if "%ImageFlag%" equ "ProfessionalWMC" (
	echo.Windows 8.1 专业版（含 Media Center）无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 专业版 N
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 8.1 专业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 企业版
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 8.1 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 企业版 N
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 8.1 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 Embedded Industry Pro/Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustry" (
	echo.Windows Embedded 8.1 Industry Pro Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 8.1 Embedded Industry Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustryE" (
	echo.Windows Embedded 8.1 Industry 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Datacenter Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenterCore" (
	echo.Windows Server 2012 R2 Datacenter Core Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Datacenter Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerDataCenter" (
	echo.Windows Server 2012 R2 Datacenter Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2012 R2 Foundation Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerWinFoundation" (
	echo.Windows Server 2012 R2 Foundation Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2012 R2 Standard Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2012 R2 Standard Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2012 R2 Workgroup Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2012 R2 Workgroup Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 企业版
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 10 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10 专业版
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "Professional" (
	echo.Windows 10 专业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 企业版 G
if "%ImageFlag%" equ "EnterpriseG" (
	echo.Windows %OSID% 企业版 G 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 企业版 GN
if "%ImageFlag%" equ "EnterpriseGN" (
	echo.Windows %OSID% 企业版 GN 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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 无法升级……
	if "%ImageBuild%" equ "19045" echo.Windows 10 企业版 2021 LTSC 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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 无法升级……
	if "%ImageBuild%" equ "19045" echo.Windows 10 企业版 N 2021 LTSC 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 IoT 企业版
if "%ImageFlag%" equ "IoTEnterprise" (
	echo.Windows %OSID% IoT 企业版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 IoT 企业版 N
if "%ImageFlag%" equ "IoTEnterpriseN" (
	echo.Windows %OSID% IoT 企业版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 教育版
if "%ImageFlag%" equ "Education" (
	echo.Windows %OSID% 教育版无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 教育版 N
if "%ImageFlag%" equ "EducationN" (
	echo.Windows %OSID% 教育版 N 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows 10/11 适用于虚拟桌面的企业版
if "%ImageFlag%" equ "ServerRdsh" (
	echo.Windows %OSID% 企业版多会话无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Hyper Server 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerHyper" (
	echo.Windows Hyper-V Server 2016 Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2016 Azure Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerAzureCor" (
	echo.Windows Server 2016 Azure Core Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Server 2016 Datacenter Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerDatacenter" (
	echo.Windows Server 2016 Datacenter Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2016 Standard Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageStandard" (
	echo.Windows Storage Server 2016 Standard Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	goto :WIMManager
)

:: 检查所选择的源操作系统是否是 Windows Storage Server 2016 Workgroup Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerStorageWorkgroup" (
	echo.Windows Storage Server 2016 Workgroup Edition 无法升级……
	echo.
	echo.===============================================================================
	echo.
	pause>nul|set /p=请按任意键继续执行……
	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 v2004 %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%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "19045" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server v22H2 %SourceEdition% 升级到 %TargetEdition%……
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "20348" if "%ImageInstallationType:~,6%" equ "Server" echo.正在将 Windows Server 2022 %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（带有 GUI 的服务器）"
		set "Description=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
		set "DisplayName=Windows Server 2012 R2 Standard（带有 GUI 的服务器）"
		set "DisplayDescription=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDatacenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2012 R2 Datacenter（带有 GUI 的服务器）"
		set "Description=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
		set "DisplayName=Windows Server 2012 R2 Datacenter（带有 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 "CoreSingleLanguage" (
		set "Flag=CoreSingleLanguage"
		set "Edition=CoreSingleLanguage"
		set "Name=Windows %OSID% 家庭单语言版"
		set "Description=Windows %OSID% 家庭单语言版"
		set "DisplayName=Windows %OSID% 家庭单语言版"
		set "DisplayDescription=Windows %OSID% 家庭单语言版"
	)

	if "%TargetEdition%" equ "CoreCountrySpecific" (
		set "Flag=CoreCountrySpecific"
		set "Edition=CoreCountrySpecific"
		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 "%TargetEdition%" equ "IoTEnterprise" (
		set "Flag=IoTEnterprise"
		set "Edition=IoTEnterprise"
		set "Name=Windows %OSID% IoT 企业版"
		set "Description=Windows %OSID% IoT 企业版"
		set "DisplayName=Windows %OSID% IoT 企业版"
		set "DisplayDescription=Windows %OSID% IoT 企业版"
	)

	if "%TargetEdition%" equ "IoTEnterpriseS" (
		set "Flag=IoTEnterpriseS"
		set "Edition=IoTEnterpriseS"
		set "Name=Windows %OSID% IoT 企业版 LTSC"
		set "Description=Windows %OSID% IoT 企业版 LTSC"
		set "DisplayName=Windows %OSID% IoT 企业版 LTSC"
		set "DisplayDescription=Windows %OSID% IoT 企业版 LTSC"
	)

	if "%TargetEdition%" equ "IoTEnterpriseN" (
		set "Flag=IoTEnterpriseN"
		set "Edition=IoTEnterpriseN"
		set "Name=Windows %OSID% IoT 企业版 N"
		set "Description=Windows %OSID% IoT 企业版 N"
		set "DisplayName=Windows %OSID% IoT 企业版 N"
		set "DisplayDescription=Windows %OSID% IoT 企业版 N"
	)

	if "%TargetEdition%" equ "IoTEnterpriseSN" (
		set "Flag=IoTEnterpriseSN"
		set "Edition=IoTEnterpriseSN"
		set "Name=Windows %OSID% IoT 企业版 N LTSC"
		set "Description=Windows %OSID% IoT 企业版 N LTSC"
		set "DisplayName=Windows %OSID% IoT 企业版 N LTSC"
		set "DisplayDescription=Windows %OSID% IoT 企业版 N LTSC"
	)

	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 Core" if "%SourceEdition%" equ "ServerStandardACor" if "%TargetEdition%" equ "ServerDatacenterACor" (
		set "Flag=ServerDataCenterACor"
		set "Edition=ServerDatacenterACor"
		set "Name=Windows Server SERVERDATACENTERACORE"
		set "Description=Windows Server SERVERDATACENTERACORE"
		set "DisplayName=Windows Server Datacenter"
		set "DisplayDescription=（推荐）此选项忽略了大部分 Windows 图形环境。通过命令提示符和 PowerShell，或者远程使用 Windows Admin Center 或其他工具进行管理。"
	)

	if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server Core" if "%SourceEdition%" equ "ServerStandard" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDataCenter"
		set "Name=Windows Server 2019 SERVERDATACENTERCORE"
		set "Description=Windows Server 2019 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2019 Datacenter"
		set "DisplayDescription=（推荐）此选项忽略了大部分 Windows 图形环境。通过命令提示符和 PowerShell，或者远程使用 Windows Admin Center 或其他工具进行管理。"
	)

	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=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server Core" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDataCenterCore"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2022 SERVERDATACENTERCORE"
		set "Description=Windows Server 2022 SERVERDATACENTERCORE"
		set "DisplayName=Windows Server 2022 Datacenter"
		set "DisplayDescription=（推荐）此选项忽略了大部分 Windows 图形环境。通过命令提示符和 PowerShell，或者远程使用 Windows Admin Center 或其他工具进行管理。"
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerStandardEval" if "%TargetEdition%" equ "ServerStandard" (
		set "Flag=ServerStandard"
		set "Edition=ServerStandard"
		set "Name=Windows Server 2022 SERVERSTANDARD"
		set "Description=Windows Server 2022 SERVERSTANDARD"
		set "DisplayName=Windows Server 2022 Standard（桌面体验）"
		set "DisplayDescription=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)

	if "%ImageBuild%" equ "20348" if "%ImageInstallationType%" equ "Server" if "%TargetEdition%" equ "ServerDatacenter" (
		set "Flag=ServerDatacenter"
		set "Edition=ServerDatacenter"
		set "Name=Windows Server 2022 SERVERDATACENTER"
		set "Description=Windows Server 2022 SERVERDATACENTER"
		set "DisplayName=Windows Server 2022 Datacenter（桌面体验）"
		set "DisplayDescription=当需要 GUI 时，此选项很有用（例如，为无法在服务器核心安装上运行的应用程序提供向后兼容性）。支持所有服务器角色和功能。有关更多详细信息，请参阅“Windows Server 安装选项”。"
	)
)

:: 设置映像标识、名称和描述以反映目标版本
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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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>nul|set /p=请按任意键继续执行……
	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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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>nul|set /p=请按任意键继续执行……
	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 "19045" set "SelectedSourceOS=w10"
	if "%ImageBuild%" geq "22000" set "SelectedSourceOS=w11"
)
if "%ImageVersion:~0,-6%" equ "11.0" 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%", "%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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

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.-------------------------------------------------------------------------------
rem call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No"
echo.
"%WimlibImagex%" optimize "%InstallWim%"
echo.
echo.-------------------------------------------------------------------------------
echo.####优化源 WIM 映像已完成######################################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到 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.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 返回到工具菜单
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>nul|set /p=请按任意键继续执行……
			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>nul|set /p=请按任意键继续执行……
	)
	if "%IsImageRegistryLoaded%" equ "Yes" (
		cls
		echo.===============================================================================
		echo.                          MSMG 工具箱 - 映像注册表
		echo.===============================================================================
		echo.
		echo.正在卸载映像注册表……
		call :UnMountImageRegistry
		set "IsImageRegistryLoaded=No"
		echo.
		echo.卸载映像注册表完成……
		echo.
		echo.===============================================================================
		echo.
		pause>nul|set /p=请按任意键继续执行……
	)
	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 lss 10 echo.^|    %%a   ^| %%b         ^| %%c>>%ImageInfo%
				if %%a geq 10 if %%a lss 100 echo.^|   %%a   ^| %%b         ^| %%c>>%ImageInfo%
				if %%a geq 100 echo.^|  %%a   ^| %%b         ^| %%c>>%ImageInfo%
			)
			if "%%b" equ "arm64" (
				if %%a lss 10 echo.^|    %%a   ^| %%b       ^| %%c>>%ImageInfo%
				if %%a geq 10 if %%a lss 100 echo.^|   %%a   ^| %%b       ^| %%c>>%ImageInfo%
				if %%a geq 100 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 : 映像文件名称 ]
::-------------------------------------------------------------------------------------------
:GetImageName

for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Name') do (set ImageName=%%a)
set "ImageName=%ImageName:~1%"

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=1 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!"

if "%ImageFlag%" equ "" set "ImageFlag=%ImageEdition%"

if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:(=[%"
if "%ImageInstallationType:~,6%" equ "Server" set "ImageDescription=%ImageDescription:)=]%"

goto :eof
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: 获取已更新的映像索引信息模组
::-------------------------------------------------------------------------------------------
:GetInformation4UnattendedFile
if /I "%IsSourceSelected%" equ "Yes" (
	call :MountImageRegistry "%InstallMount%\%DefaultIndexNo%" >nul 2>&1
	for /f "tokens=3 delims=\ " %%o in ('reg query "HKLM\TK_NTUSER\Control Panel\International\User Profile" /s /v "Languages" 2^>nul ^| findstr /I "REG_ _SZ"') do (set "ImageLanguage=%%o")
	call :UnMountImageRegistry

	for /f "tokens=6 delims= " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Default system UI language"') do (set "ImageUILanguage=%%l")
	if "!ImageLanguage!" equ "" set "ImageLanguage=!ImageUILanguage!"

	set ImagePartiallyLocalized=
	set ImageLanguageFallback=
	for /f "tokens=3 delims=, " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Partially localized language"') do (set "ImagePartiallyLocalized=%%l")
	if "!ImagePartiallyLocalized!" equ "Partially" (
		for /f "tokens=7 delims= " %%l in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"language fallback is"') do (set "ImageLanguageFallback=%%l")
		if "!ImageLanguageFallback!" equ "" set "ImageLanguageFallback=en-US"
	)

	for /f "tokens=4 delims=, " %%k in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Active keyboard(s)"') do (set "ImageActiveKeyboard=%%k")
	rem Windows 默认 pt-BR 布局是 ABNT“0416:00000416”。但流行的布局是 ABNT2“0416:00010416”
	if "!ImageActiveKeyboard!" equ "0416:00000416" set "ImageActiveKeyboard=0416:00010416"

	if "!ImageDefaultLanguage!" equ "%HostUILanguage%" (
		set "ImageTimeZone=%HostTimeZone%"
	)
	if "!ImageDefaultLanguage!" neq "%HostUILanguage%" (
		for /f "tokens=2 delims=:" %%f in ('%DISM% /Get-Intl /Image:"%InstallMount%\%DefaultIndexNo%" 2^>nul ^| findstr /I /C:"Default time zone"') do (set "ImageTimeZone=%%f")
		set "ImageTimeZone=!ImageTimeZone:~1!"
	)
)

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 %~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_DEFAULT >nul 2>&1
reg unload HKLM\TK_DRIVERS >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 2>&1

:: 检索程序包注册表项路径
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>nul|set /p=请按任意键继续执行……

	goto :Mainmenu
)
echo.正在执行后期清理操作，请稍候……
echo.
call :CleanUp
echo.感谢 MDL 的每一位贡献者……
echo.
echo.正在退出 MSMG 工具箱……
echo.
echo.===============================================================================
pause>nul|set /p=请按任意键继续执行……

:: 恢复 DOS 窗口大小
reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

reg add "HKU\.DEFAULT\Console" /v "FaceName" /t REG_SZ /d "Consolas" /f
reg add "HKU\.DEFAULT\Console" /v "FontFamily" /t REG_DWORD /d "0x36" /f
reg add "HKU\.DEFAULT\Console" /v "FontSize" /t REG_DWORD /d "0x100000" /f
reg add "HKU\.DEFAULT\Console" /v "FontWeight" /t REG_DWORD /d "0x190" /f
reg add "HKU\.DEFAULT\Console" /v "ScreenBufferSize" /t REG_DWORD /d "0x12c0050" /f

color 00
endlocal

exit