

ÿþ
@echo off

::------------------------------------------------------------------------------
:: MSMG ToolKit v11.1
:: Copyright (c) 2013-2020 MSMG. All rights reserved.
::------------------------------------------------------------------------------
::
:: Credits: CREDITS.TXT
:: License: LICENSE.TXT
:: 3rd Party License: <Bin\LICENSES>
::
::-------------------------------------------------------------------------------------------

color 1f
title MSMG Toolkit v11.1

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

setlocal EnableExtensions EnableDelayedExpansion

:: Setting Toolkit environment path variables
set "Bin=%~dp0Bin"
set "Custom=%~dp0Custom"
set "Drivers=%~dp0Drivers"
set "DVD=%~dp0DVD"
set "ISO=%~dp0ISO"
set "Logs=%~dp0Logs"
set "Mount=%~dp0Mount"
set "Packs=%~dp0Packs"
set "ROOT=%~dp0"
set "Temp=%~dp0Temp"
set "Updates=%~dp0Updates"
set "WHD=%~dp0WHD"

:: Setting Host OS version, architecture and language variables
for /f "tokens=4-5 delims=. " %%i in ('ver 2^>nul') do set "HostVersion=%%i.%%j"
If exist "%WinDir%\SysWOW64" set "HostArchitecture=x64"
If not exist "%WinDir%\SysWOW64" set "HostArchitecture=x86"
set HostLanguage=

:: Setting WADK tools environment path variables
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"

:: Setting Source OS variables
set SelectedSourceOS=
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"

:: Setting Source Image information variables
set ImageCount=
set ImageIndexNo=
set ImageArchitecture=
set ImageName=
set ImageDescription=
set ImageFlag=
set ImageEdition=
set ImageInstallationType=
set ImageDefaultLanguage=
set ImageMajorVersion=
set ImageMinorVersion=
set ImageBuild=
set ImageVersion=
set ImageServicePackBuild=
set ImageServicePackLevel=
set PackageBuild=
set PackageServicePackBuild=

:: Setting Toolkit's control flag variables
set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set IsRecoveryImageModified=
set IsDialogsEnabled=Yes
set IsLogsEnabled=Yes
set IsImageRegistryLoaded=No
set IsW7SP1CRUSelected=

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

:: Setting Toolkit's packs environment path variables
set "Apps=%Packs%\Apps"
set "Braille=%Packs%\Braille"
set "DaRT=%Packs%\DaRT"
set "Dedup=%Packs%\Dedup"
set "DirectX9c=%Packs%\DirectX9c"
set "EdgeClassic=%Packs%\EdgeBrowser"
set "EdgeChromium=%Packs%\EdgeChromium"
set "Games=%Packs%\Games"
set "IE11=%Packs%\IE11"
set "LanguagePacks=%Packs%\LanguagePacks"
set "MediaFeaturePack=%Packs%\MediaFeaturePack"
set "MMRC=%Packs%\MultimediaRestrictedCodecs"
set "NetFx35=%Packs%\NetFX35"
set "NetFx462=%Packs%\NetFX462"
set "NetFx48=%Packs%\NetFX48"
set "NET5=%Packs%\NET5"
set "OfficeUWP=%Packs%\OfficeUWP"
set "OpenSSH=%Packs%\OpenSSH"
set "PortableDevices=%Packs%\PortableDevices"
set "PowerShell7=%Packs%\PowerShell7"
set "RDP81=%Packs%\RDP81"
set "RSAT=%Packs%\RSAT"
set "Sidebar=%Packs%\Sidebar"
set "Skins=%Packs%\Skins"
set "SystemRestore=%Packs%\SystemRestore"
set "ThinPC=%Packs%\ThinPC"
set "UAP=%Packs%\UAP"
set "VCRuntime=%Packs%\VCRuntime"
set "Win32Calc=%Packs%\Win32Calc"
set "WinToGo=%Packs%\WinToGo"
set "WMF=%Packs%\WMF"
set "WSL=%Packs%\WSL"

:: Setting Toolkit's dependent tools environment path variables
set "Lists=%Bin%\Lists"
set "Patches=%Bin%\Patches"
set "ResourceHacker=%Bin%\ResourceHacker.exe"
set "ToolKitHelper=%Bin%\ToolKitHelper.exe"
set "W10EsdDecrypter=%Bin%\Dism++CUI.exe /ESDFile"
set "W81EsdDecrypter=%Bin%\esddecrypt.exe"
set "WimlibImagex=%Bin%\%HostArchitecture%\wimlib-imagex.exe"
set "XCopy=xcopy.exe /E /I /H /R /Y /J"
set "XMLs=%Bin%\XMLs"
set "W10CUFix=%Bin%\Patches\W10CUFix"
set "WMCGActTokens=%Bin%\Patches\WMCGActTokens.tpk"
set "Zip=%Bin%\%HostArchitecture%\7z.exe"

:: Setting Components status flags
set "C_AdobeFlashForWindows=+"
set "C_EdgeChromium=+"
set "C_InternetExplorer=+"
set "C_FirstLogonAnimation=+"
set "C_GameExplorer=+"
set "C_SnippingTool=+"
set "C_SpeechRecognition=+"
set "C_WindowsMediaPlayer=+"
set "C_WindowsPhotoViewer=+"
set "C_WinSAT=+"
set "C_AssignedAccess=+"
set "C_CEIP_SQM=+"
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=+"
set "C_HomeGroup=+"
set "C_MultiPointConnector=+"
set "C_RemoteAssistance=+"
set "C_DeviceLockdown=+"
set "C_EaseOfAccessThemes=+"
set "C_EasyTransfer=+"
set "C_FileHistory=+"
set "C_ManualSetup=+"
set "C_Paint=+"
set "C_SecurityCenter=+"
set "C_StepsRecorder=+"
set "C_SystemRestore=+"
set "C_WindowsBackup=+"
set "C_WindowsFirewall=+"
set "C_WindowsSubsystemForLinux=+"
set "C_WindowsToGo=+"
set "C_Wordpad=+"
set "C_AADBrokerPlugin=+"
set "C_AssignedAccessLockApp=+"
set "C_BioEnrollment=+"
set "C_CallingShellApp=+"
set "C_CBSPreview=+"
set "C_ContentDeliveryManager=+"
set "C_Cortana=+"
set "C_ECApp=+"
set "C_EdgeDevToolsClient=+"
set "C_Edge=+"
set "C_FileExplorer=+"
set "C_LockApp=+"
set "C_MapControl=+"
set "C_NarratorQuickStart=+"
set "C_OneDrive=+"
set "C_ParentalControls=+"
set "C_PeopleExperienceHost=+"
set "C_PPIProjection=+"
set "C_QuickAssist=+"
set "C_RetailDemoContent=+"
set "C_SecureAssessmentBrowser=+"
set "C_SettingSync=+"
set "C_SkypeORTC=+"
set "C_SmartScreen=+"
set "C_Win32WebViewHost=+"
set "C_WindowsDefender=+"
set "C_WindowsMixedReality=+"
set "C_WindowsReaderPDF=+"
set "C_XboxGameCallableUI=+"
set "C_3DViewer=+"
set "C_AdvertisingXaml=+"
set "C_Alarms=+"
set "C_BingWeather=+"
set "C_Calculator=+"
set "C_Camera=+"
set "C_CommunicationsApps=+"
set "C_DesktopAppInstaller=+"
set "C_FeedbackHub=+"
set "C_GetHelp=+"
set "C_Getstarted=+"
set "C_HEIFImageExtension=+"
set "C_Maps=+"
set "C_Messaging=+"
set "C_MixedRealityPortal=+"
set "C_OfficeHub=+"
set "C_OfficeOneNote=+"
set "C_OneConnect=+"
set "C_Paint3D=+"
set "C_People=+"
set "C_Photos=+"
set "C_Print3D=+"
set "C_ScreenSketch=+"
set "C_SkypeApp=+"
set "C_SolitaireCollection=+"
set "C_SoundRecorder=+"
set "C_StickyNotes=+"
set "C_VP9VideoExtensions=+"
set "C_WalletService=+"
set "C_WebMediaExtensions=+"
set "C_WebpImageExtensions=+"
set "C_WindowsStore=+"
set "C_XboxApp=+"
set "C_XboxIdentityProvider=+"
set "C_YourPhone=+"
set "C_ZuneMusic=+"
set "C_ZuneVideo=+"

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - EULA
::-------------------------------------------------------------------------------------------
cls

echo.===============================================================================
echo.########################## MSMG ToolKit - Ð­Òé ################################
echo.===============================================================================
echo.
echo.
echo. MSMG Toolkit »ù±¾ÉÏÊÇÃâ·Ñ¹¤¾ß£¬ÓÃÓÚÎª Windows ²Ù×÷ÏµÍ³Ìá¹©·þÎñ£¬×Ô¶¨Òå£¬Ìí¼Ó»ò
echo. É¾³ý¹¦ÄÜ²¿¼þºÍ×é¼þ£¬ÆôÓÃ»ò½ûÓÃ¹¦ÄÜ¡£
echo.
echo. MSMG Toolkit ½ö¿ÉÓÃÓÚÐí¿ÉµÄ Microsoft Windows ²Ù×÷ÏµÍ³¡£
echo.
echo. ´Ë MSMG Toolkit °´¡°Ô­Ñù¡±Ìá¹©£¬Ã»ÓÐÈÎºÎÃ÷Ê¾»ò°µÊ¾µÄ±£Ö¤¡£
echo. ÔÚÈÎºÎÇé¿öÏÂ£¬×÷Õß¾ù²»¶ÔÊ¹ÓÃ´Ë½Å±¾ÒýÆðµÄÈÎºÎËðÊ§¸ºÔð¡£
echo.
echo. MSMG Toolkit Ê¹ÓÃ¸÷ÖÖµÚÈý·½¹¤¾ßÀ´Íê³ÉÆäÄ³Ð©ÈÎÎñ¡£
echo. Windows µÄ MSMG ToolKit ÊÇÆä¸÷×Ô×÷Õß»ò¹«Ë¾µÄ×¢²áÉÌ±ê¡£
echo.
echo. ´óÑÛ×Ð~Ðñ ºº»¯·ÖÏí£¨Anan£©2020.12.30£¨www.dayanzai.me£©
echo. 
echo.
echo.                Äú¿ÉÒÔÍ¨¹ýÊäÈë A ½ÓÊÜ»òÕßÊäÈë R ¾Ü¾ø²¢ÍË³ö³ÌÐò
echo.
echo.===============================================================================
choice /C:AR /N /M "###########################[ 'A'½ÓÊÜ / 'R'¾Ü¾ø ]############################"
if errorlevel 2 (
	reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

	color 00
	endlocal EnableExtensions
	endlocal EnableDelayedExpansion

	exit
)

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Startup function
::-------------------------------------------------------------------------------------------
cls

echo.
echo.ÕýÔÚÖ´ÐÐ¹¤¾ß°üµÄÔ¤ÇåÀí²Ù×÷£¬ÇëÉÔºò...
call :Cleanup >nul
cls
echo.===============================================================================
echo.                           MSMG ToolKit - Æô¶¯
echo.===============================================================================
echo.
echo.¶ÁÈ¡Ö÷»ú²Ù×÷ÏµÍ³ÐÅÏ¢...
for /f "tokens=6 delims= " %%a in ('DISM /Online /English /Get-Intl ^| findstr /i /C:"Default system UI language"') do (set HostLanguage=%%a)
echo.
if "%HostArchitecture%" equ "x86" (
	if "%HostVersion%" equ "6.1" echo. - Microsoft Windows 7 ^(%HostArchitecture%^) [%HostLanguage%]
	if "%HostVersion%" equ "6.3" echo. - Microsoft Windows 8.1 ^(%HostArchitecture%^) [%HostLanguage%]
	if "%HostVersion%" equ "10.0" echo. - Microsoft Windows 10 ^(%HostArchitecture%^) [%HostLanguage%]
)

if "%HostArchitecture%" equ "x64" (
	if "%HostVersion%" equ "6.1" echo. - Microsoft Windows 7 / Server 2008 R2 ^(%HostArchitecture%^) [%HostLanguage%]
	if "%HostVersion%" equ "6.3" echo. - Microsoft Windows 8.1 / Server 2012 R2 ^(%HostArchitecture%^) [%HostLanguage%]
	if "%HostVersion%" equ "10.0" echo. - Microsoft Windows 10 / Server 2016/2019 ^(%HostArchitecture%^) [%HostLanguage%]
)

:: Setting DOS character codepage
if "%HostLanguage%" equ "en-GB" chcp 437 >nul
if "%HostLanguage%" equ "en-US" chcp 437 >nul
if "%HostLanguage%" equ "zh-CN" chcp 936 >nul

echo.
echo.ÉèÖÃ¹¤¾ß°üºÍ WADK ¹¤¾ß»·¾³Â·¾¶±äÁ¿...
echo.
echo.DISM.exe           =  %DISM%
call :CreateFolder "%DismScratch%"
set "DISM=%DISM% %DismFormat%"
echo.Imagex.exe         =  %Imagex%
echo.Oscdimg.exe        =  %Oscdimg%
echo.Dvdburn.exe        =  %Dvdburn%
echo.7zip.exe           =  %Zip%
echo.Dism++CUI.exe      =  %W10EsdDecrypter%
echo.EsdDecrypt.exe     =  %W81EsdDecrypter%
echo.ToolKitHelper.exe  =  %ToolKitHelper%
echo.ResourceHacker.exe =  %ResourceHacker%
echo.WimlibImagex.exe   =  %WimlibImagex%
echo.
echo.===============================================================================
echo.
pause
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Main Menu
::-------------------------------------------------------------------------------------------
:MainMenu

cls
echo.===============================================================================
echo.                           MSMG ToolKit - Ö÷²Ëµ¥
echo.===============================================================================
echo.
echo.                             [1]   À´  Ô´
echo.
echo.                             [2]   ¼¯  ³É
echo.
echo.                             [3]   ÒÆ  ³ý
echo.
echo.                             [4]   ×Ô¶¨Òå
echo.
echo.                             [5]   Ó¦  ÓÃ
echo.
echo.                             [6]   Ä¿  ±ê
echo.
echo.                             [7]   ¹¤  ¾ß
echo.
echo.
echo.                             [X]   ÍË  ³ö
echo.
echo.===============================================================================
echo.
choice /C:1234567X /N /M "ÊäÈëÄúµÄÑ¡Ôñ: "
if errorlevel 8 goto :Quit
if errorlevel 7 goto :ToolsMenu
if errorlevel 6 goto :TargetMenu
if errorlevel 5 goto :ApplyMenu
if errorlevel 4 goto :CustomizeMenu
if errorlevel 3 goto :RemoveMenu
if errorlevel 2 goto :IntegrateMenu
if errorlevel 1 goto :SourceMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Select Source Menu
::-------------------------------------------------------------------------------------------
:SourceMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - À´Ô´²Ëµ¥
echo.===============================================================================
echo.

:: Checking whether Source OS is selected
if "%IsSourceSelected%" equ "Yes" (
	echo.ÒÑÑ¡ÔñÔ´²Ù×÷ÏµÍ³...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.À´Ô´²Ù×÷ÏµÍ³Ó³Ïñ×¢²á±íÒÑ¼ÓÔØ£¬ÇëÊ¹ÓÃ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±Ð¶ÔØËü¡£
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   ´Ó ^<DVD^> ÎÄ¼þ¼ÐÑ¡ÔñÀ´Ô´
echo.
echo.  [2]   ´Ó DVD Çý¶¯Æ÷¸´ÖÆÀ´Ô´
echo.
echo.  [3]   ´Ó DVD ISO Ó³ÏñÌáÈ¡À´Ô´
echo.
echo.  [4]   ´Ó OEM IMG Ó³ÏñÌáÈ¡À´Ô´
echo.
echo.  [5]   ´Ó  Store ESD Ó³ÏñÌáÈ¡À´Ô´
echo.
echo.  [6]   ´Ó Media Creation Tool Ó³ÏñÌáÈ¡À´Ô´
echo.
echo.  [7]   ´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÌáÈ¡À´Ô´
echo.
echo.
echo.  [X]   ·µ»Ø
echo.
echo.===============================================================================
echo.
choice /C:1234567X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
if errorlevel 8 goto :MainMenu
if errorlevel 7 goto :ExtractSourceESD
if errorlevel 6 goto :ExtractSourceMCT
if errorlevel 5 goto :ExtractSourceStoreESD
if errorlevel 4 goto :ExtractSourceIMG
if errorlevel 3 goto :ExtractSourceISO
if errorlevel 2 goto :CopySourceDVD
if errorlevel 1 goto :SelectSourceDVD
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Menu
::-------------------------------------------------------------------------------------------
:IntegrateMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - ¼¯³É²Ëµ¥
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceSelected%" equ "No" (
	echo.Î´Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°À´Ô´¡±²Ëµ¥ÖÐÑ¡ÔñÔ´¡£
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.À´Ô´²Ù×÷ÏµÍ³Ó³Ïñ×¢²á±íÒÑ¼ÓÔØ£¬ÇëÊ¹ÓÃ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±Ð¶ÔØËü¡£
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   Windows ÓïÑÔ°ü
echo.
echo.  [2]   Windows Çý¶¯³ÌÐò
echo.
echo.  [3]   Windows ¹¦ÄÜ
echo.
echo.  [4]   Windows ¸üÐÂ
echo.
echo.  [5]   Windows ×Ô¶¨Òå¹¦ÄÜ
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   ·µ»Ø
echo.
echo.===============================================================================
echo.
choice /C:12345X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
if errorlevel 6 goto :MainMenu
if errorlevel 5 goto :IntCustomFeatures
if errorlevel 4 goto :IntUpdatesMenu
if errorlevel 3 goto :IntFeatures
if errorlevel 2 goto :IntDrivers
if errorlevel 1 goto :IntLanguagePacks
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Windows Features Menu
::-------------------------------------------------------------------------------------------
:IntFeatures

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¼¯³É Windows ¹¦ÄÜ²Ëµ¥
echo.===============================================================================

:: Checking whether the selected Source OS is a Windows 7 Client
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [F]   Windows Media Feature Pack
	echo.  [G]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [H]   Windows PowerShell 7.1 ^| Depends on Windows Management Framework 5.1
	echo.  [I]   Remote Server Administration Tool ^(RSAT^)
	echo.  [J]   Microsoft DaRT 7.0 Tools
	echo.  [K]   Microsoft DirectX 9.0c
	echo.  [L]   Microsoft Games
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntGames
	if errorlevel 11 goto :IntDirectX9c
	if errorlevel 10 goto :IntDaRT
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntWMF
	if errorlevel 6  goto :IntMediaFeaturePack
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows 7 Embedded Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [G]   Windows PowerShell 7.1 ^| Depends on Windows Management Framework 5.1
	echo.  [H]   Windows Thin PC ¸½¼Ó¹¦ÄÜ
	echo.  [I]   Microsoft DaRT 7.0 Tools
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft Games
	echo.  [L]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 13 goto :IntegrateMenu
	if errorlevel 12 goto :IntVCRuntime
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntThinPcPkgs
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows Server 2008 R2 Core Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [G]   Windows PowerShell 7.1 ^| Depends on Windows Management Framework 5.1
	echo.  [H]   Microsoft DaRT 7.0 Tools
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Games
	echo.  [K]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 12 goto :IntegrateMenu
	if errorlevel 11 goto :IntVCRuntime
	if errorlevel 10 goto :IntGames
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows Server 2008 R2
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 4.8
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Internet Explorer 11
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1 ^| Depends on .NET Framework 4.8
	echo.  [G]   Windows PowerShell 7.1 ^| Depends on Windows Management Framework 5.1
	echo.  [H]   Windows System Restore
	echo.  [I]   Microsoft DaRT 7.0 Tools
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft Games
	echo.  [L]   Windows Sidebar
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntSidebar
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntSystemRestore
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntRDP81
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntIE11
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX48
)

:: Checking whether the selected Source OS is a 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 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	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 :IntMetroApps
	if errorlevel 1 goto :IntNetFX48
)

:: Checking whether the selected Source OS is a Windows 8.1 32-Bit
if "%SelectedSourceOS%" equ "w81" if "%ImageArchitecture%" equ "x86" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Windows To Go Workspace
	echo.  [F]   Windows Media Feature Pack
	echo.  [G]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [H]   Windows Management Framework ^(WMF^) 5.1
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft DaRT 8.1 Tools
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft Games
	echo.  [N]   Windows Sidebar
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10  goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntWMF
	if errorlevel 7  goto :IntMetroApps
	if errorlevel 6  goto :IntMediaFeaturePack
	if errorlevel 5  goto :IntWinToGo
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 8.1 64-Bit Non-Server
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" neq "Server" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Windows Data Deduplication
	echo.  [F]   Windows To Go Workspace
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [I]   Windows Management Framework ^(WMF^) 5.1
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Remote Server Administration Tool ^(RSAT^)
	echo.  [L]   Microsoft DaRT 8.1 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWMF
	if errorlevel 8  goto :IntMetroApps
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntDedup
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Core Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Windows Management Framework ^(WMF^) 5.1
	echo.  [E]   Windows PowerShell 7.1
	echo.  [F]   Microsoft DaRT 8.1 Tools
	echo.  [G]   Microsoft DirectX 9.0c
	echo.  [H]   Microsoft Games
	echo.  [I]   Microsoft Visual C++ Runtime
	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 :IntVCRuntime
	if errorlevel 8  goto :IntGames
	if errorlevel 7  goto :IntDirectX9c
	if errorlevel 6  goto :IntDaRT
	if errorlevel 5  goto :IntPowerShell7
	if errorlevel 4  goto :IntWMF
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [F]   Windows Management Framework ^(WMF^) 5.1
	echo.  [G]   Windows PowerShell 7.1
	echo.  [H]   Microsoft DaRT 8.1 Tools
	echo.  [I]   Microsoft DirectX 9.0c
	echo.  [J]   Microsoft Games
	echo.  [K]   Windows Sidebar
	echo.  [L]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 13 goto :IntegrateMenu
	if errorlevel 12 goto :IntVCRuntime
	if errorlevel 11 goto :IntSidebar
	if errorlevel 10 goto :IntGames
	if errorlevel 9  goto :IntDirectX9c
	if errorlevel 8  goto :IntDaRT
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWMF
	if errorlevel 5  goto :IntMetroApps
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1507 Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft Edge Classic Browser
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows To Go Workspace
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Windows PowerShell 7.1
	echo.  [I]   Remote Server Administration Tool ^(RSAT^)
	echo.  [J]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [K]   Microsoft DaRT 10.0 Tools
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft Games
	echo.  [N]   Windows Sidebar ^| Depends on: Windows Mail App
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntMetroApps
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1511 32-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageArchitecture%" equ "x86" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows To Go Workspace
	echo.  [F]   Windows Media Feature Pack
	echo.  [G]   Windows PowerShell 7.1
	echo.  [H]   Remote Server Administration Tool ^(RSAT^)
	echo.  [I]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [J]   Microsoft DaRT 10.0 Tools
	echo.  [K]   Microsoft DirectX 9.0c
	echo.  [L]   Microsoft Games
	echo.  [M]   Windows Sidebar
	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 :IntMetroApps
	if errorlevel 8  goto :IntRSAT
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntMediaFeaturePack
	if errorlevel 5  goto :IntWinToGo
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 32-Bit Client Enterprise LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 32-Bit Client Enterprise N LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 32-Bit Client Non Enterprise (N) LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows To Go Workspace
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Windows PowerShell 7.1
	echo.  [I]   Remote Server Administration Tool ^(RSAT^)
	echo.  [J]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [K]   Microsoft DaRT 10.0 Tools
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft Games
	echo.  [N]   Windows Sidebar
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntMetroApps
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1703 32-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageArchitecture%" equ "x86" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1709 32-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageArchitecture%" equ "x86" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [L]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [M]   Microsoft DaRT 10.0 Tools
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft Games
	echo.  [P]   Windows Sidebar
	echo.  [Q]   Microsoft Visual C++ Runtime
	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 :IntMetroApps
	if errorlevel 11 goto :IntOpenSSH
	if errorlevel 10  goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1803 32-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageArchitecture%" equ "x86" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [L]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [M]   Microsoft Office Desktop UWP Apps
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntOfficeUWPApps
	if errorlevel 12 goto :IntMetroApps
	if errorlevel 11 goto :IntOpenSSH
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 32-Bit Client Enterprise LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows Accessibility Braille
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows Portable Devices
	echo.  [K]   Windows PowerShell 7.1
	echo.  [L]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [M]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [N]   Microsoft Office Desktop UWP Apps
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOfficeUWPApps
	if errorlevel 13 goto :IntMetroApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntPortableDevices
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 32-Bit Client Enterprise N LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ 17763 if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows Accessibility Braille
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows Portable Devices
	echo.  [K]   Windows PowerShell 7.1
	echo.  [L]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [M]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [N]   Microsoft Office Desktop UWP Apps
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOfficeUWPApps
	if errorlevel 13 goto :IntMetroApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntPortableDevices
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 32-Bit Client Non Enterprise (N) LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows Portable Devices
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [L]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [M]   Microsoft Office Desktop UWP Apps
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntOfficeUWPApps
	if errorlevel 12 goto :IntMetroApps
	if errorlevel 11 goto :IntOpenSSH
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntPortableDevices
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1903/v1909 32-Bit Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows Accessibility Braille
	echo.  [F]   Windows To Go Workspace
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Windows Portable Devices
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft Office Desktop UWP Apps
	echo.  [M]   Microsoft DaRT 10.0 Tools
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft Games
	echo.  [P]   Windows Sidebar
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntOfficeUWPApps
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntOpenSSH
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntPortableDevices
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v2004/v20H2 32-Bit Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x86" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows Accessibility Braille
	echo.  [F]   Windows Media Feature Pack
	echo.  [G]   Windows Portable Devices
	echo.  [H]   Windows PowerShell 7.1
	echo.  [I]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [J]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [K]   Microsoft Office Desktop UWP Apps
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntOfficeUWPApps
	if errorlevel 10 goto :IntMetroApps
	if errorlevel 9  goto :IntOpenSSH
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntPortableDevices
	if errorlevel 6  goto :IntMediaFeaturePack
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1511 64-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.6.2
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows Data Deduplication
	echo.  [F]   Windows To Go Workspace
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Windows PowerShell 7.1
	echo.  [I]   Remote Server Administration Tool ^(RSAT^)
	echo.  [J]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [K]   Microsoft DaRT 10.0 Tools
	echo.  [L]   Microsoft DirectX 9.0c
	echo.  [M]   Microsoft Games
	echo.  [N]   Windows Sidebar
	echo.  [O]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 16 goto :IntegrateMenu
	if errorlevel 15 goto :IntVCRuntime
	if errorlevel 14 goto :IntSidebar
	if errorlevel 13 goto :IntGames
	if errorlevel 12 goto :IntDirectX9c
	if errorlevel 11 goto :IntDaRT
	if errorlevel 10 goto :IntMetroApps
	if errorlevel 9  goto :IntRSAT
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntWinToGo
	if errorlevel 5  goto :IntDedup
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNetFX462
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 64-Bit Client Enterprise LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Windows Data Deduplication
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 64-Bit Client Enterprise N LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Windows Data Deduplication
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1607 64-Bit Client Non Enterprise (N) LTSB 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Windows Data Deduplication
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Remote Server Administration Tool ^(RSAT^)
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntRSAT
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1703 64-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows Data Deduplication
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Remote Server Administration Tool ^(RSAT^)
	echo.  [L]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [M]   Microsoft DaRT 10.0 Tools
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft Games
	echo.  [P]   Windows Sidebar
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntMetroApps
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1709 64-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows Data Deduplication
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Remote Server Administration Tool ^(RSAT^)
	echo.  [L]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [M]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntMetroApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1803 64-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows Data Deduplication
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Remote Server Administration Tool ^(RSAT^)
	echo.  [L]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [M]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [N]   Microsoft Office Desktop UWP Apps
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOfficeUWPApps
	if errorlevel 13 goto :IntMetroApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntRSAT
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 64-Bit Client Enterprise LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows Accessibility Braille
	echo.  [H]   Windows Data Deduplication
	echo.  [I]   Windows To Go Workspace
	echo.  [J]   Windows Media Feature Pack
	echo.  [K]   Windows Portable Devices
	echo.  [L]   Windows PowerShell 7.1
	echo.  [M]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [N]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [O]   Microsoft Office Desktop UWP Apps
	echo.  [P]   Microsoft DaRT 10.0 Tools
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft Games
	echo.  [S]   Windows Sidebar
	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 :IntOfficeUWPApps
	if errorlevel 14 goto :IntMetroApps
	if errorlevel 13 goto :IntOpenSSH
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntPortableDevices
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntDedup
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 64-Bit Client Enterprise N LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Microsoft Win32 Calculator
	echo.  [G]   Windows Accessibility Braille
	echo.  [H]   Windows Data Deduplication
	echo.  [I]   Windows To Go Workspace
	echo.  [J]   Windows Media Feature Pack
	echo.  [K]   Windows Portable Devices
	echo.  [L]   Windows PowerShell 7.1
	echo.  [M]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [N]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [O]   Microsoft Office Desktop UWP Apps
	echo.  [P]   Microsoft DaRT 10.0 Tools
	echo.  [Q]   Microsoft DirectX 9.0c
	echo.  [R]   Microsoft Games
	echo.  [S]   Windows Sidebar
	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 :IntOfficeUWPApps
	if errorlevel 14 goto :IntMetroApps
	if errorlevel 13 goto :IntOpenSSH
	if errorlevel 12 goto :IntPowerShell7
	if errorlevel 11 goto :IntPortableDevices
	if errorlevel 10 goto :IntMediaFeaturePack
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntDedup
	if errorlevel 7  goto :IntBraille
	if errorlevel 6  goto :IntWin32Calc
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1809 64-Bit Client Non Enterprise (N) LTSC 2019 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Microsoft Win32 Calculator
	echo.  [F]   Windows Accessibility Braille
	echo.  [G]   Windows Data Deduplication
	echo.  [H]   Windows To Go Workspace
	echo.  [I]   Windows Media Feature Pack
	echo.  [J]   Windows Portable Devices
	echo.  [K]   Windows PowerShell 7.1
	echo.  [L]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [M]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [N]   Microsoft Office Desktop UWP Apps
	echo.  [O]   Microsoft DaRT 10.0 Tools
	echo.  [P]   Microsoft DirectX 9.0c
	echo.  [Q]   Microsoft Games
	echo.  [R]   Windows Sidebar
	echo.  [S]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRSX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 20 goto :IntegrateMenu
	if errorlevel 19 goto :IntVCRuntime
	if errorlevel 18 goto :IntSidebar
	if errorlevel 17 goto :IntGames
	if errorlevel 16 goto :IntDirectX9c
	if errorlevel 15 goto :IntDaRT
	if errorlevel 14 goto :IntOfficeUWPApps
	if errorlevel 13 goto :IntMetroApps
	if errorlevel 12 goto :IntOpenSSH
	if errorlevel 11 goto :IntPowerShell7
	if errorlevel 10 goto :IntPortableDevices
	if errorlevel 9  goto :IntMediaFeaturePack
	if errorlevel 8  goto :IntWinToGo
	if errorlevel 7  goto :IntDedup
	if errorlevel 6  goto :IntBraille
	if errorlevel 5  goto :IntWin32Calc
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1903/v1909 64-Bit Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows Accessibility Braille
	echo.  [F]   Windows Data Deduplication
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows Media Feature Pack
	echo.  [I]   Windows Portable Devices
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [L]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [M]   Microsoft Office Desktop UWP Apps
	echo.  [N]   Microsoft DaRT 10.0 Tools
	echo.  [O]   Microsoft DirectX 9.0c
	echo.  [P]   Microsoft Games
	echo.  [Q]   Windows Sidebar
	echo.  [R]   Microsoft Visual C++ Runtime
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQRX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 19 goto :IntegrateMenu
	if errorlevel 18 goto :IntVCRuntime
	if errorlevel 17 goto :IntSidebar
	if errorlevel 16 goto :IntGames
	if errorlevel 15 goto :IntDirectX9c
	if errorlevel 14 goto :IntDaRT
	if errorlevel 13 goto :IntOfficeUWPApps
	if errorlevel 12 goto :IntMetroApps
	if errorlevel 11 goto :IntOpenSSH
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntPortableDevices
	if errorlevel 8  goto :IntMediaFeaturePack
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v2004/v20H2 64-Bit Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageInstallationType%" equ "Client" if "%ImageArchitecture%" equ "x64" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Chromium Browser
	echo.  [D]   Microsoft Win32 Calculator
	echo.  [E]   Windows Accessibility Braille
	echo.  [F]   Windows Data Deduplication
	echo.  [G]   Windows Media Feature Pack
	echo.  [H]   Windows Portable Devices
	echo.  [I]   Windows PowerShell 7.1
	echo.  [J]   Open Secure Shell ^(SSH^) Client ^& Server
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft Office Desktop UWP Apps
	echo.  [M]   Microsoft DaRT 10.0 Tools
	echo.  [N]   Microsoft DirectX 9.0c
	echo.  [O]   Microsoft Games
	echo.  [P]   Windows Sidebar
	echo.  [Q]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	choice /C:ABCDEFGHIJKLMNOPQX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 18 goto :IntegrateMenu
	if errorlevel 17 goto :IntVCRuntime
	if errorlevel 16 goto :IntSidebar
	if errorlevel 15 goto :IntGames
	if errorlevel 14 goto :IntDirectX9c
	if errorlevel 13 goto :IntDaRT
	if errorlevel 12 goto :IntOfficeUWPApps
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntOpenSSH
	if errorlevel 9  goto :IntPowerShell7
	if errorlevel 8  goto :IntPortableDevices
	if errorlevel 7  goto :IntMediaFeaturePack
	if errorlevel 6  goto :IntDedup
	if errorlevel 5  goto :IntBraille
	if errorlevel 4  goto :IntWin32Calc
	if errorlevel 3  goto :IntEdgeChromium
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows 10 v1803/v1809/v1903/v1909 ARM64-Bit Client
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17134" if "%ImageArchitecture%" equ "arm64" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET 5
	echo.
	echo.  [3]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [4]   Microsoft Office Desktop UWP Apps
	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 :IntOfficeUWPApps
	if errorlevel 3 goto :IntMetroApps
	if errorlevel 2 goto :IntNET5
	if errorlevel 1 goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2016 Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET Framework 4.8
	echo.
	echo.  [3]   Microsoft .NET 5
	echo.
	echo.  [4]   Windows PowerShell 7.1
	echo.
	echo.  [5]   Windows Subsystem for Linux ^(WSL^)
	echo.
	echo.  [6]   Microsoft DaRT 10.0 Tools
	echo.
	echo.  [7]   Microsoft DirectX 9.0c
	echo.
	echo.  [8]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntVCRuntime
	if errorlevel 7 goto :IntDirectX9c
	if errorlevel 6 goto :IntDaRT
	if errorlevel 5 goto :IntWSL
	if errorlevel 4 goto :IntPowerShell7
	if errorlevel 3 goto :IntNET5
	if errorlevel 2 goto :IntNetFX48
	if errorlevel 1 goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server 2016
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType%" equ "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Windows Multimedia Restricted Codecs
	echo.  [G]   Windows System Restore
	echo.  [H]   Windows Subsystem for Linux ^(WSL^)
	echo.  [I]   Windows To Go Workspace
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntWSL
	if errorlevel 7  goto :IntSystemRestore
	if errorlevel 6  goto :IntMMRC
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v1709/v1803/Server 2019/v1809 Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server Core" (
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET Framework 4.8
	echo.
	echo.  [3]   Microsoft .NET 5
	echo.
	echo.  [4]   Windows PowerShell 7.1
	echo.
	echo.  [5]   Windows Subsystem for Linux ^(WSL^)
	echo.
	echo.  [6]   Microsoft DaRT 10.0 Tools
	echo.
	echo.  [7]   Microsoft DirectX 9.0c
	echo.
	echo.  [8]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntVCRuntime
	if errorlevel 7 goto :IntDirectX9c
	if errorlevel 6 goto :IntDaRT
	if errorlevel 5 goto :IntWSL
	if errorlevel 4 goto :IntPowerShell7
	if errorlevel 3 goto :IntNET5
	if errorlevel 2 goto :IntNetFX48
	if errorlevel 1 goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v1709/v1803/Server 2019/v1809
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if "%ImageBuild%" leq "17763" if "%ImageInstallationType%" equ "Server" (
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET Framework 4.8
	echo.  [C]   Microsoft .NET 5
	echo.  [D]   Microsoft Edge Classic Browser
	echo.  [E]   Microsoft Edge Chromium Browser
	echo.  [F]   Windows Multimedia Restricted Codecs
	echo.  [G]   Windows System Restore
	echo.  [H]   Windows Subsystem for Linux ^(WSL^)
	echo.  [I]   Windows To Go Workspace
	echo.  [J]   Windows PowerShell 7.1
	echo.  [K]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [L]   Microsoft DaRT 10.0 Tools
	echo.  [M]   Microsoft DirectX 9.0c
	echo.  [N]   Microsoft Games
	echo.  [O]   Windows Sidebar
	echo.  [P]   Microsoft Visual C++ Runtime
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 17 goto :IntegrateMenu
	if errorlevel 16 goto :IntVCRuntime
	if errorlevel 15 goto :IntSidebar
	if errorlevel 14 goto :IntGames
	if errorlevel 13 goto :IntDirectX9c
	if errorlevel 12 goto :IntDaRT
	if errorlevel 11 goto :IntMetroApps
	if errorlevel 10 goto :IntPowerShell7
	if errorlevel 9  goto :IntWinToGo
	if errorlevel 8  goto :IntWSL
	if errorlevel 7  goto :IntSystemRestore
	if errorlevel 6  goto :IntMMRC
	if errorlevel 5  goto :IntEdgeChromium
	if errorlevel 4  goto :IntEdgeClassic
	if errorlevel 3  goto :IntNET5
	if errorlevel 2  goto :IntNetFX48
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v1903/v1909 Core Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft .NET Framework 3.5
	echo.
	echo.  [2]   Microsoft .NET 5
	echo.
	echo.  [3]   Windows PowerShell 7.1
	echo.
	echo.  [4]   Windows Subsystem for Linux ^(WSL^)
	echo.
	echo.  [5]   Microsoft DaRT 10.0 Tools
	echo.
	echo.  [6]   Microsoft DirectX 9.0c
	echo.
	echo.  [7]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 8 goto :IntegrateMenu
	if errorlevel 7 goto :IntVCRuntime
	if errorlevel 6 goto :IntDirectX9c
	if errorlevel 5 goto :IntDaRT
	if errorlevel 4 goto :IntWSL
	if errorlevel 3 goto :IntPowerShell7
	if errorlevel 2 goto :IntNET5
	if errorlevel 1 goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v1903/v1909
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Classic Browser
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Windows Multimedia Restricted Codecs
	echo.  [F]   Windows Subsystem for Linux ^(WSL^)
	echo.  [G]   Windows To Go Workspace
	echo.  [H]   Windows PowerShell 7.1
	echo.  [I]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [J]   Microsoft DaRT 10.0 Tools
	echo.  [K]   Microsoft DirectX 9.0c
	echo.  [L]   Microsoft Games
	echo.  [M]   Windows Sidebar
	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 :IntMetroApps
	if errorlevel 8  goto :IntPowerShell7
	if errorlevel 7  goto :IntWinToGo
	if errorlevel 6  goto :IntWSL
	if errorlevel 5  goto :IntMMRC
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)

:: Checking whether the selected Source OS is a Windows Server v2004/v20H2
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageInstallationType%" equ "Server" (
	echo.
	echo.  [A]   Microsoft .NET Framework 3.5
	echo.  [B]   Microsoft .NET 5
	echo.  [C]   Microsoft Edge Classic Browser
	echo.  [D]   Microsoft Edge Chromium Browser
	echo.  [E]   Windows Multimedia Restricted Codecs
	echo.  [F]   Windows Subsystem for Linux ^(WSL^)
	echo.  [G]   Windows PowerShell 7.1
	echo.  [H]   Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
	echo.  [I]   Microsoft DaRT 10.0 Tools
	echo.  [J]   Microsoft DirectX 9.0c
	echo.  [K]   Microsoft Games
	echo.  [L]   Windows Sidebar
	echo.  [M]   Microsoft Visual C++ Runtime
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 14 goto :IntegrateMenu
	if errorlevel 13 goto :IntVCRuntime
	if errorlevel 12 goto :IntSidebar
	if errorlevel 11 goto :IntGames
	if errorlevel 10 goto :IntDirectX9c
	if errorlevel 9  goto :IntDaRT
	if errorlevel 8  goto :IntMetroApps
	if errorlevel 7  goto :IntPowerShell7
	if errorlevel 6  goto :IntWSL
	if errorlevel 5  goto :IntMMRC
	if errorlevel 4  goto :IntEdgeChromium
	if errorlevel 3  goto :IntEdgeClassic
	if errorlevel 2  goto :IntNET5
	if errorlevel 1  goto :IntNetFX35
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Integrate Windows Custom Features Menu
::-------------------------------------------------------------------------------------------
:IntCustomFeatures

cls
echo.===============================================================================
echo.            MSMG ToolKit - ¼¯³É Windows ×Ô¶¨Òå¹¦ÄÜ²Ëµ¥
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.            MSMG ToolKit - ¼¯³É Windows ×Ô¶¨Òå¹¦ÄÜ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                ¾¯         ¸æ
	echo.                                =============
	echo.
	echo.   ¼¯³É Windows ×Ô¶¨Òå¹¦ÄÜÉæ¼°ÐÞ²¹ÏµÍ³ÎÄ¼þ£¬Òò´Ë SFC ¿ÉÒÔ±¨¸æÓÐ¹Ø Windows Ïµ
	echo.   Í³ÎÄ¼þËð»µµÄÇé¿ö£¬ÕâºÜÕý³£¡£
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.   Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "Do You ÏëÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.            MSMG ToolKit - ¼¯³É Windows ×Ô¶¨Òå¹¦ÄÜ²Ëµ¥
echo.===============================================================================
:: Checking whether the selected Source OS is a Windows 7 Client/Server 2008 R2 Non-Core Edition
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.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 6 goto :IntegrateMenu
	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
)

:: Checking whether the selected Source OS is a Windows 7 Embedded Edition
if "%selectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Embedded" (
	echo.
	echo.  [1]   Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
	echo.
	echo.  [2]   ×Ô¶¨ÒåÖ÷Ìâ UxTheme ²¹¶¡
	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 :IntCustomFiles
	if errorlevel 3 goto :IntUAP
	if errorlevel 2 goto :IntCustomUxTheme
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows Server 2008 Core Edition
if "%selectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
	echo.
	echo.  [2]   ×Ô¶¨Òå Windows »Ö¸´»·¾³ ^(WinRE^)
	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 :IntegrateMenu
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 8.1 Client Non-Professioanl WMC/Server 2012 R2 Non-Core Edition
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.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:123456X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 7 goto :IntegrateMenu
	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
)

:: Checking whether the selected Source OS is a Windows 8.1 Professioanl WMC Edition
if "%selectedSourceOS%" equ "w81" if "%ImageEdition%" equ "ProfessionalWMC" (
	echo.
	echo.  [1]   Windows 8.1 Ã½ÌåÖÐÐÄÍ¨ÓÃ¼¤»îÁîÅÆ
	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.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 8 goto :IntegrateMenu
	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
)

:: Checking whether the selected Source OS is a Windows Server 2012 R2 Core Edition
if "%selectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
	echo.
	echo.  [2]   ×Ô¶¨Òå Windows »Ö¸´»·¾³ ^(WinRE^)
	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 :IntegrateMenu
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows Server Core Edition
if "%selectedSourceOS%" equ "w10" if "%ImageInstallationType%" equ "Server Core" (
	echo.
	echo.  [1]   Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
	echo.
	echo.  [2]   ×Ô¶¨Òå Windows »Ö¸´»·¾³ ^(WinRE^)
	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 :IntegrateMenu
	if errorlevel 3 goto :IntCustomFiles
	if errorlevel 2 goto :IntCustomRecoveryImage
	if errorlevel 1 goto :IntCustomTerminalServer
)

:: Checking whether the selected Source OS is a Windows 10 Client/Server Non-Core Edition
if "%selectedSourceOS%" equ "w10" if "%ImageInstallationType%" neq "Server Core" (
	echo.  [1]   Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
	echo.
	echo.  [2]   ×Ô¶¨ÒåÖ÷Ìâ UxTheme ²¹¶¡
	echo.
	echo.  [3]   ×Ô¶¨Òå Windows »Ö¸´»·¾³ ^(WinRE^)
	echo.
	echo.  [4]   ×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬
	echo.
	echo.  [5]   ×Ô¶¨ÒåÏµÍ³ÎÄ¼þ
	echo.
	echo.  [6]   Microsoft Win32Calc Metro Æ¤·ô
	echo.
	echo.  [7]   Windows Photo Viewer Metro Æ¤·ô
	echo.
	echo.  [8]   Windows Media Player Metro Æ¤·ô
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:12345678X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 9 goto :IntegrateMenu
	if errorlevel 8 goto :IntWMPMetroSkin
	if errorlevel 7 goto :IntWPVMetroSkin
	if errorlevel 6 goto :IntWin32CalcMetroSkin
	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 Toolkit - Remove Menu
::-------------------------------------------------------------------------------------------
:RemoveMenu

cls
echo.===============================================================================
echo.                          MSMG ToolKit - ÒÆ³ý²Ëµ¥
echo.===============================================================================
echo.

:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Î´Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°À´Ô´¡±²Ëµ¥ÖÐÑ¡ÔñÔ´¡£
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.À´Ô´²Ù×÷ÏµÍ³Ó³Ïñ×¢²á±íÒÑ¼ÓÔØ£¬ÇëÊ¹ÓÃ¹¤¾ß-^>Ñ¡ÏîÐ¶ÔØËü¡£
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether the selected Source OS is Windows 7 Source OS
if "%selectedSourceOS%" equ "w7" (
	echo.  [1]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 8.1 Source OS
if "%selectedSourceOS%" equ "w81" (
	echo.  [1]   Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [2]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 Enterprise 2015/2016 LTSB Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 Enterprise N 2015/2016 LTSB Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17134" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 Client Edition
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.
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise 2019 LTSC Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	echo.  [1]   É¾³ý Windows ×é¼þ
	echo.
	echo.  [2]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N 2019 LTSC Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	echo.  [1]   É¾³ý Windows ×é¼þ
	echo.
	echo.  [2]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Client Non-EnterpriseS/EnterpriseSN Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	echo.  [1]   É¾³ý Windows ×é¼þ
	echo.
	echo.  [2]   Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [3]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   É¾³ý Windows ×é¼þ
	echo.
	echo.  [2]   Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [3]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   É¾³ý Windows ×é¼þ
	echo.
	echo.  [2]   Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [3]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" gtr "19042" if "%ImageInstallationType%" equ "Client" (
	echo.  [1]   Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [2]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.
	echo.
	echo.
	echo.
)

:: Checking whether the selected Source OS is a Windows Server Edition
if "%selectedSourceOS%" equ "w10" 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.
:: Checking whether the selected Source OS is Windows 7 Source OS
if "%selectedSourceOS%" equ "w7" (
	choice /C:1X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)

:: Checking whether the selected Source OS is Windows 8.1 Source OS
if "%selectedSourceOS%" equ "w81" (
	choice /C:12X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: Checking whether the selected Source OS is Windows 10 Enterprise 2015/2016 LTSB Edition
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
)

:: Checking whether the selected Source OS is Windows 10 Enterprise N 2015/2016 LTSB Edition
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
)

:: Checking whether the selected Source OS is Windows 10 v1507/v1511/v1607/v1703/v1709/v1803 Client Edition
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
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise 2019 LTSC Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	choice /C:12X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N 2019 LTSC Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	choice /C:12X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Client Non-EnterpriseS/EnterpriseSN Edition
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Client" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	choice /C:123X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" if "%ImageInstallationType%" equ "Client" (
	choice /C:123X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageInstallationType%" equ "Client" (
	choice /C:123X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 4 goto :MainMenu
	if errorlevel 3 goto :RemoveWindowsComponentsList
	if errorlevel 2 goto :RemoveWindowsAppsList
	if errorlevel 1 goto :RemoveWindowsComponentsMenu
)

:: Checking whether the selected Source OS is a Windows 10 Client
if "%selectedSourceOS%" equ "w10" if "%ImageBuild%" gtr "19042" if "%ImageInstallationType%" equ "Client" (
	choice /C:12X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :RemoveWindowsComponentsList
	if errorlevel 1 goto :RemoveWindowsAppsList
)

:: Checking whether the selected Source OS is a Windows Server Edition
if "%selectedSourceOS%" equ "w10" if "%ImageInstallationType:~,6%" equ "Server" (
	choice /C:1X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 2 goto :MainMenu
	if errorlevel 1 goto :RemoveWindowsComponentsList
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Customize Menu
::-------------------------------------------------------------------------------------------
:CustomizeMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - ×Ô¶¨Òå²Ëµ¥
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Î´Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°À´Ô´¡±²Ëµ¥ÖÐÑ¡ÔñÔ´..
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.À´Ô´²Ù×÷ÏµÍ³Ó³Ïñ×¢²á±íÒÑ¼ÓÔØ£¬ÇëÊ¹ÓÃ¹¤¾ß-^>Ñ¡ÏîÐ¶ÔØËü..
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether the selected Source OS is a Windows 7/Server 2008 R2 Edition
if "%selectedSourceOS%" equ "w7" (
	echo.´Ë¹¦ÄÜÉÐÎ´ÊµÏÖ...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

echo.  [1]   Ê¹ÓÃ¹¦ÄÜÁÐ±íÆôÓÃ Windows ¹¦ÄÜ
echo.  [2]   Ê¹ÓÃ¹¦ÄÜÁÐ±í½ûÓÃ Windows ¹¦ÄÜ
echo.  [3]   ´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨ÒåÄ¬ÈÏ Metro Apps ¹ØÁª
echo.  [4]   µ¼³öÄ¬ÈÏ Metro Apps ¹ØÁªµ½ XML ÎÄ¼þ
echo.  [5]   É¾³ýÄ¬ÈÏ Metro Apps ¹ØÁª XML
echo.  [6]   ´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨Òå StartMenu ²¼¾Ö
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 Toolkit - Apply Source Menu
::-------------------------------------------------------------------------------------------
:ApplyMenu

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Ó¦ÓÃÀ´Ô´²Ëµ¥
echo.===============================================================================
echo.
:: Checking whether Source OS is selected
if "%IsSourceselected%" equ "No" (
	echo.Î´Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°À´Ô´¡±²Ëµ¥ÖÐÑ¡ÔñÔ´..
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

:: Checking whether Image Registry is loaded
if "%IsImageRegistryLoaded%" equ "Yes" (
	echo.À´Ô´²Ù×÷ÏµÍ³Ó³Ïñ×¢²á±íÒÑ¼ÓÔØ£¬ÇëÊ¹ÓÃ¹¤¾ß-^>Ñ¡ÏîÐ¶ÔØËü..
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :MainMenu
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" equ "w7" (
	echo.  [1]   Ó¦ÓÃ ^& ±£´æ¸ü¸Äµ½À´Ô´Ó³Ïñ
	echo.
	echo.  [2]   ·ÅÆú¸ü¸Ä ^& Ð¶ÔØÀ´Ô´Ó³Ïñ
	echo.
	echo.
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" neq "w7" (
	echo.  [1]   ÇåÀíÀ´Ô´Ó³Ïñ
	echo.
	echo.  [2]   Ó¦ÓÃ ^& ±£´æ¸ü¸Äµ½À´Ô´Ó³Ïñ
	echo.
	echo.  [3]   ·ÅÆú¸ü¸Ä ^& Ð¶ÔØÀ´Ô´Ó³Ïñ
)
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.  [X]   ·µ»Ø
echo.
echo.===============================================================================
echo.

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" equ "w7" (
	choice /C:12X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 3 goto :MainMenu
	if errorlevel 2 goto :DiscardSource
	if errorlevel 1 goto :SaveSource
)

if "%IsSourceselected%" equ "Yes" if "%selectedSourceOS%" neq "w7" (
	choice /C:1234X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 5 goto :MainMenu
	if errorlevel 3 goto :DiscardSource
	if errorlevel 2 goto :SaveSource
	if errorlevel 1 goto :CleanupSource
)
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Ñ¡ÔñÄ¿±ê²Ëµ¥
::-------------------------------------------------------------------------------------------
:TargetMenu

cls
echo.===============================================================================
echo.                      MSMG ToolKit - Ñ¡ÔñÄ¿±ê²Ëµ¥
echo.===============================================================================
echo.
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 Toolkit - Tools Menu
::-------------------------------------------------------------------------------------------
:ToolsMenu

cls
echo.===============================================================================
echo.                         MSMG ToolKit - ¹¤¾ß²Ëµ¥
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 Toolkit - Select Source from <DVD> folder
::-------------------------------------------------------------------------------------------
:SelectSourceDVD

cls
echo.===============================================================================
echo.               MSMG ToolKit - ´Ó ^<DVD^> ÎÄ¼þ¼ÐÑ¡ÔñÀ´Ô´
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%BootWim%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÖÐÕÒ²»µ½ Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ¸´ÖÆµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source Install Image is a ESD Image
if exist "%InstallEsd%" (
	echo.ToolKit ·¢ÏÖ Windows °²×°Ó³ÏñÎª .esd ¸ñÊ½£¬ESD Ó³ÏñÊÇ¸ß¶ÈÑ¹ËõµÄÓ³Ïñ£¬
	echo.ÎÞ·¨Ö±½ÓÌá¹©·þÎñ¡£
	echo.
	echo.ToolKit ÒªÇó Windows °²×°Ó³ÏñÎª .wim ¸ñÊ½²ÅÄÜ½øÐÐÐÞ¸´¡£
	echo.
	echo.ÇëÊ¹ÓÃ .wim ¸ñÊ½µÄ Windows °²×°Ó³Ïñ£¬»òÊ¹ÓÃ¡°À´Ô´¡±²Ëµ¥ÖÐµÄ¡°´Ó Store ESD
	echo.Ó³ÏñÖÐÌáÈ¡À´Ô´¡±²Ëµ¥¡£
	goto :Stop
)

:: Checking whether Windows Source Install Image exist
if not exist "%InstallWim%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÖÐÕÒ²»µ½ Windows °²×°³ÌÐò¡° Install.wim¡±Ó³Ïñ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò¡° Install.wim¡±Ó³Ïñ¸´ÖÆµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Ñ¡ÔñÀ´Ô´Ó³Ïñ####################################################
echo.-------------------------------------------------------------------------------

:: Getting Image Index Number to Service
call :GetImageIndexNo "%InstallWim%"

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëÁËÎÞÐ§µÄ # Ë÷ÒýºÅ£¬ÓÐÐ§·¶Î§Îª [1,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
	echo.
	pause
	goto :SelectSourceDVD
)

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

:: Getting first Image Index Information
call :GetImageIndexInfo "%InstallWim%", 1 >nul

:: Setting selected Source OS version
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" set "SelectedSourceOS=w10"

:: Checking whether the HOST OS is Windows 7 and selected Source OS is Windows 10
if "%HostVersion%" equ "6.1" if "%SelectedSourceOS%" equ "w10" (
	echo.
	echo.ToolKit ÎÞ·¨ÔÚ Windows 7 HOST ²Ù×÷ÏµÍ³ÉÏ·þÎñ Windows 10 À´Ô´²Ù×÷ÏµÍ³...
	echo.
	echo.ToolKit ÐèÒª Windows 8.1/10 Ö÷»ú²Ù×÷ÏµÍ³²ÅÄÜÎª Windows 10 À´Ô´²Ù×÷ÏµÍ³Ìá¹©·þÎñ...
	goto :Stop
)

echo.
choice /C:YN /N /M "ÄúÊÇ·ñÒª¹ÒÔØ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ? ['Y'es/'N'o] : "
if errorlevel 2 set "IsBootImageSelected=No"
if errorlevel 1 set "IsBootImageSelected=Yes"

choice /C:YN /N /M "ÄúÊÇ·ñÒª¹ÒÔØ Windows »Ö¸´Ó³Ïñ? ['Y'es/'N'o] : "
if errorlevel 2 set "IsRecoveryImageSelected=No"
if errorlevel 1 set "IsRecoveryImageSelected=Yes"

echo.
echo.-------------------------------------------------------------------------------
echo.####À´Ô´Ó³ÏñÐÅÏ¢###################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Ó³Ïñ                    :  Install.wim
if /i "%ImageIndexNo%" equ "A" if %ImageCount% neq 1 echo.    Ó³ÏñË÷Òý±àºÅ         :  1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" 	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 (
       echo.-------------------------------------------------------------------------------
       echo.°²×° [Boot.wim, Ë÷Òý : %%i] Ó³ÏñÔÚ ^<\Mount\Boot\%%i^>...
       echo.-------------------------------------------------------------------------------
       call :MountImage "%BootWim%", %%i, "%BootMount%\%%i"
       echo.-------------------------------------------------------------------------------
   )
)

:: Mounting Source Install & Recovery Images Index to Service
if /i "%ImageIndexNo%" equ "A" (
	for /l %%i in (1, 1, %ImageCount%) do (
		call :CreateFolder "%InstallMount%\%%i"

		:: Mounting Source Install Image Indexes to Service
		echo.-------------------------------------------------------------------------------
		echo.°²×° [Install.wim, Ë÷Òý : %%i] Ó³ÏñÔÚ ^<\Mount\Install\%%i^>...
		echo.-------------------------------------------------------------------------------
		call :MountImage "%InstallWim%", %%i, "%InstallMount%\%%i"

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

			:: Mounting Source Recovery Image Indexes to Service
			echo.-------------------------------------------------------------------------------
			echo.°²×° [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³ÏñÔÚ ^<\Mount\WinRE\%%i^>...
			echo.-------------------------------------------------------------------------------
			call :MountImage "%InstallMount%\%%i\%WinReWim%", 1, "%WinReMount%\%%i"
		)
	)
) else (
	for %%i in (%ImageIndexNo%) do (
		call :CreateFolder "%InstallMount%\%%i"

		:: Mounting Source Install Image Indexes to Service
		echo.-------------------------------------------------------------------------------
		echo.°²×° [Install.wim, Ë÷Òý : %%i] Ó³ÏñÔÚ ^<\Mount\Install\%%i^>...
		echo.-------------------------------------------------------------------------------
		call :MountImage "%InstallWim%", %%i, "%InstallMount%\%%i"

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

			:: Mounting Source Recovery Image Indexes to Service
			echo.-------------------------------------------------------------------------------
			echo.°²×° [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³ÏñÔÚ ^<\Mount\WinRE\%%i^>...
			echo.-------------------------------------------------------------------------------
			call :MountImage "%InstallMount%\%%i\%WinReWim%", 1, "%WinReMount%\%%i"
		)
	)
)
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÑ¡Ôñ ^& ¹ÒÔØÀ´Ô´Ó³Ïñ################################
echo.-------------------------------------------------------------------------------

set "IsSourceSelected=Yes"

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

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

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - ´Ó DVD Çý¶¯Æ÷¸´ÖÆÀ´Ô´ ^<DVD^> µ½ÎÄ¼þ¼Ð
::-------------------------------------------------------------------------------------------
:CopySourceDVD

setlocal

set DriveLetter=

cls
echo.===============================================================================
echo.          MSMG ToolKit - ´Ó DVD Çý¶¯Æ÷¸´ÖÆÀ´Ô´ ^<DVD^> µ½ÎÄ¼þ¼Ð
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's À´Ô´ ^<DVD^> ÎÄ¼þ¼Ð²»Îª¿Õ...
	echo.
	choice /C:YN /N /M "ÄúÊÇ·ñÒªÉ¾³ýËü²¢¼ÌÐø? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####´Ó DVD Çý¶¯Æ÷ ^<DVD^> ÎÄ¼þ¼Ð´Ó¿ªÊ¼¸´ÖÆÀ´Ô´#####################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ DVD Çý¶¯Æ÷Ñ¡Ïî##################################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting DVD Drive Letter
set /p DriveLetter=ÊäÈë DVD Çý¶¯Æ÷ºÅ : 

:: Setting DVD Drive Letter
set "DriveLetter=%DriveLetter%:"
echo.

:: Checking whether the specified DVD Drive letter is empty
if not exist "%DriveLetter%\sources\boot.wim" (
	echo.ÔÚÖ¸¶¨µÄÇý¶¯Æ÷ºÅÖÐÕÒ²»µ½ Windows ²Ù×÷ÏµÍ³°²×°ÎÄ¼þ..
	echo.
	echo.ÇëÊäÈëÕýÈ·µÄ DVD Çý¶¯Æ÷ºÅ..
	goto :Stop
)

:: Checking whether the specified DVD Drive Letter is empty
if not exist "%DriveLetter%\sources\install.wim" (
	echo.ÔÚÖ¸¶¨µÄÇý¶¯Æ÷ºÅÖÐÕÒ²»µ½ Windows ²Ù×÷ÏµÍ³°²×°ÎÄ¼þ..
	echo.
	echo.ÇëÊäÈëÕýÈ·µÄ DVD Çý¶¯Æ÷ºÅ..
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####´Ó DVD Çý¶¯Æ÷¸´ÖÆÀ´Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð##############################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.´Ó DVD Çý¶¯Æ÷ ^<%DriveLetter%^> ¸´ÖÆµ½À´Ô´ ^<DVD^> ÎÄ¼þ¼Ð...
echo.
echo.´Ó DVD Çý¶¯Æ÷¸´ÖÆ¿ÉÄÜÐèÒªÒ»Ð©Ê±¼ä£¬Òò´ËÇëÉÔºò...
%XCopy% %DriveLetter% "%DVD%" >nul
echo.
echo.¸´ÖÆÍê³É...
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó DVD Çý¶¯Æ÷¸´ÖÆ ^<DVD^> ÎÄ¼þ¼Ðµ½À´Ô´Íê³É#####################
echo.-------------------------------------------------------------------------------

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

set DriveLetter=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from DVD ISO Image to <DVD> folder
::-------------------------------------------------------------------------------------------
:ExtractSourceISO

setlocal

set ISOFileName=

cls
echo.===============================================================================
echo.      MSMG ToolKit - ´Ó DVD ISO Ó³ÏñÌáÈ¡Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's À´Ô´ ^<DVD^> ÎÄ¼þ¼Ð²»Îª¿Õ...
	echo.
	choice /C:YN /N /M "ÄúÊÇ·ñÒªÉ¾³ýËü²¢¼ÌÐø? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
	echo.
)

:: Checking whether DVD ISO Image folder is empty
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.
:: Getting DVD ISO Image file Name
set /p ISOFileName=ÊäÈë²»´ø .iso µÄ ISO Ó³ÏñÎÄ¼þÃû : 

:: Setting DVD ISO Image file Name
set "ISOFileName=%ISOFileName%.iso"
echo.

:: Checking whether the specified DVD ISO Image file exist
if not exist "%ISO%\%ISOFileName%" (
	echo.ÔÚ ^<ISO^> ÎÄ¼þ¼ÐÖÐÕÒ²»µ½Ö¸¶¨µÄ DVD ISO Ó³Ïñ...
	echo.
	echo.ÇëÊäÈëÕýÈ·µÄ DVD ISO Ó³ÏñÎÄ¼þÃû...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####´Ó DVD ISO Ó³ÏñÌáÈ¡À´Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð#######################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.ÌáÈ¡ DVD ISO Ó³ÏñÄÚÈÝµ½À´Ô´ ^<DVD^> ÎÄ¼þ¼Ð...
echo.
echo.ÌáÈ¡¿ÉÄÜÐèÒªÒ»Ð©Ê±¼ä£¬Òò´ËÇëÉÔºò...
%Zip% x -y "%ISO%\%ISOFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if exist "%DVD%\sources\install.esd" set /a n+=1
if "%n%" equ "2" (echo.ÌáÈ¡Íê³É...) else echo.ÌáÈ¡Ê§°Ü...
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó DVD ISO Ó³ÏñÍê³ÉÀ´Ô´ÌáÈ¡µ½ ^<DVD^> ÎÄ¼þ¼Ð##############
echo.-------------------------------------------------------------------------------

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

set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from OEM IMG Image to <DVD> folder
::-------------------------------------------------------------------------------------------
:ExtractSourceIMG

setlocal

set IMGFileName=

cls
echo.===============================================================================
echo.      MSMG ToolKit - ´Ó OEM IMG Ó³ÏñÖÐÌáÈ¡À´Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if exist "%DVD%\sources\*.wim" (
	echo.Toolkit's À´Ô´ ^<DVD^> ÎÄ¼þ¼Ð²»Îª¿Õ...
	echo.
	choice /C:YN /N /M "ÄúÊÇ·ñÒªÉ¾³ýËü²¢¼ÌÐø? ['Y'es/'N'o] : "
	if errorlevel 2 goto :Stop
)

:: Checking whether OEM IMG folder is empty
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.
:: Getting OEM IMG file Name
set /p IMGFileName=ÊäÈë OEM IMG ÎÄ¼þÃû£¬²»´ø .img : 

:: Setting OEM IMG file Name
set "IMGFileName=%IMGFileName%.img"
echo.

:: Checking whether the specified OEM IMG Image file exist
if not exist "%ISO%\%IMGFileName%" (
	echo.ÕÒ²»µ½Ö¸¶¨µÄ OEM IMG Ó³ÏñÎÄ¼þ...
	echo.
	echo.ÇëÊäÈëÕýÈ·µÄ OEM IMG Ó³ÏñÎÄ¼þÃû...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####´Ó OEM IMG Ó³ÏñÌáÈ¡À´Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð#######################
echo.-------------------------------------------------------------------------------
echo.
call :RemoveFolder "%DVD%"
echo.ÌáÈ¡ OEM IMG Ó³ÏñÄÚÈÝ×÷ÎªÀ´Ô´ ^<DVD^> ÎÄ¼þ¼Ð...
echo.
echo.ÌáÈ¡¿ÉÄÜÐèÒªÒ»Ð©Ê±¼ä£¬Òò´ËÇëµÈ´ý...
%Zip% x -y "%ISO%\%IMGFileName%" -o"%DVD%" >nul
echo.
set /a n=0
if exist "%DVD%\sources\boot.wim" set /a n+=1
if exist "%DVD%\sources\install.wim" set /a n+=1
if "%n%" equ "2" (echo.ÌáÈ¡Íê³É...) else echo.ÌáÈ¡Ê§°Ü...
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó OEM IMG Ó³ÏñÍê³ÉÌáÈ¡À´Ô´µ½ ^<DVD^> ÎÄ¼þ¼Ð##############
echo.-------------------------------------------------------------------------------

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

set IMGFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - ´Ó Store ESD Ó³ÏñÖÐÌáÈ¡À´Ô´
::-------------------------------------------------------------------------------------------
:ExtractSourceStoreESD

setlocal

set ImageBuild=

cls
echo.===============================================================================
echo.            MSMG ToolKit - ´Ó Store ESD Ó³ÏñÖÐÌáÈ¡À´Ô´
echo.===============================================================================
echo.

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallEsd%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÕÒ²»µ½ Windows Store ESD Ó³ÏñÎÄ¼þ "Install.esd" ¡£
	echo.
	echo.Çë½« Windows Store ESD Ó³ÏñÎÄ¼þ¸´ÖÆµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó Store ESD Ó³ÏñÖÐÌáÈ¡À´Ô´############################
echo.-------------------------------------------------------------------------------
echo.
echo.¶ÁÈ¡Ó³ÏñÐÅÏ¢...
echo.
echo.===============================================================================
echo.^|Ë÷Òý^| ¼Ü¹¹ ^| Ãû³Æ
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr /i 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.

:: Finding total no of indexes present inside the ESD Image
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 4 set ImageIndexNo=4

if %ImageCount% gtr 4 (
	:: Getting Image Index Number to Service
	set /p ImageIndexNo=ÊäÈëÓ³ÏñË÷Òý # [·¶Î§ : 4,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö] : 

	:: Checking for Image Index Validation
	if not defined ImageIndexNo (
		echo.
		echo.ÊäÈëµÄ # Ë÷ÒýºÅÎÞÐ§, ÓÐÐ§·¶Î§Îª [4,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
		echo.
		pause
		goto :ExtractSourceStoreESD
	)

	if /i "%ImageIndexNo%" equ "Q" goto :MainMenu
)
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó Store ESD Ó³ÏñÌáÈ¡À´Ô´#####################################
echo.-------------------------------------------------------------------------------
echo.
echo.½âÃÜ Windows Store ESD Ó³Ïñ£¨Èç¹ûÒÑ¼ÓÃÜ£©...
attrib -r -h -s -a "%InstallEsd%" >nul
for /f "skip=1 tokens=4 delims=:." %%e in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" /Index:4 ^| find /i "Version"') do set ImageBuild=%%e
if %ImageBuild% equ 9600 %W81EsdDecrypter% "%InstallEsd%" 2>nul
if %ImageBuild% gtr 9600 %W10EsdDecrypter% "%InstallEsd%" >nul
echo.
:: Creating Temporary Boot and Install Images
echo.´´½¨ÁÙÊ±ÈÝÆ÷Ó³Ïñ...
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"
call :CaptureImage "%BootWim%", "%Temp%\ESD", "BootWim", "BootWim", "No" >nul
call :CaptureImage "%InstallWim%", "%Temp%\ESD", "InstallWim", "InstallWim", "No" >nul
call :RemoveFolder "%Temp%\ESD"
echo.
echo.-------------------------------------------------------------------------------
echo.Ó¦ÓÃ Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : 1] µ½ ^<Temp\DVD^>...
echo.-------------------------------------------------------------------------------
:: Creating Windows Setup Installation Media folder "%Temp%\DVD"
call :RemoveFolder "%Temp%\DVD"
call :CreateFolder "%Temp%\DVD"
call :ApplyImage "%InstallEsd%", 1, "%Temp%\DVD"
move /y "%DVD%\sources\*.wim" "%Temp%\DVD\sources" >nul
echo.-------------------------------------------------------------------------------
echo.µ¼³ö Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : 2] µ½Òýµ¼Ó³Ïñ...
echo.-------------------------------------------------------------------------------
call :ExportImageIndex "%InstallEsd%", 2, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"
call :DeleteImage "%Temp%\DVD\sources\boot.wim", 1 >nul
echo.-------------------------------------------------------------------------------
echo.µ¼³ö Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : 3] µ½Òýµ¼Ó³Ïñ...
echo.-------------------------------------------------------------------------------
call :ExportImageIndex "%InstallEsd%", 3, "%Temp%\DVD\sources\boot.wim", "WIM", "Yes"

if %ImageBuild% equ 9600 (
	echo.-------------------------------------------------------------------------------
	echo.µ¼³ö Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : 4] µ½°²×°Ó³Ïñ...
	echo.-------------------------------------------------------------------------------
	call :ExportImageIndex "%InstallEsd%", 4, "%Temp%\DVD\sources\install.wim", "WIM", "No"
)

if %ImageBuild% gtr 9600 (
	if /i "%ImageIndexNo%" equ "A" (
		for /l %%i in (3, 1, ImageCount) do (
			echo.-------------------------------------------------------------------------------
			echo.µ¼³ö Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : %%i] µ½°²×°Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :ExportImageIndex "%InstallEsd%", %%i, "%Temp%\DVD\sources\install.wim", "WIM", "No"
		)
	) else (
		for %%i in (%ImageIndexNo%) do (
			echo.-------------------------------------------------------------------------------
			echo.µ¼³ö Windows Store ESD Ó³Ïñ [Install.esd, Ë÷Òý : %%i] µ½°²×°Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :ExportImageIndex "%InstallEsd%", %%i, "%Temp%\DVD\sources\install.wim", "WIM", "No"
		)
	)
)

:: Deleting the First Empty Index
call :DeleteImage "%Temp%\DVD\sources\install.wim", 1 >nul

:: Moving ESD to WIM converted folder <Temp\DVD> to <DVD> Source Folder
call :RemoveFolder "%DVD%"
move /y "%Temp%\DVD" "%ROOT%" >nul

echo.-------------------------------------------------------------------------------
echo.####¸´ÖÆ EI.CFG ÅäÖÃÎÄ¼þµ½À´Ô´ ^<DVD\sources^> ÎÄ¼þ¼Ð##################
echo.-------------------------------------------------------------------------------
echo.
:: Getting Install Image Index Edition
call :GetImageEdition "%InstallWim%", 1

:: Writing EI.cfg Config file to <DVD\sources> folder
echo.¸´ÖÆ EI.CFG ÎÄ¼þµ½ ^<DVD\sources^> ÎÄ¼þ¼Ð...

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

:: Cleaning Up Unwanted files from Source folder
call :RemoveFile "%DVD%\MediaMeta.xml"
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É´Ó Store ESD Ó³ÏñÖÐÌáÈ¡Ô´############################
echo.-------------------------------------------------------------------------------

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

set ImageBuild=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from Microsoft's Media Creation Tool Image
::-------------------------------------------------------------------------------------------
:ExtractSourceMCT

setlocal

cls
echo.===============================================================================
echo.   MSMG ToolKit - ´Ó Microsoft Media Creation Tool Ó³ÏñÖÐÌáÈ¡À´Ô´
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%BootWim%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÖÐÕÒ²»µ½ Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ¸´ÖÆµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source Install Image exist
if not exist "%InstallEsd%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÕÒ²»µ½ Windows °²×°³ÌÐò "Install.esd" Ó³Ïñ...
	echo.
	echo.Çë¸´ÖÆ Windows °²×°³ÌÐò "Install.esd" Ó³Ïñµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÌáÈ¡Ô´###################
echo.-------------------------------------------------------------------------------
echo.
echo.¶ÁÈ¡Ó³ÏñÐÅÏ¢...
echo.
echo.===============================================================================
echo.^|Ë÷Òý^| ¼Ü¹¹ ^| Ãû³Æ
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr /i 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.

:: Finding total no of indexes present inside the ESD Image
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 1 (
	set /p ImageIndexNo=ÊäÈë ESD Ó³ÏñË÷Òý # ['Q'uit] : 
) else set /p ImageIndexNo=ÊäÈë ESD Ó³ÏñË÷Òý # [·¶Î§ : 1,2,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëµÄ # Ë÷ÒýºÅÎÞÐ§, ÓÐÐ§·¶Î§Îª [1,2,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
	echo.
	pause
	goto :ExtractSourceMCT
)

if /i "%ImageIndexNo%" equ "Q" goto :MainMenu
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó Microsoft's Media Creation Tool Ó³ÏñÖÐÌáÈ¡À´Ô´######
echo.-------------------------------------------------------------------------------

:: Creating Temporary Install Images
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"

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

:: Converting Windows Media Creation Tool Install ESD Image to WIM Image
if /i "%ImageIndexNo%" equ "A" (
	call :ExportImage "%InstallEsd%", "%InstallWim%", "WIM", "No"
) else (
	for %%i in (%ImageIndexNo%) do (
		echo.-------------------------------------------------------------------------------
		echo.µ¼³ö Media Creation Tool [Install.esd, Ë÷Òý : %%i] µ½°²×°Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
	)
)

:: Deleting converted Windows Media Creation Tool Install WIM Image Index 1 which is an empty Index
call :DeleteImage "%InstallWim%", 1 >nul

:: Deleting original Windows Media Creation Tool Install ESD Image
call :RemoveFile "%InstallEsd%"

echo.-------------------------------------------------------------------------------
echo.####´Ó Microsoft Media Creation Tool Ó³ÏñÖÐÌáÈ¡À´Ô´Íê³É######
echo.-------------------------------------------------------------------------------

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

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Extract Source from Custom Windows ESD Image
::-------------------------------------------------------------------------------------------
:ExtractSourceESD

setlocal

cls
echo.===============================================================================
echo.         MSMG ToolKit - ´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÖÐÌáÈ¡À´Ô´
echo.===============================================================================
echo.

:: Checking whether Windows Source Boot Image exist
if not exist "%BootWim%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÖÐÕÒ²»µ½ Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò¡° Boot.wim¡±Ó³Ïñ¸´ÖÆµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source Install ESD Image exist
if not exist "%InstallEsd%" (
	echo.ÔÚ ^<DVD\Sources^> ÎÄ¼þ¼ÐÕÒ²»µ½ Windows °²×°³ÌÐò "Install.esd" Ó³Ïñ...
	echo.
	echo.Çë¸´ÖÆ Windows °²×°³ÌÐò "Install.esd" Ó³Ïñµ½ ^<DVD\Sources^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÌáÈ¡À´Ô´###################
echo.-------------------------------------------------------------------------------
echo.
echo.¶ÁÈ¡Ó³ÏñÐÅÏ¢...
echo.
echo.===============================================================================
echo.^|Ë÷Òý^| ¼Ü¹¹ ^| Ãû³Æ
echo.===============================================================================
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:"%InstallEsd%" ^| findstr /i 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.

:: Finding total no of indexes present inside the ESD Image
call :GetImageCount "%InstallEsd%"

if %ImageCount% equ 1 (
	set /p ImageIndexNo=ÊäÈë ESD Ó³ÏñË÷Òý # ['Q'uit] : 
) else set /p ImageIndexNo=ÊäÈë ESD Ó³ÏñË÷Òý # [·¶Î§ : 1,2,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëµÄ # Ë÷ÒýºÅÎÞÐ§, ÓÐÐ§·¶Î§Îª [1,2,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
	echo.
	pause
	goto :ExtractSourceESD
)

if /i "%ImageIndexNo%" equ "Q" goto :MainMenu
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÌáÈ¡À´Ô´############################
echo.-------------------------------------------------------------------------------

:: Creating Temporary Boot and Install Images
call :RemoveFolder "%Temp%\ESD"
call :CreateFolder "%Temp%\ESD"

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

:: Converting Windows Install ESD Image to WIM Image
if /i "%ImageIndexNo%" equ "A" (
	call :ExportImage "%InstallEsd%", "%InstallWim%", "WIM", "No"
) else (
	for %%i in (%ImageIndexNo%) do (
		call :ExportImageIndex "%InstallEsd%", %%i, "%InstallWim%", "WIM", "No"
	)
)

:: Deleting converted Windows Install WIM Image Index 1 which is an empty Index
call :DeleteImage "%InstallWim%", 1 >nul

:: Deleting original Windows Install ESD Image
call :RemoveFile "%InstallEsd%"

echo.-------------------------------------------------------------------------------
echo.####´Ó×Ô¶¨Òå Windows ESD Ó³ÏñÌáÈ¡À´Ô´Íê³É###################
echo.-------------------------------------------------------------------------------

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

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Language Packs
::-------------------------------------------------------------------------------------------
:IntLanguagePacks

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.               MSMG ToolKit - ¼¯³É Windows ÓïÑÔ°ü
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                ¾¯         ¸æ
	echo.                                =============
	echo.
	echo.   ¸üÐÂºó²»Òª¼¯³ÉÓïÑÔ°ü¡£Èç¹ûÄú¼¯³ÉÈÎºÎ¸üÐÂ ^(ÐÞ²¹³ÌÐò£¬Ò»°ã·¢ÐÐ°æ±¾ [GDR]£¬
	echo.   ÁãÌì²¹¶¡ [ZDP] »ò·þÎñ°ü [SP]^) ¼¯³ÉÓïÑÔ°üÖ®Ç°£¬Ëü°üº¬ÒÀÀµÓÚÓïÑÔµÄ×ÊÔ´£¬
	echo.   ¸üÐÂÖÐ°üº¬µÄÌØ¶¨ÓÚÓïÑÔµÄ¸ü¸Ä²»»áÓ¦ÓÃ£¬Äú½«²»µÃ²»ÖØÐÂ¼¯³É¸üÐÂ¡£
	echo.   ÔÚ¼¯³É¸üÐÂÖ®Ç°£¬ÇëÊ¼ÖÕ¼¯³ÉÓïÑÔ°ü¡£
	echo.
	echo.
	echo.
	echo.
	echo.   Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set LanguagePackType=
set LanguagePackCode=

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É 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 ToolKit - ¼¯³É 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 ToolKit - ¼¯³É Windows ÓïÑÔ°ü - Ñ¡ÔñÓïÑÔ²Ëµ¥
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Latvian - Latvia         [lv-LV]
	echo. Bulgarian - Bulgaria     [bg-BG]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Norwegian - Norway       [nb-NO]
	echo. Chinese - Simplified     [zh-CN]    Polish - Poland          [pl-PL]
	echo. Chinese - Taiwan         [zh-TW]    Portuguese - Brazil      [pt-BR]
	echo. Croatian - Croatia       [hr-HR]    Portuguese - Portugal    [pt-PT]
	echo. Czech - Czech Republic   [cs-CZ]    Romanian - Romania       [ro-RO]
	echo. Danish - Denmark         [da-DK]    Russian - Russia         [ru-RU]
	echo. Dutch - The Netherlands  [nl-NL]    Serbian - Serbia         [sr-Latn-CS]
	echo. English - United States  [en-US]    Slovak - Slovakia        [sk-SK]
	echo. Estonian - Estonia       [et-EE]    Slovenian - Slovenia     [sl-SI]
	echo. Finnish - Finland        [fi-FI]    Spanish - Spain          [es-ES]
	echo. French - France          [fr-FR]    Swedish - Sweden         [sv-SE]
	echo. German - Germany         [de-DE]    Thai - Thailand          [th-TH]
	echo. Greek - Greece           [el-GR]    Turkish - Turkey         [tr-TR]
	echo. Hebrew - israel          [he-IL]    Ukrainian - Ukraine      [uk-UA]
	echo. Hungarian - Hungary      [hu-HU]
	echo. Italian - Italy          [it-IT]
	echo. Japanese - Japan         [ja-JP]
	echo. Korean - Korea           [ko-KR]   [X] ·µ»Ø
)

if "%SelectedSourceOS%" equ "w81" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Korean - Korea           [ko-KR]
	echo. Bulgarian - Bulgaria     [bg-BG]    Latvian - Latvia         [lv-LV]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Simplified     [zh-CN]    Norwegian - Norway       [nb-NO]
	echo. Chinese - Taiwan         [zh-TW]    Polish - Poland          [pl-PL]
	echo. Croatian - Croatia       [hr-HR]    Portuguese - Brazil      [pt-BR]
	echo. Czech - Czech Republic   [cs-CZ]    Portuguese - Portugal    [pt-PT]
	echo. Danish - Denmark         [da-DK]    Romanian - Romania       [ro-RO]
	echo. Dutch - The Netherlands  [nl-NL]    Russian - Russia         [ru-RU]
	echo. English - United Kingdom [en-GB]    Serbian - Serbia         [sr-Latn-CS]
	echo. English - United States  [en-US]    Slovak - Slovakia        [sk-SK]
	echo. Estonian - Estonia       [et-EE]    Slovenian - Slovenia     [sl-SI]
	echo. Finnish - Finland        [fi-FI]    Spanish - Spain          [es-ES]
	echo. French - France          [fr-FR]    Swedish - Sweden         [sv-SE]
	echo. German - Germany         [de-DE]    Thai - Thailand          [th-TH]
	echo. Greek - Greece           [el-GR]    Turkish - Turkey         [tr-TR]
	echo. Hebrew - israel          [he-IL]    Ukrainian - Ukraine      [uk-UA]
	echo. Hungarian - Hungary      [hu-HU]
	echo. Italian - Italy          [it-IT]
	echo. Japanese - Japan         [ja-JP]	  [X] ·µ»Ø
)

if "%SelectedSourceOS%" equ "w10" (
	echo. Arabic - Saudi Arabia    [ar-SA]    Japanese - Japan         [ja-JP]
	echo. Bulgarian - Bulgaria     [bg-BG]    Korean - Korea           [ko-KR]
	echo. Chinese - Hong Kong SAR  [zh-HK]    Latvian - Latvia         [lv-LV]
	echo. Chinese - Simplified     [zh-CN]    Lithuanian - Lithuania   [lt-LT]
	echo. Chinese - Taiwan         [zh-TW]    Norwegian - Norway       [nb-NO]
	echo. Croatian - Croatia       [hr-HR]    Polish - Poland          [pl-PL]
	echo. Czech - Czech Republic   [cs-CZ]    Portuguese - Brazil      [pt-BR]
	echo. Danish - Denmark         [da-DK]    Portuguese - Portugal    [pt-PT]
	echo. Dutch - The Netherlands  [nl-NL]    Romanian - Romania       [ro-RO]
	echo. English - United Kingdom [en-GB]    Russian - Russia         [ru-RU]
	echo. English - United States  [en-US]    Serbian - Serbia         [sr-Latn-RS]
	echo. Estonian - Estonia       [et-EE]    Slovak - Slovakia        [sk-SK]
	echo. Finnish - Finland        [fi-FI]    Slovenian - Slovenia     [sl-SI]
	echo. French - Canada          [fr-CA]    Spanish - Mexico         [es-MX]
	echo. French - France          [fr-FR]    Spanish - Spain          [es-ES]
	echo. German - Germany         [de-DE]    Swedish - Sweden         [sv-SE]
	echo. Greek - Greece           [el-GR]    Thai - Thailand          [th-TH]
	echo. Hebrew - israel          [he-IL]    Turkish - Turkey         [tr-TR]
	echo. Hungarian - Hungary      [hu-HU]    Ukrainian - Ukraine      [uk-UA]
	echo. Italian - Italy          [it-IT]    [X] ·µ»Ø
)
echo.===============================================================================
set /p LanguagePackCode=ÊäÈëÓïÑÔ´úÂë£¬²»´ø '[' ']' : 

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

cls
echo.===============================================================================
if "%LanguagePackType%" equ "Boot" echo.  MSMG ToolKit - ¼¯³É Windows ÓïÑÔ°üµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
if "%LanguagePackType%" equ "Install" echo. MSMG ToolKit - ¼¯³É Windows ÓïÑÔ°üµ½ Windows°²×°Ó³Ïñ
if "%LanguagePackType%" equ "Recovery" echo.   MSMG ToolKit - ¼¯³É Windows ÓïÑÔ°üµ½ Windows »Ö¸´Ó³Ïñ
echo.===============================================================================
echo.

:: Getting Source Image Index Architecture
if "%LanguagePackType%" equ "Boot" call :GetImageArchitecture "%BootWim%", 1 >nul

if "%LanguagePackType%" equ "Install" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
	)
)

if "%LanguagePackType%" equ "Recovery" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%WinReMount%\%%i" call :GetImageArchitecture "%WinReMount%\%%i\%WinReWim%", 1 >nul
	)
)

:: Setting Package Build and Service Pack Build Version
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" leq "17763" set "PackageBuild=%ImageBuild%"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "PackageBuild=18362"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" set "PackageBuild=19041"
)

:: Setting Package Build and Service Pack Build Version
if "%SelectedSourceOS%" equ "w7" set "PackageServicePackBuild=17514"
if "%SelectedSourceOS%" equ "w81" set "PackageServicePackBuild=16384"
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
	if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"
)

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm" set "PackageArchitecture=arm"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Settings Windows Language Packs folder path
if "%SelectedSourceOS%" neq "w10" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\%ImageArchitecture%\%LanguagePackCode%"
if "%SelectedSourceOS%" equ "w10" set "LanguagePacks=%LanguagePacks%\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%"

:: Checking whether Windows PE Language Packs folder is empty
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%" equ "w10" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType:~,6%" neq "Server" if not exist "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "17134" (
		for /d %%i in (de-DE, en-GB, en-IN, 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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
				echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				echo.
				echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

:: Checking whether Windows Language or Language Features Packs folder is empty
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%" equ "w10" if "%ImageInstallationType%" equ "Client" if not exist "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType:~,6%" equ "Server" if not exist "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

:: Checking whether Windows PE Language Packs folder is empty
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%" equ "w10" if not exist "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17134" if not exist "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "17134" (
		for /d %%i in (de-DE, en-GB, en-IN, 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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
				echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
				echo.
				echo."WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				echo.
				echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
				goto :Stop
			)
		)
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if not exist "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "14393" if not exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%ImageArchitecture%\%LanguagePackCode%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
	if "%SelectedSourceOS%" equ "w10" if not exist "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.Windows ÓïÑÔ°üÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
		echo.
		echo."WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\LanguagePacks\%SelectedSourceOS%\10.0.%PackageBuild%\%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.    Image                    : Boot.wim
	echo.    Image Index              : 1, 2
)
if "%LanguagePackType%" equ "Install" (
	echo.    Image                    : Install.wim
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
)
if "%LanguagePackType%" equ "Recovery" (
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%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%" equ "w10" (
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%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%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Audio Core [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Audio Drivers [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
		)

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Enhanced Storage Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)
		
		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Narrator [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)

		if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - IBS Provider Pack [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - Scripting Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Secure Startup Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)
	)

	echo.=============================[Boot.wim, Index : 2]=============================
	echo.
	if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - Setup Pack µ½ Windows Æô¶¯Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%BootMount%\2", "%Patches%\WinPE\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
	)

	echo.-------------------------------------------------------------------------------
	echo.¼¯³É WinPE - Setup Pack [%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%" equ "w10" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

	if "%ImageInstallationType:~,6%" neq "Server" (
		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Setup Client Pack µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Patches%\WinPE\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - Setup Client Pack [%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%" equ "w10" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
	)

	if "%ImageInstallationType:~,6%" equ "Server" (
		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if not exist "%BootMount%\2\Windows\servicing\Packages\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Setup Server Pack µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\2", "%Patches%\WinPE\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - Setup Server Pack [%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%" equ "w10" call :AddPackage "%BootMount%\2", "%LanguagePacks%\WinPE-Setup-Server-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
	)

	for /l %%i in (1, 1, 2) do (
		echo.=============================[Boot.wim, Index : %%i]=============================
		echo.
		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "17134" (
			for /d %%z in (de-DE, en-GB, en-IN, 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 - Speech TextToSpeech [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)
			)
		)

		if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Speech TextToSpeech [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - SRH [%LanguagePackCode%] µ½ Windows Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		)

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - SRT Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - WDS Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É WinPE - WMI Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

		for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
			if "%LanguagePackCode%" equ "%%z" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Font Support Pack [%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%" equ "w10" call :AddPackage "%BootMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.Éú³ÉW indows Æô¶¯ÓïÑÔ°ü¼¯³ÉÈÕÖ¾ÎÄ¼þ...
		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.

	if "%SelectedSourceOS%" neq "w10" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É [%LanguagePackCode%] ±¾µØ»¯µÄ Windows °²×°³ÌÐò×ÊÔ´µ½À´Ô´ DVD...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.ÌáÈ¡ Windows PE ÓïÑÔ°ü [%LanguagePackCode%] µ½ÁÙÊ±ÎÄ¼þ¼Ð...
		call :RemoveFolder "%Temp%\LanguagePack"
		call :CreateFolder "%Temp%\LanguagePack"
		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" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É [%LanguagePackCode%] ±¾µØ»¯µÄ Windows °²×°³ÌÐò×ÊÔ´µ½À´Ô´ DVD...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.ÌáÈ¡ Windows PE ÓïÑÔ°ü [%LanguagePackCode%] µ½ÁÙÊ±ÎÄ¼þ¼Ð...
		call :RemoveFolder "%Temp%\LanguagePack"
		call :CreateFolder "%Temp%\LanguagePack"
		if "%SelectedSourceOS%" equ "w10" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%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" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É [%LanguagePackCode%] ±¾µØ»¯µÄ Windows °²×°³ÌÐò×ÊÔ´À´Ô´ DVD ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.ÌáÈ¡ Windows PE ÓïÑÔ°ü [%LanguagePackCode%] µ½ÁÙÊ±ÎÄ¼þ¼Ð...
		call :RemoveFolder "%Temp%\LanguagePack"
		call :CreateFolder "%Temp%\LanguagePack"
		if "%SelectedSourceOS%" equ "w10" expand "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%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, Index : %%i]============================
			if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
			echo.
			echo.-------------------------------------------------------------------------------
			echo.Integrating Windows Language Pack [%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%" equ "w10" (
				if "%ImageInstallationType%" equ "Client" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				if "%ImageInstallationType:~,6%" equ "Server" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

				if exist "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows ÓïÑÔ¹¦ÄÜ - Basic Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Basic-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows ÓïÑÔ¹¦ÄÜ - Handwriting Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Handwriting-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows ÓïÑÔ¹¦ÄÜ - OCR Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-OCR-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows ÓïÑÔ¹¦ÄÜ - Text To Speech Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-TextToSpeech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%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%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows ÓïÑÔ¹¦ÄÜ - Speech Pack [%LanguagePackCode%]...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

					if "%ImageBuild%" geq "17763" (
						call :CreateFolder "%Temp%\LanguagePacks"
						copy /y "%LanguagePacks%\Microsoft-Windows-LanguageFeatures-Speech-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%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%" equ "w10" if "%ImageInstallationType%" equ "Client" expand "%LanguagePacks%\Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" -f:* "%Temp%\LanguagePack" >nul
	if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType:~,6%" equ "Server" expand "%LanguagePacks%\Microsoft-Windows-Server-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%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.Copying 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 "18363" (
		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
		)
	)
	echo.
)

if "%LanguagePackType%" equ "Recovery" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%WinReMount%\%%i" (
			if not %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]=====================
			if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
			echo.
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE ÓïÑÔ°ü [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
		
			if "%SelectedSourceOS%" equ "w10" (
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			
				if "%ImageBuild%" geq "17134" (
					if exist "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
						echo.-------------------------------------------------------------------------------
						echo.¼¯³É WinPE - Appx Packaging [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
					)
				
					if exist "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
						echo.-------------------------------------------------------------------------------
						echo.¼¯³É WinPE - Opc Services [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\Microsoft-Windows-WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
					)
				
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Appx Packaging [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-AppxPackaging-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)

				if "%ImageBuild%" geq "15063" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - AT Broker [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-ATBroker-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Audio Core [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-AudioCore-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Audio Drivers [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-AudioDrivers-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)
			)
		
			if "%SelectedSourceOS%" neq "w7" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Enhanced Storage Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-EnhancedStorage-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
		
			if "%SelectedSourceOS%" equ "w81" if exist "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - IBS Provider Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-IbsProvider-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			)
	
			if "%SelectedSourceOS%" equ "w10" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - HTA Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-HTA-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			
				if "%ImageBuild%" geq "15063" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Narrator [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Narrator-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)
		
				if "%ImageBuild%" geq "17134" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Opc Services [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-OpcServices-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)
			)
		
			if "%SelectedSourceOS%" neq "w7" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Rejuv Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Rejuv-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
		
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - Scripting Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Scripting-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

			if "%SelectedSourceOS%" neq "w7" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Secure Startup Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SecureStartup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
		
			if "%SelectedSourceOS%" equ "w7" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Setup Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Setup-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Setup Client Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Setup-Client-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			)
		
			if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "17134" (
				for /d %%z in (de-DE, en-GB, en-IN, 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 - Speech TextToSpeech [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-%LanguagePackCode%-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
					)
				)
			)
		
			if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "15063" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Speech TextToSpeech [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-Speech-TTS-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - SRH [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SRH-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
	
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - SRT Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-SRT-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
	
			if "%SelectedSourceOS%" neq "w7" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - Storage WMI Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
				if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-StorageWMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)
	
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - WDS Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WDS-Tools-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"

			if "%SelectedSourceOS%" equ "w10" if exist "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É WinPE - WiFi Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WiFi-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WinPE - WMI Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
			if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-WMI-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
			
			for /d %%z in (ja-JP, ko-KR, zh-HK, zh-CN, zh-TW) do (
				if "%LanguagePackCode%" equ "%%z" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É WinPE - Font Support Pack [%LanguagePackCode%] µ½ Windows »Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
					if "%SelectedSourceOS%" equ "w7" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.1.7601.%PackageServicePackBuild%.cab"
					if "%SelectedSourceOS%" equ "w81" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~6.3.9600.%PackageServicePackBuild%.cab"
					if "%SelectedSourceOS%" equ "w10" call :AddPackage "%WinReMount%\%%i", "%LanguagePacks%\WinPE-FontSupport-Package~31bf3856ad364e35~%PackageArchitecture%~%LanguagePackCode%~10.0.%PackageBuild%.%PackageServicePackBuild%.cab"
				)
			)

			echo.-------------------------------------------------------------------------------
			echo.Éú³É Windows »Ö¸´ÓïÑÔ°ü¼¯³ÉÈÕÖ¾ÎÄ¼þ...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.±àÐ´ Windows »Ö¸´ÓïÑÔ°ü¼¯³ÉÈÕÖ¾...
			echo.
			call :GetPackages "%WinReMount%\%%i", "LanguagePacks_Install_WinRE.txt"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####ÇåÀíÁÙÊ±ÎÄ¼þ ^& ÎÄ¼þ¼Ð######################################
echo.-------------------------------------------------------------------------------
echo.
echo.ÇåÀíÁÙÊ±ÎÄ¼þ¼Ð...
call :RemoveFolder "%Temp%\LanguagePacks"
echo.
echo.-------------------------------------------------------------------------------
if "%LanguagePackType%" equ "Boot" echo.####Finished ¼¯³É Windows ÓïÑÔ°üµ½ Windows Æô¶¯Ó³Ïñ##########
if "%LanguagePackType%" equ "Install" echo.####Finished ¼¯³É Windows ÓïÑÔ°üµ½ Windows °²×°Ó³Ïñ##
if "%LanguagePackType%" equ "Recovery" echo.####Finished ¼¯³É Windows ÓïÑÔ°üµ½ Windows »Ö¸´Ó³Ïñ######
echo.-------------------------------------------------------------------------------

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

set LanguagePacks=
set LanguagePackType=
set LanguagePackCode=
set PackageArchitecture=
set PackageBuild=
set PackageServicePackBuild=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Drivers
::-------------------------------------------------------------------------------------------
:IntDrivers

setlocal

set DriverType=

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¼¯³É 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 ToolKit - ¼¯³É Windows Çý¶¯³ÌÐòÏò Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
if "%DriverType%" equ "Install" echo.    MSMG ToolKit - ¼¯³É Windows Çý¶¯³ÌÐòµ½ Windows °²×°Ó³Ïñ
if "%DriverType%" equ "Recovery" echo.      MSMG ToolKit - ¼¯³É Windows Çý¶¯³ÌÐòµ½ Windows »Ö¸´Ó³Ïñ
echo.===============================================================================
echo.

if "%DriverType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Î´Ñ¡ÔñW indows °²×°³ÌÐòÆô¶¯Ó³Ïñ...
	echo.
	echo.Ñ¡ÔñÔ´Ê±£¬ÇëÑ¡Ôñ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ...
	goto :Stop
)

if "%DriverType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Î´Ñ¡Ôñ Windows »Ö¸´Ó³Ïñ...
	echo.
	echo.Ñ¡ÔñÀ´Ô´Ê±£¬ÇëÑ¡Ôñ Windows »Ö¸´Ó³Ïñ...
	goto :Stop
)

:: Getting Source Image Index Architecture
if "%DriverType%" equ "Boot" call :GetImageArchitecture "%BootWim%", 1 >nul

if "%DriverType%" equ "Install" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
	)
)

if "%DriverType%" equ "Recovery" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%WinReMount%\%%i" call :GetImageArchitecture "%WinReMount%\%%i\%WinReWim%", 1 >nul
	)
)

:: Settings Windows Drivers folder path
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%"

:: Checking whether Windows Drivers folder is empty
for /f %%i in ('dir /b /s /a:-d "%Drivers%\*.*" 2^>nul ^| find /v /c ""') do (
	if "%%i" equ "0" (
		if "%DriverType%" equ "Boot" echo.Windows Çý¶¯³ÌÐòÎÄ¼þ¼Ð ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> Îª¿Õ...
		if "%DriverType%" equ "Install" echo.Windows Çý¶¯³ÌÐòÎÄ¼þ¼Ð ^<Drivers\Install\%SelectedSourceOS%\%ImageArchitecture%^> Îª¿Õ...
		if "%DriverType%" equ "Recovery" echo.Windows Çý¶¯³ÌÐòÎÄ¼þ¼Ð ^<Drivers\WinPE\%SelectedSourceOS%\%ImageArchitecture%^> Îª¿Õ...
		echo.
		echo.Çë½« Windows Çý¶¯³ÌÐòÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####¿ªÊ¼½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows Æô¶¯Ó³Ïñ#################
if "%DriverType%" equ "Install" echo.####¿ªÊ¼½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows °²×°Ó³Ïñ#########
if "%DriverType%" equ "Recovery" echo.####¿ªÊ¼½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows »Ö¸´Ó³Ïñ#############
echo.-------------------------------------------------------------------------------
echo.
if "%DriverType%" equ "Boot" (
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 2
)
if "%DriverType%" equ "Install" (
	echo.    Image                    : Install.wim
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
)
if "%DriverType%" equ "Recovery" (
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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.-------------------------------------------------------------------------------

if "%DriverType%" equ "Boot" (
	echo.
	echo.=============================[Boot.wim, Index : 2]=============================
	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, Index : %%i]============================
			if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
			call :AddDriver "%InstallMount%\%%i", "%Drivers%"
		)
	)
)

if "%DriverType%" equ "Recovery" (
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%WinReMount%\%%i" (
			echo.
			if not %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]=====================
			if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
			call :AddDriver "%WinReMount%\%%i", "%Drivers%"
		)
	)
)

echo.-------------------------------------------------------------------------------
if "%DriverType%" equ "Boot" echo.####Íê³É½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows Æô¶¯Ó³Ïñ#################
if "%DriverType%" equ "Install" echo.####Íê³É½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows °²×°Ó³Ïñ#########
if "%DriverType%" equ "Recovery" echo.####Íê³É½« Windows Çý¶¯³ÌÐò¼¯³Éµ½ Windows »Ö¸´Ó³Ïñ#############
echo.-------------------------------------------------------------------------------

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

set Drivers=
set DriverType=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 3.5
::-------------------------------------------------------------------------------------------
:IntNetFX35

setlocal

set PackageArchitecture=

cls
echo.===============================================================================
echo.            MSMG ToolKit - ¼¯³É Microsoft .NET Framework 3.5
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Service Pack Build
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
	if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"
)

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm" set "PackageArchitecture=arm"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Setting Microsoft .NET Framework 3.5 Feature Pack folder path according to Source Image Architecture
if exist "%DVD%\sources\sxs" (
	if "%SelectedSourceOS%" equ "w81" set "NetFX35=%DVD%\sources\sxs"
	if "%SelectedSourceOS%" equ "w10" (
		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 (
	if "%SelectedSourceOS%" equ "w81" set "NetFX35=%NetFX35%\%SelectedSourceOS%\%ImageArchitecture%"
	if "%SelectedSourceOS%" equ "w10" set "NetFX35=%NetFX35%\%SelectedSourceOS%\10.0.%ImageBuild%\Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
)

:: Checking whether Microsoft .NET Framework 3.5 Feature Pack folder exist
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
)

:: Checking whether Microsoft .NET Framework 3.5 Feature Pack folder exist
if "%SelectedSourceOS%" equ "w10" if not exist %NetFX35% (
	echo.Microsoft .NET Framework 3.5 Pack ÎÄ¼þ¶ªÊ§...
	echo.
	if "%ImageBuild%" leq "16299" echo.Either copy the "microsoft-windows-netfx3-ondemand-package.cab" ÎÄ¼þ´ÓÀ´Ô´ DVD µ½ ^<DVD\sources\sxs^> ÎÄ¼þ¼Ð
	if "%ImageBuild%" geq "17134" echo.Either copy the "microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~%PackageArchitecture%~~.cab" ÎÄ¼þ´ÓÀ´Ô´ DVD µ½ ^<DVD\sources\sxs^> ÎÄ¼þ¼Ð
	echo.
	echo.»ò½«ÏÂÃæµÄ ToolKit Pack ÎÄ¼þ¸´ÖÆµ½ ^<Packs\NetFX35\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð..
	echo.
	echo."Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	goto :Stop
)

if "%SelectedSourceOS%" equ "w10" 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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%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%
				echo.
			) else (
				echo.Microsoft .NET Framework 3.5 ÒÑ¾­ÆôÓÃ¡£
			)
		)
		if "%SelectedSourceOS%" equ "w10" (
			%DISM% /Image:"%InstallMount%\%%i" /Get-FeatureInfo /FeatureName:NetFx3 | findstr /c:"State : Enabled" >nul
			if errorlevel 1 (
				echo.Microsoft .NET Framework 3.5 Î´ÆôÓÃ¡£
				echo.
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.5 °ü...
				echo.-------------------------------------------------------------------------------
				%DISM% /Image:"%InstallMount%\%%i" /Add-Package:%NetFX35%
				echo.
			) else (
				echo.Microsoft .NET Framework 3.5 ÒÑ¾­ÆôÓÃ¡£
			)
		)
	)
)

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

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft .NET Framework 3.5##########################
echo.-------------------------------------------------------------------------------
echo.

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

set NetFX35=
set PackageArchitecture=
set PackageServicePackBuild=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 4.6.2 for Windows 10 v1507 & v1511 Source OS
::-------------------------------------------------------------------------------------------
:IntNetFX462

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - ¼¯³É Microsoft .NET Framework 4.6.2
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Image Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
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
)

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
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
	)
)

:: Checking whether Microsoft .NET Framework 4.6.2 Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft .NET Framework 4.6.2 Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if exist "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft .NET Framework 4.6.2 [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Microsoft-Windows-NetFX462-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%.cab"
		)

		if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft .NET Framework 4.6.2 ¸üÐÂÊý¾Ý°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4051600-%ImageArchitecture%.cab"
		)

		if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Core" if "%ImageEdition%" neq "CoreN" if "%ImageEdition%" neq "CoreSingleLanguage" if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "ProfessionalN" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft .NET Framework 4.6.2 ¸üÐÂÊý¾Ý°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%NetFX462%\Windows10.0-KB4054057-%ImageArchitecture%.cab"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft .NET Framework 4.6.2########################
echo.-------------------------------------------------------------------------------

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

set NetFX462=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET Framework 4.8
::-------------------------------------------------------------------------------------------
:IntNetFX48

setlocal

set NetFX48Pkg=
set NetFX48LpPkg=

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Microsoft .NET Framework 4.8
echo.===============================================================================
echo.

:: Setting Microsoft .NET Framework 4.8 Pack folder path
set "NetFX48=%NetFX48%\%SelectedSourceOS%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Image Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm" set "PackageArchitecture=arm"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Setting Image Package ServicePackBuildLevel
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "14393" set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
	if "%ImageBuild%" equ "14393" set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.14393.0.cab"
	if "%ImageBuild%" equ "15063" set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.cab"
	if "%ImageBuild%" equ "15063" set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.14393.0.cab"
	if "%ImageBuild%" equ "16299" set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
	if "%ImageBuild%" equ "16299" set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.16299.15.cab"
	if "%ImageBuild%" equ "17134" set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
	if "%ImageBuild%" equ "17134" set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.16299.15.cab"
	if "%ImageBuild%" equ "17763" set "NetFX48Pkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.cab"
	if "%ImageBuild%" equ "17763" set "NetFX48LpPkg=Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~10.0.16299.15.cab"
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
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
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
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
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
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
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
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
)

:: Checking whether Microsoft .NET Framework 4.8 Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			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.-------------------------------------------------------------------------------
			if "%ImageArchitecture%" equ "x86" call :ApplyImage "%NetFX48%\NetFX48.tpk", 1, "%InstallMount%\%%i"
			if "%ImageArchitecture%" equ "x64" call :ApplyImage "%NetFX48%\NetFX48.tpk", 2, "%InstallMount%\%%i"

			if exist "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				if "%ImageArchitecture%" equ "x86" call :ApplyImage "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk", 1, "%InstallMount%\%%i"
				if "%ImageArchitecture%" equ "x64" call :ApplyImage "%NetFX48%\NetFX48_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			)

			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft .NET Framework 4.8 ×¢²á±íÉèÖÃ...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.°²×°Ó³Ïñ×¢²á±í...
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
			call :ImportRegistry2Image "%NetFX48%\NetFX48_%ImageArchitecture%.reg"

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

			echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
			call :UnMountImageRegistry
			echo.
		)

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

			if exist "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
				echo.
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 4.8 »ù±¾°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\Microsoft-Windows-NetFX48-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			)
		)

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

			if exist "%NetFX48%\%NetFX48LpPkg%" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 4.8 »ù±¾°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48Pkg%"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 4.8 [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%NetFX48%\%NetFX48LpPkg%"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft .NET Framework 4.8##########################
echo.-------------------------------------------------------------------------------

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

set NetFX48=
set NetFX48Pkg=
set NetFX48LpPkg=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft .NET 5
::-------------------------------------------------------------------------------------------
:IntNET5

setlocal

cls
echo.===============================================================================
echo.               MSMG ToolKit - ¼¯³É Microsoft .NET 5
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether Microsoft .NET 5 Pack file exist
if not exist "%NET5%\NET5_%SelectedSourceOS%.tpk" (
	echo.Microsoft .NET 5 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."NET5_%SelectedSourceOS%.tpk"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\NET5^> ÎÄ¼þ¼Ð...
	goto :Stop
)

if not exist "%NET5%\NET5_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Microsoft .NET 5 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."NET5_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\NET5^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft .NET 5######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft .NET 5###############################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft .NET 5 °ü...
		echo.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%NET5%\NET5_%SelectedSourceOS%.tpk", 1, "%InstallMount%\%%i"
		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%NET5%\NET5_%SelectedSourceOS%.tpk", 2, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.µ¼Èë Microsoft .NET 5 ×¢²á±íÉèÖÃ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.¹ÒÔØÓ³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%NET5%\NET5_%SelectedSourceOS%_%ImageArchitecture%.reg"

		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft .NET 5######################################
echo.-------------------------------------------------------------------------------

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

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Internet Explorer 11
::-------------------------------------------------------------------------------------------
:IntIE11

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É Microsoft Internet Explorer 11
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Image Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
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
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
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
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
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
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
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
)

:: Checking whether Microsoft Internet Explorer 11 Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		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 Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-InternetExplorer-Package~31bf3856ad364e35~%PackageArchitecture%.cab"

		if "%ImageDefaultLanguage%" equ "en-US" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Internet Explorer 11 Hyphenation Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~en-US.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Internet Explorer 11 Spelling Package...
			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 Hyphenation Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Hyphenation-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft Internet Explorer 11 Hyphenation Package...
				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 Spelling Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~%ImageDefaultLanguage%.cab"
			) else (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft Internet Explorer 11 Spelling Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%IE11%\Microsoft-Windows-IE-Spelling-Package~31bf3856ad364e35~en-US.cab"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Internet Explorer 11##################################
echo.-------------------------------------------------------------------------------

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

set IE11=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Remote Desktop Protocol (RDP) 8.0 & 8.1
::-------------------------------------------------------------------------------------------
:IntRDP81

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - ¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Image Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RDP81^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RDP81^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Remote Desktop Protocol (RDP) 8.0 & 8.1 Pack file exist
if not exist "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RDP81^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1###############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Remote Desktop Protocol ^(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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 ±Ø±¸Ì×¼þ...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 ±Ø±¸Ì×¼þ...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-WinIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1 °ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%RDP81%\Microsoft-Windows-RDP-BlueIP-Package~31bf3856ad364e35~%PackageArchitecture%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Remote Desktop Protocol ^(RDP^) 8.0 ^& 8.1###############
echo.-------------------------------------------------------------------------------

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

set RDP81=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Management Framework (WMF) 5.1
::-------------------------------------------------------------------------------------------
:IntWMF

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - ¼¯³É Windows Management Framework ^(WMF^) 5.1
echo.===============================================================================
echo.

:: Setting Windows Management Framework (WMF) 5.1 Pack folder path accroding to selected Source OS
set "WMF=%WMF%\%SelectedSourceOS%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
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
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
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
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
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
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
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
)

:: Checking whether Windows Management Framework (WMF) 5.1 Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			if "%ImageArchitecture%" equ "x64" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Management Framework ^(WMF^) 5.1 ±Ø±¸Ì×¼þ...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2809215-%ImageArchitecture%.cab"
			)

			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Management Framework ^(WMF^) 5.1 ±Ø±¸Ì×¼þ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB2872035-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Management Framework ^(WMF^) 5.1 ±Ø±¸Ì×¼þ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3033929-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Management Framework ^(WMF^) 5.1 Feature Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%WMF%\Windows6.1-KB3191566-%ImageArchitecture%.cab"
		)

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

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows Management Framework ^(WMF^) 5.1################
echo.-------------------------------------------------------------------------------

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

set WMF=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Win32 Calculator
::-------------------------------------------------------------------------------------------
:IntWin32Calc

setlocal

set PackageArchitecture=

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É Microsoft Win32 Calculator
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Index
if "%ImageArchitecture%" equ "x86" set "PackageIndex=1"
if "%ImageArchitecture%" equ "x64" set "PackageIndex=2"
if "%ImageArchitecture%" equ "arm64" set "PackageIndex=3"

:: Checking whether Microsoft Win32 Calculator Pack file exist
if not exist "%Win32Calc%\Win32Calc.tpk" (
	echo.Microsoft Win32 Calculator °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Win32Calc.tpk"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Win32Calc^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft Win32 Calculator Pack file exist
if not exist "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft Win32 Calculator °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Win32Calc_%ImageDefaultLanguage%.tpk"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Win32Calc^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft Win32 Calculator Pack file exist
if not exist "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg" (
	echo.Microsoft Win32 Calculator °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Win32Calc_%ImageArchitecture%.reg"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Win32Calc^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Win32 Calculator############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft Win32 Calculator#####################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft Win32 Calculator Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Win32Calc%\Win32Calc.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft Win32 Calculator [%ImageDefaultLanguage%] ÓïÑÔ°ü...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%Win32Calc%\Win32Calc_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft Win32 Calculator Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%Win32Calc%\Win32Calc_%ImageArchitecture%.reg"
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Win32 Calculator############################
echo.-------------------------------------------------------------------------------

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

set Win32Calc=
set PackageIndex=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Data Deduplication
::-------------------------------------------------------------------------------------------
:IntDedup

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É Windows ÖØ¸´Êý¾ÝÉ¾³ý
echo.===============================================================================
echo.

set "FSSMRESReg=%Dedup%\fssmres.dll.reg"

:: Setting Windows Data Deduplication Pack folder path accroding to selected Source OS
if "%SelectedSourceOS%"=="w81" set "Dedup=%Dedup%\%SelectedSourceOS%"
if "%SelectedSourceOS%"=="w10" set "Dedup=%Dedup%\%SelectedSourceOS%\10.0.%ImageBuild%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Service Pack Build
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
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~%ImageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab" (
		echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
		echo.
		echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

:: Checking whether Windows Data Deduplication Pack file exist
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%~%ImageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
				echo.
				echo."Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
				goto :Stop
			)

			if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
				echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
				echo.
				echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.
				echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
				goto :Stop
			)
		)
	)
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Data Deduplication Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "16299" if not exist "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Data Deduplication °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Dedup\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows ÖØ¸´Êý¾ÝÉ¾³ý############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows File Server Base Package....
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows File Server [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Deduplication Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Deduplication [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~6.3.9600.16384.cab"
		)

		if "%SelectedSourceOS%" equ "w10" (
			if "%ImageBuild%" equ "10586" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows File Server Base Package....
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%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 File Server [en-US] ÓïÑÔ°ü...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%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 File Server [%ImageDefaultLanguage%] ÓïÑÔ°ü...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
					)
				)

				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%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 Deduplication [en-US] ÓïÑÔ°ü...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%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 Deduplication [%ImageDefaultLanguage%] ÓïÑÔ°ü...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
					)
				)
			)

			if "%ImageBuild%" equ "14393" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows ÎÄ¼þ·þÎñÆ÷ºËÐÄ»ù±¾Èí¼þ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows File Server Core [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"

				if exist "%Dedup%\Updates\*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows Deduplication Update Package...
					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~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows File Server Core [en-US] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication [en-US] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~%ImageVersion%.%PackageServicePackBuild%.cab"
			)

			if "%ImageBuild%" geq "16299" (
				echo.--------------------ÎÄ¼þ·þÎñÆ÷ºËÐÄ-----------------------------------------------------------
				echo.¼¯³É Windows »ù±¾Èí¼þ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows ÎÄ¼þ·þÎñÆ÷ºËÐÄ [en-US] °ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-FileServer-ServerCore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication Base Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Deduplication [en-US] Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%Dedup%\Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
			)
		)

		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%" equ "w10" call :EnableFeature "%InstallMount%\%%i", "Dedup-Core /All"

		echo.-------------------------------------------------------------------------------
		echo.µ¼Èë Windows ÎÄ¼þ·þÎñÆ÷ ^(fssmres.dll^) ÐÞ¸´×¢²á±íÉèÖÃ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%FSSMRESReg%"
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows ÖØ¸´Êý¾ÝÉ¾³ý############################
echo.-------------------------------------------------------------------------------

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

set Dedup=
set PackageServicePackBuild=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows To Go Workspace
::-------------------------------------------------------------------------------------------
:IntWinToGo

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - ¼¯³É Windows To Go Workspace
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Windows To Go Workspace Pack path
if "%SelectedSourceOS%" equ "w81" set "WinToGo=%WinToGo%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" set "WinToGo=%WinToGo%\%SelectedSourceOS%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
	if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
)

:: Setting Package Index and Architecture
if "%ImageArchitecture%" equ "x86" (
	set "PackageIndex=1"
	set "PackageArchitecture=x86"
)

if "%ImageArchitecture%" equ "x64" (
	set "PackageIndex=2"
	set "PackageArchitecture=amd64"
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%WinToGo%\WTG.tpk" (
	echo.Windows To Go ¹¤×÷°üÎÄ¼þ "WTG.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\WinToGo\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
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
)

:: Checking whether Windows To Go Workspace Pack file exist
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
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go ¹¤×÷°üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\WinToGo\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows To Go Workspace Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows To Go ¹¤×÷°üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo.Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\WinToGo\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows To Go Workspace###############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows To Go Workspace########################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w81" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows To Go Workspace Base Package...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows To Go Workspace [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%WinToGo%\WTG_%ImageDefaultLanguage%.tpk", %PackageIndex%, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows To Go Workspace Registry Settings...
			echo.-------------------------------------------------------------------------------
			echo.
			echo.°²×°Ó³Ïñ×¢²á±í...
			call :MountImageRegistry "%InstallMount%\%%i"
			echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
			call :ImportRegistry2Image "%WinToGo%\WTG_%ImageArchitecture%.reg"
			echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
			call :UnMountImageRegistry
		)

		if "%SelectedSourceOS%" equ "w10" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows To Go Workspace Base Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows To Go Workspace [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", %WinToGo%\Microsoft-Windows-PortableWorkspaces-Creator-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows To Go Workspace###############################
echo.-------------------------------------------------------------------------------

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

set WinToGo=
set PackageServicePackBuild=
set PackageIndex=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows System Restore
::-------------------------------------------------------------------------------------------
:IntSystemRestore

setlocal

cls
echo.===============================================================================
echo.               MSMG ToolKit - ¼¯³É Windows ÏµÍ³»Ö¸´
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Windows System Restore Pack Path
if "%SelectedSourceOS%" equ "w7" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" set "SystemRestore=%SystemRestore%\%SelectedSourceOS%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%SelectedSourceOS%" equ "w7" set "PackageServicePackBuild=17514"

if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
)

:: Checking whether Windows System Restore Pack file exist
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows System Restore °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\SystemRestore\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	if "%SelectedSourceOS%" equ "w10" echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\SystemRestore\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows System Restore Pack file exist
if not exist "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows System Restore °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	if "%SelectedSourceOS%" equ "w7" echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\SystemRestore\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	if "%SelectedSourceOS%" equ "w10" echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\SystemRestore\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows ÏµÍ³»Ö¸´################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows System Restore#########################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows System Restore Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows System Restore [%ImageDefaultLanguage%] ÓïÑÔ°ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%SystemRestore%\Microsoft-Windows-SystemRestore-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows ÏµÍ³»Ö¸´################################
echo.-------------------------------------------------------------------------------

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

set SystemRestore=
set PackageServicePackBuild=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Edge Classic Browser
::-------------------------------------------------------------------------------------------
:IntEdgeClassic

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - ¼¯³É Microsoft Edge Classic Browser
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Microsoft Edge Classic Browser Pack path
set "EdgeClassic=%EdgeClassic%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Microsoft Edge Classic Browser Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge Classic Browser °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\EdgeBrowser\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft Edge Classic Browser Pack file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Microsoft Edge Classic Browser °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\EdgeBrowser\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Edge Classic Browser########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft Edge Classic Browser#################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Classic Browser Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft Edge Classic Browser [%ImageDefaultLanguage%] ÓïÑÔ°ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%EdgeClassic%\Microsoft-Windows-Internet-Browser-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"

		:: Importing Registry Fix to Enable Integrating Windows 10 Cumulative Update.
		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%~~%ImageVersion%.%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%~~%ImageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.mum" /f >nul
					reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%PackageServicePackBuild%" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.mum" /f >nul
				reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseNEdition~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%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%~~%ImageVersion%.%PackageServicePackBuild%" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
				call :UnMountImageRegistry
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Edge Classic Browser########################
echo.-------------------------------------------------------------------------------

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

set EdgeClassic=
set PackageServicePackBuild=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Edge Chromium Browser
::-------------------------------------------------------------------------------------------
:IntEdgeChromium

setlocal

set "EdgeChrGPD=%EdgeChromium%\GroupPolicy"

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Microsoft Edge Chromium Browser
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Microsoft Edge Chromium Browser Pack Path
if "%SelectedSourceOS%" neq "w10" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" leq "17763" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%\10.0.%ImageBuild%"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%\10.0.18362"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" set "EdgeChromium=%EdgeChromium%\%SelectedSourceOS%\10.0.19041"
)

:: Checking whether Microsoft Edge Chromium Browser Pack file exist
if not exist "%EdgeChromium%\Windows*-%ImageArchitecture%.cab" (
	echo.Microsoft Edge Chromium Browser Pack folder is empty...
	echo.
	echo.Çë¸´ÖÆ the file to ^<Packs\EdgeChromium\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%SelectedSourceOS%" equ "w7" if not exist "%EdgeChromium%\Windows6.1-KB4490628-%ImageArchitecture%.cab" (
	for %%i in (KB4490628,KB4474419,KB4550735) do (
		if not exist "%EdgeChromium%\Windows6.1-%%i-%ImageArchitecture%.cab" (
			echo.Microsoft Edge Chromium Browser °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
			echo.
			echo."Windows6.1-%%i-%ImageArchitecture%.cab"
			echo.
			echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\EdgeChromium\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
			goto :Stop
		)
	)
)

if not exist "%EdgeChrGPD%\EdgeChrGPD.tpk" (
	echo.Microsoft Edge Chromium Browser °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo.EdgeChrGPD.tpk
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\EdgeChromium\GroupPolicy^> ÎÄ¼þ¼Ð...
	goto :Stop
)

for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
	if "%ImageDefaultLanguage%" equ "%%k" (
		if not exist "%EdgeChrGPD%\EdgeChrGPD_%%k.tpk" (
			echo.Microsoft Edge Chromium Browser °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
			echo.
			echo.EdgeChrGPD_%%k.tpk
			echo.
			echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\EdgeChromium\GroupPolicy^> ÎÄ¼þ¼Ð...
			goto :Stop
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Edge Chromium Browser#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft Edge Chromium Browser################################
echo.-------------------------------------------------------------------------------
echo.
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" equ "w7" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Servicing Stack Update ^(SSU^) ^(KB4490628^) Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4490628-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows SHA-2 Code Update ^(KB4474419^) Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4474419-v3-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Servicing Stack Update ^(SSU^) ^(KB4550735^) Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4550735-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Edge Chromium Browser Package...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\Windows6.1-KB4567409-%ImageArchitecture%.cab"
		)

		if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Edge Chromium Browser Package...
			echo.-------------------------------------------------------------------------------
			for /f %%j IN ('"dir /b %EdgeChromium%\Windows*-%ImageArchitecture%.cab" 2^>nul') do (
				call :AddPackage "%InstallMount%\%%i", "%EdgeChromium%\%%j"
			)
		)

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft Edge Chromium Browser Group Policy Base Package...
		echo.-------------------------------------------------------------------------------
		call :ApplyImage "%EdgeChrGPD%\EdgeChrGPD.tpk", 1, "%InstallMount%\%%i"

		for /d %%k in (cs-CZ,da-DK,de-DE,el-GR,en-US,es-ES,fi-FI,fr-FR,hu-HU,it-IT,ja-JP,ko-KR,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ru-RU,sv-SE,tr-TR,zh-CN,zh-TW) do (
			if "%ImageDefaultLanguage%" equ "%%k" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft Edge Chromium Browser Group Policy [%%k] Package...
				echo.-------------------------------------------------------------------------------
				call :ApplyImage "%EdgeChrGPD%\EdgeChrGPD_%%k.tpk", 1, "%InstallMount%\%%i"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Edge Chromium Browser#######################
echo.-------------------------------------------------------------------------------

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

set EdgeChrGPD=
set EdgeChromium=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Accessibility Braille
::-------------------------------------------------------------------------------------------
:IntBraille

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - ¼¯³É Windows Accessibility Braille
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Braille Pack Path
set "Braille=%Braille%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Checking whether Windows Accessibility Braille Pack file exist
if not exist "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Accessibility Braille °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Braille\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	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%~~%ImageVersion%.%PackageServicePackBuild%.cab" "%Temp%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows Accessibility Braille#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows Accessibility Braille##################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%Braille%\Microsoft-Windows-Accessibility-Braille-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%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 Accessibility Braille#########################
echo.-------------------------------------------------------------------------------

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

set Braille=
set PackageServicePackBuild=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: ¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷
::-------------------------------------------------------------------------------------------
:IntMMRC

setlocal

cls
echo.===============================================================================
echo.       MSMG ToolKit - ¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Multimedia Restricted Codecs Pack path
set "MMRC=%MMRC%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if "%ImageBuild%" leq "17763" if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if "%ImageBuild%" leq "17763" if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Multimedia Restricted Codecs Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Multimedia Restricted Codecs Pack ÎÄ¼þ¼ÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MultimediaRestrictedCodecs\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷##################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷»ù±¾³ÌÐò°ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷ [%ImageDefaultLanguage%] ÓïÑÔ°ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------

		if "%ImageArchitecture%" equ "x64" (
			echo.¼¯³É Windows ¶àÃ½ÌåÏÞÖÆ±à½âÂëÆ÷ WOW64 »ù±¾³ÌÐò°ü...
			echo.-------------------------------------------------------------------------------
			if "%ImageBuild%" leq "17763" call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
			if "%ImageBuild%" geq "18362" call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷ WOW64 [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			if "%ImageBuild%" leq "17763" call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
			if "%ImageBuild%" geq "18362" call :AddPackage "%InstallMount%\%%i", "%MMRC%\Multimedia-RestrictedCodecsExt-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows ¶àÃ½ÌåÊÜÏÞ±à½âÂëÆ÷##################
echo.-------------------------------------------------------------------------------

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

set MMRC=
set PackageServicePackBuild=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Subsystem for Linux ^(WSL^)
::-------------------------------------------------------------------------------------------
:IntWSL

setlocal

cls
echo.===============================================================================
echo.        MSMG ToolKit - ¼¯³ÉÊÊÓÃÓÚ Linux µÄ Windows ×ÓÏµÍ³ ^(WSL^)
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Windows Subsystem for Linux (WSL) Pack Path
set "WSL=%WSL%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Checking whether Windows Subsystem for Linux (WSL) Pack file exist
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Linux µÄ Windows ×ÓÏµÍ³ ^(WSL^) °üÎÄ¼þ¼ÐÖÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\WSL\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Subsystem for Linux (WSL) Pack file exist
if not exist "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Linux µÄ Windows ×ÓÏµÍ³ ^(WSL^) °üÎÄ¼þ¼ÐÖÐÈ±ÉÙÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\WSL\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Îª Linux ¼¯³É Windows ×ÓÏµÍ³ ^(WSL^)#####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows Subsystem for Linux ^(WSL^) Base Package...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows Subsystem for Linux ^(WSL^) [%ImageDefaultLanguage%] ÓïÑÔ°ü...
		echo.-------------------------------------------------------------------------------
		call :AddPackage "%InstallMount%\%%i", "%WSL%\Microsoft-Windows-Lxss-Optional-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows Subsystem for Linux ^(WSL^) Feature...
		echo.-------------------------------------------------------------------------------
		call :EnableFeature "%InstallMount%\%%i", "Microsoft-Windows-Subsystem-Linux /All"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows Subsystem for Linux ^(WSL^)#####################
echo.-------------------------------------------------------------------------------

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

set PackageServicePackBuild=
set WSL=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Open Secure Shell (SSH) Client & Server
::-------------------------------------------------------------------------------------------
:IntOpenSSH

setlocal

cls
echo.===============================================================================
echo.      MSMG ToolKit - ¼¯³É Open Secure Shell ^(SSH^) Client ^& Server
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Open Secure Shell Pack Path
set "OpenSSH=%OpenSSH%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Checking whether Open Secure Shell (SSH) Client Pack file exist
if not exist "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH Client ^& Server °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\OpenSSH\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Open Secure Shell (SSH) Server Pack file exist
if not exist "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.OpenSSH Client ^& Server °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\OpenSSH\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	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%~~%ImageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
	copy /y "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab" >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Open Secure Shell ^(SSH^) Client ^& Server##############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Open Secure Shell ^(SSH^) Client ^& Server#######################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating OpenSSH Client Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Client-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
		echo.-------------------------------------------------------------------------------
		echo.Integrating OpenSSH Server Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageBuild%" leq "17134" call :AddPackage "%InstallMount%\%%i", "%OpenSSH%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
		if "%ImageBuild%" geq "17763" call :AddPackage "%InstallMount%\%%i", "%Temp%\OpenSSH-Server-Package~31bf3856ad364e35~%PackageArchitecture%~~.cab"
	)
)

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

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Open Secure Shell ^(SSH^) Client ^& Server##############
echo.-------------------------------------------------------------------------------

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

set OpenSSH=
set PackageServicePackBuild=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Media Feature Pack
::-------------------------------------------------------------------------------------------
:IntMediaFeaturePack

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É Windows Media Feature Pack
echo.===============================================================================
echo.

:: Setting Windows Media Feature Pack folder path according to selected Source OS
if "%SelectedSourceOS%" neq "w10" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" set "MediaFeaturePack=%MediaFeaturePack%\%SelectedSourceOS%\%ImageVersion%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Service Pack Build
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
	if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
	if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
	if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
	if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"
)

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Media-Format-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.3.9600.16384.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" leq "17763" if not exist "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Media Feature Pack file exist
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Media Feature °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\MediaFeaturePack\%SelectedSourceOS%\%ImageVersion%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows Media Feature Pack############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows Media Feature Pack#####################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		for /d %%j in (StarterN, StarterKN, HomeBasicN, HomeBasicKN, CoreN, CloudN, ProessionalN, ProfessionalKN, ProfessionalEducationN, ProfessionalEducationKN, EnterpriseN, EnterpriseKN, EnterpriseSN, EnterpriseGN, UltimateN, UltimateKN, EducationN, EducationKN) do (
			if "%ImageEdition%" equ "%%j" (
				if "%SelectedSourceOS%" equ "w7" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Microsoft Windows Media Feature Pack OOB Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~6.1.7600.16385.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Microsoft Windows Media Format OOB Package
					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 Media Feature Pack OOB Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Microsoft Windows Media Feature Pack OOB [%ImageDefaultLanguage%] Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-MediaFeaturePack-OOB-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				)

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

					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Microsoft Windows Media Features Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\MediaFeaturePack"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Microsoft Windows Media Features [%ImageDefaultLanguage%] Package
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"

					if "%ImageArchitecture%" equ "x64" (
						echo.-------------------------------------------------------------------------------
						echo.¼¯³É Microsoft Windows Media Features WOW64 Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
						echo.-------------------------------------------------------------------------------
						echo.¼¯³É Microsoft Windows Media Features [%ImageDefaultLanguage%] WOW64 Package...
						echo.-------------------------------------------------------------------------------
						call :AddPackage "%InstallMount%\%%i", "%MediaFeaturePack%\Microsoft-Windows-Media-Features-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
					)

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

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows Media Feature Pack############################
echo.-------------------------------------------------------------------------------

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

set MediaFeaturePack=
set PackageServicePackBuild=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Portable Devices
::-------------------------------------------------------------------------------------------
:IntPortableDevices

setlocal

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¼¯³É Windows Portable Devices
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Windows Portable Devices Pack Path
set "PortableDevices=%PortableDevices%\10.0.%ImageBuild%"

:: Setting Package Service Pack Build
if "%ImageBuild%" equ "10240" set "PackageServicePackBuild=16384"
if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Windows Portable Devices Pack file exist
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" leq "17763" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" leq "17763" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Portable Devices Pack file exist
if "%ImageBuild%" geq "18362" if "%ImageArchitecture%" equ "x64" if not exist "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab" (
	echo.Windows Portable Devices °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PortableDevices\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows Portable Devices##############################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows Portable Devices#######################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		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 Portable Devices Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~~%ImageVersion%.%PackageServicePackBuild%.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Portable Devices [%ImageDefaultLanguage%] ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-Package~31bf3856ad364e35~%PackageArchitecture%~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"

				if "%ImageArchitecture%" equ "x64" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows Portable Devices WOW64 Package...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17763" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~~%ImageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~~%ImageVersion%.%PackageServicePackBuild%.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows Portable Devices [%ImageDefaultLanguage%] Language WOW64 Package...
					echo.-------------------------------------------------------------------------------
					if "%ImageBuild%" leq "17763" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~amd64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
					if "%ImageBuild%" geq "18362" call :AddPackage "%InstallMount%\%%i", "%PortableDevices%\Microsoft-Windows-Portable-Devices-WOW64-Package~31bf3856ad364e35~wow64~%ImageDefaultLanguage%~%ImageVersion%.%PackageServicePackBuild%.cab"
				)
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows Portable Devices##############################
echo.-------------------------------------------------------------------------------

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

set PortableDevices=
set PackageServicePackBuild=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows PowerShell 7.1
::-------------------------------------------------------------------------------------------
:IntPowerShell7

setlocal

cls
echo.===============================================================================
echo.              MSMG ToolKit - ¼¯³É Windows PowerShell 7.1
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether Windows PowerShell 7.1 Pack file exist
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk" (
	echo.Windows PowerShell 7.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."PowerShell7_%SelectedSourceOS%.tpk"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PowerShell7^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows PowerShell 7.1 Pack file exist
if not exist "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg" (
	echo.Windows PowerShell 7.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PowerShell7^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows PowerShell 7.1 Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%PowerShell7%\Windows6.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Windows6.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PowerShell7^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows PowerShell 7.1 Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%PowerShell7%\Windows8.1-KB3118401-%ImageArchitecture%.cab" (
	echo.Windows PowerShell 7.1 °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Windows8.1-KB3118401-%ImageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\PowerShell7^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows PowerShell 7.1################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows PowerShell 7.1#########################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Windows Universal C Runtime ^(CRT^) Package...
			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.1 Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk", 1, "%InstallMount%\%%i"
		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%PowerShell7%\PowerShell7_%SelectedSourceOS%.tpk", 2, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.µ¼Èë Windows PowerShell 7.1 ×¢²á±íÉèÖÃ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%PowerShell7%\PowerShell7_%SelectedSourceOS%_%ImageArchitecture%.reg"
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows PowerShell 7.1################################
echo.-------------------------------------------------------------------------------

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

set PowerShell7=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Remote Server Administration Tool (RSAT)
::-------------------------------------------------------------------------------------------
:IntRSAT

setlocal

set RSATType=

if "%SelectedSourceOS%" equ "w10" (
	cls
	echo.===============================================================================
	echo.   MSMG ToolKit - ¼¯³É Windows Remote Server Administration Tool ^(RSAT^)
	echo.===============================================================================
	echo.
	echo.  [1]  RSAT for Managing targets older than Windows Server, version 1709
	echo.
	echo.  [2]  RSAT for Managing Windows Server, version 1709
	echo.
	echo.  [3]  RSAT for Managing Windows Server, version 1803
	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 ToolKit - ¼¯³É Windows Remote Server Administration Tool ^(RSAT^)
echo.===============================================================================
echo.

:: Setting Windows Remote Server Administration Tool (RSAT) Pack folder path according to selected Source OS
set "RSAT=%RSAT%\%SelectedSourceOS%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RSAT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) for Streaming Media Services Pack file exist
if "%SelectedSourceOS%" equ "w7" if not exist "%RSAT%\Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-MediaServer-Admin-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RSAT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
if "%SelectedSourceOS%" equ "w81" if not exist "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab" (
	echo.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\RSAT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
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.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	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
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
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.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	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
)

:: Checking whether Windows Remote Server Administration Tool (RSAT) Pack file exist
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.Remote Server Administration Tool °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	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 Remote Server Administration Tool ^(RSAT^)######
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows Remote Server Administration Tool ^(RSAT^)###############
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul
		
		:: Checking whether the selected Source OS is a valid editions
		if "%SelectedSourceOS%" equ "w7" (
			for /d %%j in (Professional,Ultimate) do (
				if "%ImageEdition%" equ "%%j" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows Remote Server Administration Tool ^(RSAT^) Package...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%RSAT%\Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel~31bf3856ad364e35~%PackageArchitecture%.cab"
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows RSAT for Streaming Media Services Package...
					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 Remote Server Administration Tool ^(RSAT^)######
echo.-------------------------------------------------------------------------------

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

set RSAT=
set RSATType=
set PackageArchitecture=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
::-------------------------------------------------------------------------------------------
:IntMetroApps

setlocal

set MetroApp=

set Alarms_Appx=
set AppConnector_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 CommunicationsApps_Appx=
set DesktopAppInstaller_Appx=
set FeedbackHub_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_arm_Appx=
set HEIFImageExtension_x86_Appx=
set HEIFImageExtension_x64_Appx=
set HEVCVideoExtension_arm_Appx=
set HEVCVideoExtension_x86_Appx=
set HEVCVideoExtension_x64_Appx=
set HelpAndTips_Appx=
set Maps_Appx=
set Messaging_Appx=
set MixedRealityPortal_Appx=
set MPEG2VideoExtension_arm_Appx=
set MPEG2VideoExtension_x86_Appx=
set MPEG2VideoExtension_x64_Appx=
set OfficeHub_Appx=
set OfficeOneNote_Appx=
set OfficeSway_Appx=
set OneConnect_Appx=
set Paint3D_Appx=
set People_Appx=
set Phone_Appx=
set PhoneCompanion_Appx=
set Photos_Appx=
set Print3D_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set Skype_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set Store_Appx=
set StorePurchase_Appx=
set ThreeDBuilder_Appx=
set ThreeDViewer_Appx=
set VP9VideoExtensions_arm_Appx=
set VP9VideoExtensions_x86_Appx=
set VP9VideoExtensions_x64_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_arm_Appx=
set WebpImageExtension_x86_Appx=
set WebpImageExtension_x64_Appx=
set WiFi_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set Alarms_License=
set AppConnector_License=
set BingFinance_License=
set BingFoodDrink_License=
set BingHealthFitness_License=
set BingMaps_License=
set BingNews_License=
set BingSports_License=
set BingTravel_License=
set BingWeather_License=
set Calculator_License=
set Camera_License=
set CommunicationsApps_License=
set DesktopAppInstaller_License=
set FeedbackHub_License=
set GetHelp_License=
set Getstarted_License=
set HEIFImageExtension_arm_License=
set HEIFImageExtension_x86_License=
set HEIFImageExtension_x64_License=
set HEVCVideoExtension_arm_License=
set HEVCVideoExtension_x86_License=
set HEVCVideoExtension_x64_License=
set HelpAndTips_License=
set Maps_License=
set Messaging_License=
set MixedRealityPortal_License=
set MPEG2VideoExtension_arm_License=
set MPEG2VideoExtension_x86_License=
set MPEG2VideoExtension_x64_License=
set OfficeHub_License=
set OfficeOneNote_License=
set OfficeSway_License=
set OneConnect_License=
set Paint3D_License=
set People_License=
set Phone_License=
set PhoneCompanion_License=
set Photos_License=
set Print3D_License=
set Reader_License=
set ReadingList_License=
set Scan_License=
set ScreenSketch_License=
set Skype_License=
set SolitaireCollection_License=
set SoundRecorder_License=
set StickyNotes_License=
set Store_License=
set StorePurchase_License=
set ThreeDBuilder_License=
set ThreeDViewer_License=
set VP9VideoExtensions_arm_License=
set VP9VideoExtensions_x86_License=
set VP9VideoExtensions_x64_License=
set Wallet_License=
set WebMediaExtensions_License=
set WebpImageExtension_arm_License=
set WebpImageExtension_x86_License=
set WebpImageExtension_x64_License=
set WiFi_License=
set Xbox_License=
set XboxGameOverlay_License=
set XboxGamingOverlay_License=
set XboxIdentityProvider_License=
set XboxLiveGames_License=
set XboxSpeechToTextOverlay_License=
set XboxTCUI_License=
set YourPhone_License=
set ZuneMusic_License=
set ZuneVideo_License=

set DependencyPackagePath=

set AdvertisingXaml_arm_Appx=
set AdvertisingXaml_arm64_Appx=
set AdvertisingXaml_x86_Appx=
set AdvertisingXaml_x64_Appx=
set MediaPlayReadyClient22_arm_Appx=
set MediaPlayReadyClient22_x86_Appx=
set MediaPlayReadyClient22_x64_Appx=
set NETNativeFramework13_arm_Appx=
set NETNativeFramework13_x86_Appx=
set NETNativeFramework13_x64_Appx=
set NETNativeFramework16_arm_Appx=
set NETNativeFramework16_x86_Appx=
set NETNativeFramework16_x64_Appx=
set NETNativeFramework17_arm_Appx=
set NETNativeFramework17_x86_Appx=
set NETNativeFramework17_x64_Appx=
set NETNativeFramework21_arm_Appx=
set NETNativeFramework21_x86_Appx=
set NETNativeFramework21_x64_Appx=
set NETNativeFramework22_arm_Appx=
set NETNativeFramework22_arm64_Appx=
set NETNativeFramework22_x86_Appx=
set NETNativeFramework22_x64_Appx=
set NETNativeRuntime13_arm_Appx=
set NETNativeRuntime13_x86_Appx=
set NETNativeRuntime13_x64_Appx=
set NETNativeRuntime14_arm_Appx=
set NETNativeRuntime14_x86_Appx=
set NETNativeRuntime14_x64_Appx=
set NETNativeRuntime16_arm_Appx=
set NETNativeRuntime16_x86_Appx=
set NETNativeRuntime16_x64_Appx=
set NETNativeRuntime17_arm_Appx=
set NETNativeRuntime17_x86_Appx=
set NETNativeRuntime17_x64_Appx=
set NETNativeRuntime21_arm_Appx=
set NETNativeRuntime21_x86_Appx=
set NETNativeRuntime21_x64_Appx=
set NETNativeRuntime22_arm_Appx=
set NETNativeRuntime22_arm64_Appx=
set NETNativeRuntime22_x86_Appx=
set NETNativeRuntime22_x64_Appx=
set ServicesStoreEngagement_arm_Appx=
set ServicesStoreEngagement_arm64_Appx=
set ServicesStoreEngagement_x86_Appx=
set ServicesStoreEngagement_x64_Appx=
set UIXaml20_arm_Appx=
set UIXaml20_arm64_Appx=
set UIXaml20_x86_Appx=
set UIXaml20_x64_Appx=
set UIXaml21_arm_Appx=
set UIXaml21_arm64_Appx=
set UIXaml21_x86_Appx=
set UIXaml21_x64_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibs14_arm_Appx=
set VCLibs14_arm64_Appx=
set VCLibs14_x86_Appx=
set VCLibs14_x64_Appx=
set VCLibsUWPDesktop14_arm_Appx=
set VCLibsUWPDesktop14_arm64_Appx=
set VCLibsUWPDesktop14_x86_Appx=
set VCLibsUWPDesktop14_x64_Appx=
set WinJS20_Appx=

cls
echo.===============================================================================
echo.           MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
echo.===============================================================================
echo.

:: Integrate Windows 8.1 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w81" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.                                  ^|
	echo.  [A]  Alarms                     ^| [R]  Sound Recorder
	echo.  [B]  Calculator                 ^| [S]  Xbox LIVE Games
	echo.  [C]  Calender, Mail ^& People    ^| [T]  Zune Music
	echo.  [D]  Bing Finance               ^| [U]  Zune Video
	echo.  [E]  Bing Food ^& Drink          ^|
	echo.  [F]  Bing Health ^& Fitness      ^|
	echo.  [G]  Bing Maps                  ^|
	echo.  [H]  Bing News                  ^|
	echo.  [I]  Bing Sports                ^|
	echo.  [J]  Bing Travel                ^|
	echo.  [K]  Bing Weather               ^|
	echo.  [L]  Help ^& Tips                ^|
	echo.  [M]  Office OneNote             ^|
	echo.  [N]  Reader                     ^|
	echo.  [O]  Reading List               ^|
	echo.  [P]  Scan                       ^| [1]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [Q]  Skype                      ^| [X]  ·µ»Ø
	echo.                                  ^|
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTU1X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 23 goto :IntFeatures
	if errorlevel 22 set "MetroApp=AllApps"
	if errorlevel 21 set "MetroApp=ZuneVideo"
	if errorlevel 20 set "MetroApp=ZuneMusic"
	if errorlevel 19 set "MetroApp=XboxLiveGames"
	if errorlevel 18 set "MetroApp=SoundRecorder"
	if errorlevel 17 set "MetroApp=SkypeApp"
	if errorlevel 16 set "MetroApp=Scan"
	if errorlevel 15 set "MetroApp=ReadingList"
	if errorlevel 14 set "MetroApp=Reader"
	if errorlevel 13 set "MetroApp=OfficeOneNote"
	if errorlevel 12 set "MetroApp=HelpAndTips"
	if errorlevel 11 set "MetroApp=BingWeather"
	if errorlevel 10 set "MetroApp=BingTravel"
	if errorlevel 9  set "MetroApp=BingSports"
	if errorlevel 8  set "MetroApp=BingNews"
	if errorlevel 7  set "MetroApp=BingMaps"
	if errorlevel 6  set "MetroApp=BingHealthFitness"
	if errorlevel 5  set "MetroApp=BingFoodDrink"
	if errorlevel 4  set "MetroApp=BingFinance"
	if errorlevel 3  set "MetroApp=CommunicationsApps"
	if errorlevel 2  set "MetroApp=Calculator"
	if errorlevel 1  set "MetroApp=Alarms"
)

:: Integrate Windows 10 v1507 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.                                    ^|
	echo.  [A]  3D Builder                   ^|  [R]  People
	echo.  [B]  Alarms ^& Clock              ^|  [S]  Phone Companion
	echo.  [C]  App Connector                ^|  [T]  Photos
	echo.  [D]  Bing Finance                 ^|  [U]  Solitaire Collection
	echo.  [E]  Bing News                    ^|  [V]  Store
	echo.  [F]  Bing Sports                  ^|  [W]  Voice Recorder
	echo.  [G]  Bing Weather                 ^|  [X]  Xbox App
	echo.  [H]  Calculator                   ^|
	echo.  [I]  Calendar ^& Mail              ^|
	echo.  [J]  Camera                       ^|
	echo.  [K]  Get Office App               ^|
	echo.  [L]  Get Started                  ^|
	echo.  [M]  Get Skype App                ^|
	echo.  [N]  Groove Music                 ^|
	echo.  [O]  Maps                         ^|
	echo.  [P]  Movies ^& TV                  ^|  [1]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [Q]  Office OneNote               ^|  [2]  ·µ»Ø
	echo.                                    ^|
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWX12 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 26 goto :IntFeatures
	if errorlevel 25 set "MetroApp=AllApps"
	if errorlevel 24 set "MetroApp=XboxApp"
	if errorlevel 23 set "MetroApp=SoundRecorder"
	if errorlevel 22 set "MetroApp=Store"
	if errorlevel 21 set "MetroApp=SolitaireCollection"
	if errorlevel 20 set "MetroApp=Photos"
	if errorlevel 19 set "MetroApp=PhoneCompanion"
	if errorlevel 18 set "MetroApp=People"
	if errorlevel 17 set "MetroApp=OfficeOneNote"
	if errorlevel 16 set "MetroApp=ZuneVideo"
	if errorlevel 15 set "MetroApp=Maps"
	if errorlevel 14 set "MetroApp=ZuneMusic"
	if errorlevel 13 set "MetroApp=SkypeApp"
	if errorlevel 12 set "MetroApp=Getstarted"
	if errorlevel 11 set "MetroApp=OfficeHub"
	if errorlevel 10 set "MetroApp=Camera"
	if errorlevel 9  set "MetroApp=CommunicationsApps"
	if errorlevel 8  set "MetroApp=Calculator"
	if errorlevel 7  set "MetroApp=BingWeather"
	if errorlevel 6  set "MetroApp=BingSports"
	if errorlevel 5  set "MetroApp=BingNews"
	if errorlevel 4  set "MetroApp=BingFinance"
	if errorlevel 3  set "MetroApp=AppConnector"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDBuilder"
)

:: Integrate Windows 10 v1511 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10586" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.                                    ^|
	echo.  [A]  3D Builder                   ^|  [R]  Office OneNote
	echo.  [B]  Alarms ^& Clock              ^|  [S]  Office Sway
	echo.  [C]  App Connector                ^|  [T]  People
	echo.  [D]  Bing Finance                 ^|  [U]  Phone
	echo.  [E]  Bing News                    ^|  [V]  Phone Companion
	echo.  [F]  Bing Sports                  ^|  [W]  Photos
	echo.  [G]  Bing Weather                 ^|  [X]  Solitaire Collection
	echo.  [H]  Calculator                   ^|  [Y]  Store
	echo.  [I]  Calendar ^& Mail              ^|  [Z]  Voice Recorder
	echo.  [J]  Camera                       ^|  [1]  Xbox App
	echo.  [K]  Get Office App               ^|  [2]  WiFi
	echo.  [L]  Get Started                  ^|
	echo.  [M]  Get Skype App                ^|
	echo.  [N]  Groove Music                 ^|
	echo.  [O]  Maps                         ^|
	echo.  [P]  Messaging                    ^|  [3]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [Q]  Movies ^& TV                  ^|  [4]  ·µ»Ø
	echo.                                    ^|
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 30 goto :IntFeatures
	if errorlevel 29 set "MetroApp=AllApps"
	if errorlevel 28 set "MetroApp=WiFi"
	if errorlevel 27 set "MetroApp=XboxApp"
	if errorlevel 26 set "MetroApp=SoundRecorder"
	if errorlevel 25 set "MetroApp=Store"
	if errorlevel 24 set "MetroApp=SolitaireCollection"
	if errorlevel 23 set "MetroApp=Photos"
	if errorlevel 22 set "MetroApp=PhoneCompanion"
	if errorlevel 21 set "MetroApp=Phone"
	if errorlevel 20 set "MetroApp=People"
	if errorlevel 19 set "MetroApp=OfficeSway"
	if errorlevel 18 set "MetroApp=OfficeOneNote"
	if errorlevel 17 set "MetroApp=ZuneVideo"
	if errorlevel 16 set "MetroApp=Messaging"
	if errorlevel 15 set "MetroApp=Maps"
	if errorlevel 14 set "MetroApp=ZuneMusic"
	if errorlevel 13 set "MetroApp=SkypeApp"
	if errorlevel 12 set "MetroApp=Getstarted"
	if errorlevel 11 set "MetroApp=OfficeHub"
	if errorlevel 10 set "MetroApp=Camera"
	if errorlevel 9  set "MetroApp=CommunicationsApps"
	if errorlevel 8  set "MetroApp=Calculator"
	if errorlevel 7  set "MetroApp=BingWeather"
	if errorlevel 6  set "MetroApp=BingSports"
	if errorlevel 5  set "MetroApp=BingNews"
	if errorlevel 4  set "MetroApp=BingFinance"
	if errorlevel 3  set "MetroApp=AppConnector"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDBuilder"
)

:: Integrate Windows 10 v1607 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.                                    ^|
	echo.  [A]  3D Builder                   ^|  [R]  Skype Preview App
	echo.  [B]  Alarms ^& Clock               ^|  [S]  Solitaire Collection
	echo.  [C]  Calculator                   ^|  [T]  Sticky Notes
	echo.  [D]  Calendar ^& Mail              ^|  [U]  Store
	echo.  [E]  Camera                       ^|  [V]  Store Purchase App
	echo.  [F]  Desktop App Installer        ^|  [W]  Voice Recorder
	echo.  [G]  Feedback Hub                 ^|  [X]  Weather
	echo.  [H]  Get Office App               ^|  [Y]  Xbox App
	echo.  [I]  Get Started                  ^|  [Z]  Xbox Identity Provider
	echo.  [J]  Groove Music                 ^|
	echo.  [K]  Maps                         ^|
	echo.  [L]  Messaging                    ^|
	echo.  [M]  Movies ^& TV                  ^|
	echo.  [N]  Office OneNote               ^|
	echo.  [O]  Paid WiFi ^& Mobile           ^|
	echo.  [P]  People                       ^|  [1]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [Q]  Photos                       ^|  [2]  ·µ»Ø
	echo.                                    ^|
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ12 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 28 goto :IntFeatures
	if errorlevel 27 set "MetroApp=AllApps"
	if errorlevel 26 set "MetroApp=XboxIdentityProvider"
	if errorlevel 25 set "MetroApp=XboxApp"
	if errorlevel 24 set "MetroApp=BingWeather"
	if errorlevel 23 set "MetroApp=SoundRecorder"
	if errorlevel 22 set "MetroApp=StorePurchaseApp"
	if errorlevel 21 set "MetroApp=Store"
	if errorlevel 20 set "MetroApp=StickyNotes"
	if errorlevel 19 set "MetroApp=SolitaireCollection"
	if errorlevel 18 set "MetroApp=SkypeApp"
	if errorlevel 17 set "MetroApp=Photos"
	if errorlevel 16 set "MetroApp=People"
	if errorlevel 15 set "MetroApp=OneConnect"
	if errorlevel 14 set "MetroApp=OfficeOneNote"
	if errorlevel 13 set "MetroApp=ZuneVideo"
	if errorlevel 12 set "MetroApp=Messaging"
	if errorlevel 11 set "MetroApp=Maps"
	if errorlevel 10 set "MetroApp=ZuneMusic"
	if errorlevel 9  set "MetroApp=Getstarted"
	if errorlevel 8  set "MetroApp=OfficeHub"
	if errorlevel 7  set "MetroApp=FeedbackHub"
	if errorlevel 6  set "MetroApp=DesktopAppInstaller"
	if errorlevel 5  set "MetroApp=Camera"
	if errorlevel 4  set "MetroApp=CommunicationsApps"
	if errorlevel 3  set "MetroApp=Calculator"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDBuilder"
)

:: Integrate Windows 10 v1703 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [A]  3D Builder                   ^|  [S]  Solitaire Collection
	echo.  [B]  Alarms ^& Clock               ^|  [T]  Sticky Notes
	echo.  [C]  Calculator                   ^|  [U]  Store
	echo.  [D]  Calendar ^& Mail              ^|  [V]  Store Purchase App
	echo.  [E]  Camera                       ^|  [W]  Tips
	echo.  [F]  Desktop App Installer        ^|  [X]  View 3D Preview
	echo.  [G]  Feedback Hub                 ^|  [Y]  Voice Recorder
	echo.  [H]  Get Office App               ^|  [Z]  Wallet
	echo.  [I]  Groove Music                 ^|  [1]  Weather
	echo.  [J]  Maps                         ^|  [2]  Xbox App
	echo.  [K]  Messaging                    ^|  [3]  Xbox Game Overlay
	echo.  [L]  Movies ^& TV                  ^|  [4]  Xbox Identity Provider
	echo.  [M]  Office OneNote               ^|  [5]  Xbox SpeechToText Overlay
	echo.  [N]  Paid WiFi ^& Mobile           ^|
	echo.  [O]  Paint 3D                     ^|
	echo.  [P]  People                       ^|
	echo.  [Q]  Photos                       ^|  [6]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [R]  Skype Preview App            ^|  [7]  ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 33 goto :IntFeatures
	if errorlevel 32 set "MetroApp=AllApps"
	if errorlevel 31 set "MetroApp=XboxSpeechToTextOverlay"
	if errorlevel 30 set "MetroApp=XboxIdentityProvider"
	if errorlevel 29 set "MetroApp=XboxGameOverlay"
	if errorlevel 28 set "MetroApp=XboxApp"
	if errorlevel 27 set "MetroApp=BingWeather"
	if errorlevel 26 set "MetroApp=Wallet"
	if errorlevel 25 set "MetroApp=SoundRecorder"
	if errorlevel 24 set "MetroApp=ThreeDViewer"
	if errorlevel 23 set "MetroApp=Getstarted"
	if errorlevel 22 set "MetroApp=StorePurchaseApp"
	if errorlevel 21 set "MetroApp=Store"
	if errorlevel 20 set "MetroApp=StickyNotes"
	if errorlevel 19 set "MetroApp=SolitaireCollection"
	if errorlevel 18 set "MetroApp=SkypeApp"
	if errorlevel 17 set "MetroApp=Photos"
	if errorlevel 16 set "MetroApp=People"
	if errorlevel 15 set "MetroApp=Paint3D"
	if errorlevel 14 set "MetroApp=OneConnect"
	if errorlevel 13 set "MetroApp=OfficeOneNote"
	if errorlevel 12 set "MetroApp=ZuneVideo"
	if errorlevel 11 set "MetroApp=Messaging"
	if errorlevel 10 set "MetroApp=Maps"
	if errorlevel 9  set "MetroApp=ZuneMusic"
	if errorlevel 8  set "MetroApp=OfficeHub"
	if errorlevel 7  set "MetroApp=FeedbackHub"
	if errorlevel 6  set "MetroApp=DesktopAppInstaller"
	if errorlevel 5  set "MetroApp=Camera"
	if errorlevel 4  set "MetroApp=CommunicationsApps"
	if errorlevel 3  set "MetroApp=Calculator"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDBuilder"
)

:: Integrate Windows 10 v1709 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [A]  3D Builder                   ^|  [S]  Solitaire Collection
	echo.  [B]  Alarms ^& Clock               ^|  [T]  Sticky Notes
	echo.  [C]  Calculator                   ^|  [U]  Store
	echo.  [D]  Calendar ^& Mail              ^|  [V]  Store Purchase App
	echo.  [E]  Camera                       ^|  [W]  Tips
	echo.  [F]  Desktop App Installer        ^|  [X]  View 3D Preview
	echo.  [G]  Feedback Hub                 ^|  [Y]  Voice Recorder
	echo.  [H]  Get Office App               ^|  [Z]  Wallet
	echo.  [I]  Groove Music                 ^|  [1]  Weather
	echo.  [J]  Maps                         ^|  [2]  Xbox App
	echo.  [K]  Messaging                    ^|  [3]  Xbox Game Overlay
	echo.  [L]  Movies ^& TV                  ^|  [4]  Xbox Identity Provider
	echo.  [M]  Office OneNote               ^|  [5]  Xbox SpeechToText Overlay
	echo.  [N]  Paid WiFi ^& Mobile          ^|
	echo.  [O]  Paint 3D                     ^|
	echo.  [P]  People                       ^|
	echo.  [Q]  Photos                       ^|  [6]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [R]  Skype Preview App            ^|  [7]  ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 33 goto :IntFeatures
	if errorlevel 32 set "MetroApp=AllApps"
	if errorlevel 31 set "MetroApp=XboxSpeechToTextOverlay"
	if errorlevel 30 set "MetroApp=XboxIdentityProvider"
	if errorlevel 29 set "MetroApp=XboxGameOverlay"
	if errorlevel 28 set "MetroApp=XboxApp"
	if errorlevel 27 set "MetroApp=BingWeather"
	if errorlevel 26 set "MetroApp=Wallet"
	if errorlevel 25 set "MetroApp=SoundRecorder"
	if errorlevel 24 set "MetroApp=ThreeDViewer"
	if errorlevel 23 set "MetroApp=Getstarted"
	if errorlevel 22 set "MetroApp=StorePurchaseApp"
	if errorlevel 21 set "MetroApp=Store"
	if errorlevel 20 set "MetroApp=StickyNotes"
	if errorlevel 19 set "MetroApp=SolitaireCollection"
	if errorlevel 18 set "MetroApp=SkypeApp"
	if errorlevel 17 set "MetroApp=Photos"
	if errorlevel 16 set "MetroApp=People"
	if errorlevel 15 set "MetroApp=Paint3D"
	if errorlevel 14 set "MetroApp=OneConnect"
	if errorlevel 13 set "MetroApp=OfficeOneNote"
	if errorlevel 12 set "MetroApp=ZuneVideo"
	if errorlevel 11 set "MetroApp=Messaging"
	if errorlevel 10 set "MetroApp=Maps"
	if errorlevel 9  set "MetroApp=ZuneMusic"
	if errorlevel 8  set "MetroApp=OfficeHub"
	if errorlevel 7  set "MetroApp=FeedbackHub"
	if errorlevel 6  set "MetroApp=DesktopAppInstaller"
	if errorlevel 5  set "MetroApp=Camera"
	if errorlevel 4  set "MetroApp=CommunicationsApps"
	if errorlevel 3  set "MetroApp=Calculator"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDBuilder"
)

:: Integrate Windows 10 v1809/V1903/v1909 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x86" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [A]  3DViewer                 -  Mixed Reality Viewer App
	echo.  [B]  Alarms                   -  Alarms ^& Clock App
	echo.  [C]  BingWeather              -  Weather App
	echo.  [D]  Calculator               -  Calculator App
	echo.  [E]  Camera                   -  Camera App
	echo.  [F]  CommunicationsApps       -  Windows Calendar ^& Mail App
	echo.  [G]  DesktopAppInstaller      -  Desktop App Installer
	echo.  [H]  Extensions               -  HEIF, HEVC, MPEG2, VP9, Web, Webp Extensions
	echo.  [I]  FeedbackHub              -  Feedback Hub App
	echo.  [J]  GetHelp                  -  Get Help App
	echo.  [K]  Getstarted               -  Tips App
	echo.  [L]  Maps                     -  Maps App
	echo.  [M]  Messaging                -  Messaging App
	echo.  [N]  OfficeHub                -  My Office App
	echo.  [O]  OfficeOneNote            -  OneNote App
	echo.  [P]  OneConnect               -  Mobile Plans App
	echo.  [Q]  Paint3D                  -  Paint 3D App
	echo.  [R]  People                   -  People App
	echo.  [S]  Photos                   -  Photos App
	echo.  [T]  Print3D                  -  Print 3D App
	echo.  [U]  ScreenSketch             -  Screen Sketch App
	echo.  [V]  SkypeApp                 -  Skype App
	echo.  [W]  SolitaireCollection      -  Solitaire Collection App
	echo.  [X]  SoundRecorder            -  Voice Recorder App
	echo.  [Y]  StickyNotes              -  Sticky Notes App
	echo.  [Z]  Store                    -  Microsoft Store App
	echo.  [1]  WalletService            -  Wallet Service App
	echo.  [2]  XboxApp                  -  Microsoft Xbox App
	echo.  [3]  YourPhone                -  Your Phone App
	echo.  [4]  ZuneMusic                -  Groove Music App
	echo.  [5]  ZuneVideo                -  Films ^& TV App
	echo.
	echo.  [6]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [7]  ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 33 goto :IntFeatures
	if errorlevel 32 set "MetroApp=AllApps"
	if errorlevel 31 set "MetroApp=ZuneVideo"
	if errorlevel 30 set "MetroApp=ZuneMusic"
	if errorlevel 29 set "MetroApp=YourPhone"
	if errorlevel 28 set "MetroApp=XboxApp"
	if errorlevel 27 set "MetroApp=WalletService"
	if errorlevel 26 set "MetroApp=Store"
	if errorlevel 25 set "MetroApp=StickyNotes"
	if errorlevel 24 set "MetroApp=SoundRecorder"
	if errorlevel 23 set "MetroApp=SolitaireCollection"
	if errorlevel 22 set "MetroApp=SkypeApp"
	if errorlevel 21 set "MetroApp=ScreenSketch"
	if errorlevel 20 set "MetroApp=Print3D"
	if errorlevel 19 set "MetroApp=Photos"
	if errorlevel 18 set "MetroApp=People"
	if errorlevel 17 set "MetroApp=Paint3D"
	if errorlevel 16 set "MetroApp=OneConnect"
	if errorlevel 15 set "MetroApp=OfficeOneNote"
	if errorlevel 14 set "MetroApp=OfficeHub"
	if errorlevel 13 set "MetroApp=Messaging"
	if errorlevel 12 set "MetroApp=Maps"
	if errorlevel 11 set "MetroApp=Getstarted"
	if errorlevel 10 set "MetroApp=GetHelp"
	if errorlevel 9  set "MetroApp=FeedbackHub"
	if errorlevel 8  set "MetroApp=Extensions"
	if errorlevel 7  set "MetroApp=DesktopAppInstaller"
	if errorlevel 6  set "MetroApp=CommunicationsApps"
	if errorlevel 5  set "MetroApp=Camera"
	if errorlevel 4  set "MetroApp=Calculator"
	if errorlevel 3  set "MetroApp=BingWeather"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDViewer"
)

:: Integrate Windows 10 v1809/V1903/v1909 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x64" (
	cls
	echo.===============================================================================
	echo.         MSMG ToolKit - ¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [A]  3DViewer                 -  Mixed Reality Viewer App
	echo.  [B]  Alarms                   -  Alarms ^& Clock App
	echo.  [C]  BingWeather              -  Weather App
	echo.  [D]  Calculator               -  Calculator App
	echo.  [E]  Camera                   -  Camera App
	echo.  [F]  CommunicationsApps       -  Windows Calendar ^& Mail App
	echo.  [G]  DesktopAppInstaller      -  Desktop App Installer
	echo.  [H]  Extensions               -  HEIF, HEVC, MPEG2, VP9, Web, Webp Extensions
	echo.  [I]  FeedbackHub              -  Feedback Hub App
	echo.  [J]  GetHelp                  -  Get Help App
	echo.  [K]  Getstarted               -  Tips App
	echo.  [L]  Maps                     -  Maps App
	echo.  [M]  Messaging                -  Messaging App
	echo.  [N]  MixedRealityPortal       -  Mixed Reality Portal App
	echo.  [O]  OfficeHub                -  My Office App
	echo.  [P]  OfficeOneNote            -  OneNote App
	echo.  [Q]  OneConnect               -  Mobile Plans App
	echo.  [R]  Paint3D                  -  Paint 3D App
	echo.  [S]  People                   -  People App
	echo.  [T]  Photos                   -  Photos App
	echo.  [U]  Print3D                  -  Print 3D App
	echo.  [V]  ScreenSketch             -  Screen Sketch App
	echo.  [W]  SkypeApp                 -  Skype App
	echo.  [X]  SolitaireCollection      -  Solitaire Collection App
	echo.  [Y]  SoundRecorder            -  Voice Recorder App
	echo.  [Z]  StickyNotes              -  Sticky Notes App
	echo.  [1]  Store                    -  Microsoft Store App
	echo.  [2]  WalletService            -  Wallet Service App
	echo.  [3]  XboxApp                  -  Microsoft Xbox App
	echo.  [4]  YourPhone                -  Your Phone App
	echo.  [5]  ZuneMusic                -  Groove Music App
	echo.  [6]  ZuneVideo                -  Films ^& TV App
	echo.
	echo.  [7]  ËùÓÐÓ¦ÓÃ³ÌÐò
	echo.  [8]  ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678 /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 34 goto :IntFeatures
	if errorlevel 33 set "MetroApp=AllApps"
	if errorlevel 32 set "MetroApp=ZuneVideo"
	if errorlevel 31 set "MetroApp=ZuneMusic"
	if errorlevel 30 set "MetroApp=YourPhone"
	if errorlevel 29 set "MetroApp=XboxApp"
	if errorlevel 28 set "MetroApp=WalletService"
	if errorlevel 27 set "MetroApp=Store"
	if errorlevel 26 set "MetroApp=StickyNotes"
	if errorlevel 25 set "MetroApp=SoundRecorder"
	if errorlevel 24 set "MetroApp=SolitaireCollection"
	if errorlevel 23 set "MetroApp=SkypeApp"
	if errorlevel 22 set "MetroApp=ScreenSketch"
	if errorlevel 21 set "MetroApp=Print3D"
	if errorlevel 20 set "MetroApp=Photos"
	if errorlevel 19 set "MetroApp=People"
	if errorlevel 18 set "MetroApp=Paint3D"
	if errorlevel 17 set "MetroApp=OneConnect"
	if errorlevel 16 set "MetroApp=OfficeOneNote"
	if errorlevel 15 set "MetroApp=OfficeHub"
	if errorlevel 14 set "MetroApp=MixedRealityPortal"
	if errorlevel 13 set "MetroApp=Messaging"
	if errorlevel 12 set "MetroApp=Maps"
	if errorlevel 11 set "MetroApp=Getstarted"
	if errorlevel 10 set "MetroApp=GetHelp"
	if errorlevel 9  set "MetroApp=FeedbackHub"
	if errorlevel 8  set "MetroApp=Extensions"
	if errorlevel 7  set "MetroApp=DesktopAppInstaller"
	if errorlevel 6  set "MetroApp=CommunicationsApps"
	if errorlevel 5  set "MetroApp=Camera"
	if errorlevel 4  set "MetroApp=Calculator"
	if errorlevel 3  set "MetroApp=BingWeather"
	if errorlevel 2  set "MetroApp=Alarms"
	if errorlevel 1  set "MetroApp=ThreeDViewer"
)

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Pack Path
if "%SelectedSourceOS%" equ "w81" set "Apps=%Apps%\%SelectedSourceOS%"
if "%SelectedSourceOS%" equ "w10" set "Apps=%Apps%\%SelectedSourceOS%\10.0.%ImageBuild%"

:: Checking whether Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò folder is empty
if not exist "%Apps%\*.appxbundle" (
	echo.Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Appxbundle ÎÄ¼þ¶ªÊ§...
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	if "%SelectedSourceOS%" equ "w10" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	echo.
	goto :Stop
)

if not exist "%Apps%\*.appx" (
	echo.Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Appx ÎÄ¼þ¶ªÊ§...
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	if "%SelectedSourceOS%" equ "w10" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	echo.
	goto :Stop
)

if not exist "%Apps%\*.xml" (
	echo.Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐòÊÚÈ¨ XML ÎÄ¼þ¶ªÊ§...
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	if "%SelectedSourceOS%" equ "w10" echo.Çë½«¶ªÊ§µÄÎÄ¼þ¸´ÖÆµ½ ^<Packs\Apps\%SelectedSourceOS%\10.0.%ImageBuild%^> ÎÄ¼þ¼Ð...
	echo.
	goto :Stop
)

:: Getting Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò files full pathnames
cd /d "%Apps%\"

for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "AdvertisingXaml_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "AdvertisingXaml_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "AdvertisingXaml_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Advertising.Xaml*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "AdvertisingXaml_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b *PlayReadyClient*arm.appx" 2^>nul') do set "MediaPlayReadyClient22_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b *PlayReadyClient*x86.appx" 2^>nul') do set "MediaPlayReadyClient22_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b *PlayReadyClient*x64.appx" 2^>nul') do set "MediaPlayReadyClient22_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.3*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework13_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.3*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework13_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.3*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework13_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.6*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework16_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.6*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework16_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.6*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework16_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.7*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework17_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.7*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework17_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.1.7*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework17_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.1*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework21_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.1*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework21_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.1*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework21_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework22_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework22_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework22_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Framework.2.2*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeFramework22_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.3*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime13_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.3*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime13_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.3*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime13_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.4*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime14_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.4*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime14_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.4*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime14_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.6*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime16_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.6*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime16_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.6*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime16_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.7*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime17_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.7*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime17_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.1.7*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime17_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.1*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime21_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.1*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime21_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.1*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime21_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.1*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime21_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime22_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime22_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime22_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.NET.Native.Runtime.2.2*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "NETNativeRuntime22_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "ServicesStoreEngagement_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "ServicesStoreEngagement_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "ServicesStoreEngagement_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.Services.Store.Engagement*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "ServicesStoreEngagement_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml20_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml20_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml20_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.0*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml20_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml21_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml21_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml21_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.UI.Xaml.2.1*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "UIXaml21_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs12_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs12_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.120.00*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs12_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs14_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs14_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs14_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibs14_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*_arm__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibsUWPDesktop14_arm_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*_arm64__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibsUWPDesktop14_arm64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*_x86__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibsUWPDesktop14_x86_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.VCLibs.140.00.UWPDesktop*_x64__8wekyb3d8bbwe.Appx" 2^>nul') do set "VCLibsUWPDesktop14_x64_Appx=/DependencyPackagePath:%Apps%\%%i"
for /f %%i IN ('"dir /b Microsoft.WinJS*.appx" 2^>nul') do set "WinJS20_Appx=/DependencyPackagePath:%Apps%\%%i"

set AdvertisingXaml=
set DependencyPackages=
set NETNativeFramework13=
set NETNativeFramework16=
set NETNativeFramework17=
set NETNativeFramework21=
set NETNativeFramework22=
set NETNativeRuntime13=
set NETNativeRuntime14=
set NETNativeRuntime16=
set NETNativeRuntime17=
set NETNativeRuntime21=
set NETNativeRuntime22=
set ServicesStoreEngagement=
set UIXaml20=
set UIXaml21=
set VCLibs14=
set VCLibsUWPDesktop14=

if "%ImageArchitecture%" equ "x86" (
	set "AdvertisingXaml=%AdvertisingXaml_x86_Appx%"
	set "NETNativeFramework13=%NETNativeFramework13_x86_Appx%"
	set "NETNativeFramework16=%NETNativeFramework16_x86_Appx%"
	set "NETNativeFramework17=%NETNativeFramework17_x86_Appx%"
	set "NETNativeFramework21=%NETNativeFramework21_x86_Appx%"
	set "NETNativeFramework22=%NETNativeFramework22_x86_Appx%"
	set "NETNativeRuntime13=%NETNativeRuntime13_x86_Appx%"
	set "NETNativeRuntime14=%NETNativeRuntime14_x86_Appx%"
	set "NETNativeRuntime16=%NETNativeRuntime16_x86_Appx%"
	set "NETNativeRuntime17=%NETNativeRuntime17_x86_Appx%"
	set "NETNativeRuntime21=%NETNativeRuntime21_x86_Appx%"
	set "NETNativeRuntime22=%NETNativeRuntime22_x86_Appx%"
	set "ServicesStoreEngagement=%ServicesStoreEngagement_x86_Appx%"
	set "UIXaml20=%UIXaml20_x86_Appx%"
	set "UIXaml21=%UIXaml21_x86_Appx%"
	set "VCLibs14=%VCLibs14_x86_Appx%"
	set "VCLibsUWPDesktop14=%VCLibsUWPDesktop14_x86_Appx%"
)

if "%ImageArchitecture%" equ "x64" (
	set "AdvertisingXaml=%AdvertisingXaml_x86_Appx% %AdvertisingXaml_x64_Appx%"
	set "NETNativeFramework13=%NETNativeFramework13_x86_Appx% %NETNativeFramework13_x64_Appx%"
	set "NETNativeFramework16=%NETNativeFramework16_x86_Appx% %NETNativeFramework16_x64_Appx%"
	set "NETNativeFramework17=%NETNativeFramework17_x86_Appx% %NETNativeFramework17_x64_Appx%"
	set "NETNativeFramework21=%NETNativeFramework21_x86_Appx% %NETNativeFramework21_x64_Appx%"
	set "NETNativeFramework22=%NETNativeFramework22_x86_Appx% %NETNativeFramework22_x64_Appx%"
	set "NETNativeRuntime13=%NETNativeRuntime13_x86_Appx% %NETNativeRuntime13_x64_Appx%"
	set "NETNativeRuntime14=%NETNativeRuntime14_x86_Appx% %NETNativeRuntime14_x64_Appx%"
	set "NETNativeRuntime16=%NETNativeRuntime16_x86_Appx% %NETNativeRuntime16_x64_Appx%"
	set "NETNativeRuntime17=%NETNativeRuntime17_x86_Appx% %NETNativeRuntime17_x64_Appx%"
	set "NETNativeRuntime21=%NETNativeRuntime21_x86_Appx% %NETNativeRuntime21_x64_Appx%"
	set "NETNativeRuntime22=%NETNativeRuntime22_x86_Appx% %NETNativeRuntime22_x64_Appx%"
	set "ServicesStoreEngagement=%ServicesStoreEngagement_x86_Appx% %ServicesStoreEngagement_x64_Appx%"
	set "UIXaml20=%UIXaml20_x86_Appx% %UIXaml20_x64_Appx%"
	set "UIXaml21=%UIXaml21_x86_Appx% %UIXaml21_x64_Appx%"
	set "VCLibs14=%VCLibs14_x86_Appx% %VCLibs14_x64_Appx%"
	set "VCLibsUWPDesktop14=%VCLibsUWPDesktop14_x86_Appx% %VCLibsUWPDesktop14_x64_Appx%"
)

if "%ImageArchitecture%" equ "arm64" (
	set "AdvertisingXaml=%AdvertisingXaml_arm_Appx% %AdvertisingXaml_arm64_Appx%"
	set "NETNativeFramework13=%NETNativeFramework13_arm_Appx% %NETNativeFramework13_arm64_Appx%"
	set "NETNativeFramework16=%NETNativeFramework16_arm_Appx% %NETNativeFramework16_arm64_Appx%"
	set "NETNativeFramework17=%NETNativeFramework17_arm_Appx% %NETNativeFramework17_arm64_Appx%"
	set "NETNativeFramework21=%NETNativeFramework21_arm_Appx% %NETNativeFramework21_arm64_Appx%"
	set "NETNativeFramework22=%NETNativeFramework22_arm_Appx% %NETNativeFramework22_arm64_Appx%"
	set "NETNativeRuntime13=%NETNativeRuntime13_arm_Appx% %NETNativeRuntime13_arm64_Appx%"
	set "NETNativeRuntime14=%NETNativeRuntime14_arm_Appx% %NETNativeRuntime14_arm64_Appx%"
	set "NETNativeRuntime16=%NETNativeRuntime16_arm_Appx% %NETNativeRuntime16_arm64_Appx%"
	set "NETNativeRuntime17=%NETNativeRuntime17_arm_Appx% %NETNativeRuntime17_arm64_Appx%"
	set "NETNativeRuntime21=%NETNativeRuntime21_arm_Appx% %NETNativeRuntime21_arm64_Appx%"
	set "NETNativeRuntime22=%NETNativeRuntime22_arm_Appx% %NETNativeRuntime22_arm64_Appx%"
	set "ServicesStoreEngagement=%ServicesStoreEngagement_arm_Appx% %ServicesStoreEngagement_arm64_Appx%"
	set "UIXaml20=%UIXaml20_arm_Appx% %UIXaml20_arm64_Appx%"
	set "UIXaml21=%UIXaml21_arm_Appx% %UIXaml21_arm64_Appx%"
	set "VCLibs14=%VCLibs14_x86_Appx% %VCLibs14_arm_Appx% %VCLibs14_arm64_Appx%"
	set "VCLibsUWPDesktop14=%VCLibsUWPDesktop14_x86_Appx% %VCLibsUWPDesktop14_arm_Appx% %VCLibsUWPDesktop14_arm64_Appx%"
)

if "%SelectedSourceOS%" equ "w81" set "DependencyPackages=%VCLibs12_x86_Appx% %VCLibs12_x64_Appx% %VCLibs12_arm_Appx% %WinJS20Appx% %MediaPlayReadyClient22_x86_Appx% %MediaPlayReadyClient22_x64_Appx% %MediaPlayReadyClient22_arm_Appx%"

if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" equ "16299" set "DependencyPackages=%AdvertisingXaml% %NETNativeFramework13% %NETNativeFramework16% %NETNativeFramework17% %NETNativeFramework21% %NETNativeFramework22% %NETNativeRuntime13% %NETNativeRuntime14% %NETNativeRuntime16% %NETNativeRuntime17% %NETNativeRuntime21% %NETNativeRuntime22% %ServicesStoreEngagement% %UIXaml20% %UIXaml21% %VCLibs14% %VCLibsUWPDesktop14%"
	if "%ImageBuild%" equ "17134" set "DependencyPackages=%AdvertisingXaml% %NETNativeFramework13% %NETNativeFramework16% %NETNativeFramework17% %NETNativeFramework21% %NETNativeFramework22% %NETNativeRuntime13% %NETNativeRuntime14% %NETNativeRuntime16% %NETNativeRuntime17% %NETNativeRuntime21% %NETNativeRuntime22% %ServicesStoreEngagement% %UIXaml20% %UIXaml21% %VCLibs14% %VCLibsUWPDesktop14%"
	if "%ImageBuild%" equ "17763" set "DependencyPackages=%AdvertisingXaml% %NETNativeFramework16% %NETNativeFramework17% %NETNativeFramework21% %NETNativeFramework22% %NETNativeRuntime16% %NETNativeRuntime17% %NETNativeRuntime21% %NETNativeRuntime22% %ServicesStoreEngagement% %UIXaml20% %UIXaml21% %VCLibs14% %VCLibsUWPDesktop14%"
	if "%ImageBuild%" equ "18362" set "DependencyPackages=%AdvertisingXaml% %NETNativeFramework17% %NETNativeFramework22% %NETNativeRuntime17% %NETNativeRuntime22% %ServicesStoreEngagement% %UIXaml21% %VCLibs14% %VCLibsUWPDesktop14%"
)

for /f %%i IN ('"dir /b *Alarms*.appxbundle" 2^>nul') do if exist %%i set "Alarms_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *AppConnector*.appxbundle" 2^>nul') do if exist %%i set "AppConnector_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFinance*.appxbundle" 2^>nul') do if exist %%i set "BingFinance_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFoodAndDrink*.appxbundle" 2^>nul') do if exist %%i set "BingFoodDrink_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingHealthAndFitness*.appxbundle" 2^>nul') do if exist %%i set "BingHealthFitness_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingMaps*.appxbundle" 2^>nul') do if exist %%i set "BingMaps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingNews*.appxbundle" 2^>nul') do if exist %%i set "BingNews_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingSports*.appxbundle" 2^>nul') do if exist %%i set "BingSports_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingTravel*.appxbundle" 2^>nul') do if exist %%i set "BingTravel_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingWeather*.appxbundle" 2^>nul') do if exist %%i set "BingWeather_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Calculator*.appxbundle" 2^>nul') do if exist %%i set "Calculator_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Camera*.appxbundle" 2^>nul') do if exist %%i set "Camera_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommunicationsApps*.appxbundle" 2^>nul') do if exist %%i set "CommunicationsApps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *DesktopAppInstaller*.appxbundle" 2^>nul') do if exist %%i set "DesktopAppInstaller_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *FeedbackHub*.appxbundle" 2^>nul') do if exist %%i set "FeedbackHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *GetHelp*.appxbundle" 2^>nul') do if exist %%i set "GetHelp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Getstarted*.appxbundle" 2^>nul') do if exist %%i set "Getstarted_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*arm*.appx" 2^>nul') do if exist %%i set "HEIFImageExtension_arm_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*x86*.appx" 2^>nul') do if exist %%i set "HEIFImageExtension_x86_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*x64*.appx" 2^>nul') do if exist %%i set "HEIFImageExtension_x64_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*arm*.appx" 2^>nul') do if exist %%i set "HEVCVideoExtension_arm_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*x86*.appx" 2^>nul') do if exist %%i set "HEVCVideoExtension_x86_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*x64*.appx" 2^>nul') do if exist %%i set "HEVCVideoExtension_x64_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *HelpAndTips*.appxbundle" 2^>nul') do if exist %%i set "HelpAndTips_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Maps*.appxbundle" 2^>nul') do if exist %%i set "Maps_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Messaging*.appxbundle" 2^>nul') do if exist %%i set "Messaging_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MixedReality.Portal*.appxbundle" 2^>nul') do if exist %%i set "MixedRealityPortal_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*arm*.appx" 2^>nul') do if exist %%i set "MPEG2VideoExtension_arm_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*x86*.appx" 2^>nul') do if exist %%i set "MPEG2VideoExtension_x86_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*x64*.appx" 2^>nul') do if exist %%i set "MPEG2VideoExtension_x64_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OfficeHub*.appxbundle" 2^>nul') do if exist %%i set "OfficeHub_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneNote*.appxbundle" 2^>nul') do if exist %%i set "OfficeOneNote_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Sway*.appxbundle" 2^>nul') do if exist %%i set "OfficeSway_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneConnect*.appxbundle" 2^>nul') do if exist %%i set "OneConnect_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Paint*.appxbundle" 2^>nul') do if exist %%i set "Paint3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *People*.appxbundle" 2^>nul') do if exist %%i set "People_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommsPhone*.appxbundle" 2^>nul') do if exist %%i set "Phone_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsPhone*.appxbundle" 2^>nul') do if exist %%i set "PhoneCompanion_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Photos*.appxbundle" 2^>nul') do if exist %%i set "Photos_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Print3D*.appxbundle" 2^>nul') do if exist %%i set "Print3D_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Reader*.appxbundle" 2^>nul') do if exist %%i set "Reader_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ReadingList*.appxbundle" 2^>nul') do if exist %%i set "ReadingList_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Scan*.appxbundle" 2^>nul') do if exist %%i set "Scan_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ScreenSketch*.appxbundle" 2^>nul') do if exist %%i set "ScreenSketch_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Skype*.appxbundle" 2^>nul') do if exist %%i set "SkypeApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SolitaireCollection*.appxbundle" 2^>nul') do if exist %%i set "SolitaireCollection_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *SoundRecorder*.appxbundle" 2^>nul') do if exist %%i set "SoundRecorder_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StickyNotes*.appxbundle" 2^>nul') do if exist %%i set "StickyNotes_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Store*.appxbundle" 2^>nul') do if exist %%i set "Store_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *StorePurchaseApp*.appxbundle" 2^>nul') do if exist %%i set "StorePurchaseApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *3DBuilder*.appxbundle" 2^>nul') do if exist %%i set "ThreeDBuilder_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *3DView*.appxbundle" 2^>nul') do if exist %%i set "ThreeDViewer_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*arm*.appx" 2^>nul') do if exist %%i set "VP9VideoExtensions_arm_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*x86*.appx" 2^>nul') do if exist %%i set "VP9VideoExtensions_x86_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*x64*.appx" 2^>nul') do if exist %%i set "VP9VideoExtensions_x64_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Wallet*.appxbundle" 2^>nul') do if exist %%i set "Wallet_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebMediaExtensions*.appxbundle" 2^>nul') do if exist %%i set "WebMediaExtensions_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*arm*.appx" 2^>nul') do if exist %%i set "WebpImageExtension_arm_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*x86*.appx" 2^>nul') do if exist %%i set "WebpImageExtension_x86_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*x64*.appx" 2^>nul') do if exist %%i set "WebpImageExtension_x64_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ConnectivityStore*.appxbundle" 2^>nul') do if exist %%i set "WiFi_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxApp*.appxbundle" 2^>nul') do if exist %%i set "XboxApp_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGameOverlay*.appxbundle" 2^>nul') do if exist %%i set "XboxGameOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGamingOverlay*.appxbundle" 2^>nul') do if exist %%i set "XboxGamingOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxIdentityProvider*.appxbundle" 2^>nul') do if exist %%i set "XboxIdentityProvider_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxLIVEGames*.appxbundle" 2^>nul') do if exist %%i set "XboxLiveGames_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxSpeechToTextOverlay*.appxbundle" 2^>nul') do if exist %%i set "XboxSpeechToTextOverlay_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Xbox.TCUI*.appxbundle" 2^>nul') do if exist %%i set "XboxTCUI_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.YourPhone*.appxbundle" 2^>nul') do if exist %%i set "YourPhone_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneMusic*.appxbundle" 2^>nul') do if exist %%i set "ZuneMusic_Appx=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneVideo*.appxbundle" 2^>nul') do if exist %%i set "ZuneVideo_Appx=%Apps%\%%i"

for /f %%i IN ('"dir /b *Alarms*.xml" 2^>nul') do if exist %%i set "Alarms_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *AppConnector*.xml" 2^>nul') do if exist %%i set "AppConnector_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFinance*.xml" 2^>nul') do if exist %%i set "BingFinance_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingFoodAndDrink*.xml" 2^>nul') do if exist %%i set "BingFoodDrink_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingHealthAndFitness*.xml" 2^>nul') do if exist %%i set "BingHealthFitness_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingMaps*.xml" 2^>nul') do if exist %%i set "BingMaps_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingNews*.xml" 2^>nul') do if exist %%i set "BingNews_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingSports*.xml" 2^>nul') do if exist %%i set "BingSports_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingTravel*.xml" 2^>nul') do if exist %%i set "BingTravel_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *BingWeather*.xml" 2^>nul') do if exist %%i set "BingWeather_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Calculator*.xml" 2^>nul') do if exist %%i set "Calculator_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Camera*.xml" 2^>nul') do if exist %%i set "Camera_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommunicationsApps*.xml" 2^>nul') do if exist %%i set "CommunicationsApps_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *DesktopAppInstaller*.xml" 2^>nul') do if exist %%i set "DesktopAppInstaller_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *FeedbackHub*.xml" 2^>nul') do if exist %%i set "FeedbackHub_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *GetHelp*.xml" 2^>nul') do if exist %%i set "GetHelp_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Getstarted*.xml" 2^>nul') do if exist %%i set "Getstarted_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*arm*.xml" 2^>nul') do if exist %%i set "HEIFImageExtension_arm_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*x86*.xml" 2^>nul') do if exist %%i set "HEIFImageExtension_x86_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEIFImageExtension*x64*.xml" 2^>nul') do if exist %%i set "HEIFImageExtension_x64_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*arm*.xml" 2^>nul') do if exist %%i set "HEVCVideoExtension_arm_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*x86*.xml" 2^>nul') do if exist %%i set "HEVCVideoExtension_x86_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HEVCVideoExtension*x64*.xml" 2^>nul') do if exist %%i set "HEVCVideoExtension_x64_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *HelpAndTips*.xml" 2^>nul') do if exist %%i set "HelpAndTips_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Maps*.xml" 2^>nul') do if exist %%i set "Maps_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Messaging*.xml" 2^>nul') do if exist %%i set "Messaging_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *MixedReality.Portal*.xml" 2^>nul') do if exist %%i set "MixedRealityPortal_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*arm*.xml" 2^>nul') do if exist %%i set "MPEG2VideoExtension_arm_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*x86*.xml" 2^>nul') do if exist %%i set "MPEG2VideoExtension_x86_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *MPEG2VideoExtension*x64*.xml" 2^>nul') do if exist %%i set "MPEG2VideoExtension_x64_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *OfficeHub*.xml" 2^>nul') do if exist %%i set "OfficeHub_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneNote*.xml" 2^>nul') do if exist %%i set "OfficeOneNote_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Sway*.xml" 2^>nul') do if exist %%i set "OfficeSway_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *OneConnect*.xml" 2^>nul') do if exist %%i set "OneConnect_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Paint*.xml" 2^>nul') do if exist %%i set "Paint3D_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *People*.xml" 2^>nul') do if exist %%i set "People_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *CommsPhone*.xml" 2^>nul') do if exist %%i set "Phone_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *WindowsPhone*.xml" 2^>nul') do if exist %%i set "PhoneCompanion_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Photos*.xml" 2^>nul') do if exist %%i set "Photos_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Print3D*.xml" 2^>nul') do if exist %%i set "Print3D_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Reader*.xml" 2^>nul') do if exist %%i set "Reader_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *ReadingList*.xml" 2^>nul') do if exist %%i set "ReadingList_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Scan*.xml" 2^>nul') do if exist %%i set "Scan_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *ScreenSketch*.xml" 2^>nul') do if exist %%i set "ScreenSketch_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Skype*.xml" 2^>nul') do if exist %%i set "SkypeApp_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *SolitaireCollection*.xml" 2^>nul') do if exist %%i set "SolitaireCollection_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *SoundRecorder*.xml" 2^>nul') do if exist %%i set "SoundRecorder_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *StickyNotes*.xml" 2^>nul') do if exist %%i set "StickyNotes_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Store*.xml" 2^>nul') do if exist %%i set "Store_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *StorePurchaseApp*.xml" 2^>nul') do if exist %%i set "StorePurchaseApp_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *3DBuilder*.xml" 2^>nul') do if exist %%i set "ThreeDBuilder_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *3DView*.xml" 2^>nul') do if exist %%i set "ThreeDViewer_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*arm*.xml" 2^>nul') do if exist %%i set "VP9VideoExtensions_arm_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*x86*.xml" 2^>nul') do if exist %%i set "VP9VideoExtensions_x86_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *VP9VideoExtensions*x64*.xml" 2^>nul') do if exist %%i set "VP9VideoExtensions_x64_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Wallet*.xml" 2^>nul') do if exist %%i set "Wallet_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebMediaExtensions*.xml" 2^>nul') do if exist %%i set "WebMediaExtensions_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*arm*.xml" 2^>nul') do if exist %%i set "WebpImageExtension_arm_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*x86*.xml" 2^>nul') do if exist %%i set "WebpImageExtension_x86_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *WebpImageExtension*x64*.xml" 2^>nul') do if exist %%i set "WebpImageExtension_x64_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *ConnectivityStore*.xml" 2^>nul') do if exist %%i set "WiFi_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxApp*.xml" 2^>nul') do if exist %%i set "XboxApp_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGameOverlay*.xml" 2^>nul') do if exist %%i set "XboxGameOverlay_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxGamingOverlay*.xml" 2^>nul') do if exist %%i set "XboxGamingOverlay_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxIdentityProvider*.xml" 2^>nul') do if exist %%i set "XboxIdentityProvider_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxLIVEGames*.xml" 2^>nul') do if exist %%i set "XboxLiveGames_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *XboxSpeechToTextOverlay*.xml" 2^>nul') do if exist %%i set "XboxSpeechToTextOverlay_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Xbox.TCUI*.xml" 2^>nul') do if exist %%i set "XboxTCUI_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *Microsoft.YourPhone*.xml" 2^>nul') do if exist %%i set "YourPhone_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneMusic*.xml" 2^>nul') do if exist %%i set "ZuneMusic_License=%Apps%\%%i"
for /f %%i IN ('"dir /b *ZuneVideo*.xml" 2^>nul') do if exist %%i set "ZuneVideo_License=%Apps%\%%i"

cd /d "%ROOT%\"

cls
echo.===============================================================================
echo. 	      MSMG ToolKit - Integrate Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò##########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò###################################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		:: Integraing Windows 8.1 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò to Install Image File
		if "%SelectedSourceOS%" equ "w81" (
			if "%MetroApp%" equ "Alarms" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms", %Alarms_Appx%, %Alarms_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Calculator" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", %Calculator_Appx%, %Calculator_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "CommunicationsApps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calender, Mail and People", %CommunicationsApps_Appx%, %CommunicationsApps_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingFinance" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Finance", %BingFinance_Appx%, %BingFinance_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingFoodDrink" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Food and Drink", %BingFoodDrink_Appx%, %BingFoodDrink_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingHealthFitness" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Health and Fitness", %BingHealthFitness_Appx%, %BingHealthFitness_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingMaps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Maps", %BingMaps_Appx%, %BingMaps_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingNews" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing News", %BingNews_Appx%, %BingNews_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingSports" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Sports", %BingSports_Appx%, %BingSports_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingTravel" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Travel", %BingTravel_Appx%, %BingTravel_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingWeather" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "HelpAndTips" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Help and Tips", %HelpAndTips_Appx%, %HelpAndTips_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OfficeOneNote" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office OneNote", %OfficeOneNote_Appx%, %OfficeOneNote_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Reader" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reader", %Reader_Appx%, %Reader_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ReadingList" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reading List", %ReadingList_Appx%, %ReadingList_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Scan" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Scan", %Scan_Appx%, %Scan_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SkypeApp" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SoundRecorder" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sound Recorder", %SoundRecorder_Appx%, %SoundRecorder_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "XboxLiveGames" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live Games", %XboxLiveGames_Appx%, %XboxLiveGames_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ZuneMusic" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Music", %ZuneMusic_Appx%, %ZuneMusic_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ZuneVideo" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Video", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
		)

		:: Integrating Windows 10 Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò to Install Image
		if "%SelectedSourceOS%" equ "w10" (
			if "%MetroApp%" equ "Alarms" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms and Clock", %Alarms_Appx%, %Alarms_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "AppConnector" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "App Connector", %AppConnector_Appx%, %AppConnector_License%, ""
			if "%MetroApp%" equ "BingFinance" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Finance", %BingFinance_Appx%, %BingFinance_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingNews" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing News", %BingNews_Appx%, %BingNews_License%, %BingNews_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingSports" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Sports", %BingSports_Appx%, %BingSports_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingWeather" if "%ImageBuild%" leq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "BingWeather" if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Calculator" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", %Calculator_Appx%, %Calculator_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Camera" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Camera", %Camera_Appx%, %Camera_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "CommunicationsApps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calendar and Mail", %CommunicationsApps_Appx%, %CommunicationsApps_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "DesktopAppInstaller" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Desktop App Installer", %DesktopAppInstaller_Appx%, %DesktopAppInstaller_License%, "%DependencyPackages%"

			if "%MetroApp%" equ "Extensions" (
				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x86" (
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension", %HEIFImageExtension_x86_Appx%, %HEIFImageExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension", %HEVCVideoExtension_x86_Appx%, %HEVCVideoExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension", %MPEG2VideoExtension_x86_Appx%, %MPEG2VideoExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension", %VP9VideoExtensions_x86_Appx%, %VP9VideoExtensions_x86_License%, "%DependencyPackages%"
				)

				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x64" (
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension x86", %HEIFImageExtension_x86_Appx%, %HEIFImageExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension x64", %HEIFImageExtension_x64_Appx%, %HEIFImageExtension_x64_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension x86", %HEVCVideoExtension_x86_Appx%, %HEVCVideoExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension x64", %HEVCVideoExtension_x64_Appx%, %HEVCVideoExtension_x64_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension x86", %MPEG2VideoExtension_x86_Appx%, %MPEG2VideoExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension x64", %MPEG2VideoExtension_x64_Appx%, %MPEG2VideoExtension_x64_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension x86", %VP9VideoExtensions_x86_Appx%, %VP9VideoExtensions_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension x64", %VP9VideoExtensions_x64_Appx%, %VP9VideoExtensions_x64_License%, "%DependencyPackages%"
				)

				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "arm64" (
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension", %HEIFImageExtension_arm_Appx%, %HEIFImageExtension_arm_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension", %HEVCVideoExtension_arm_Appx%, %HEVCVideoExtension_arm_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension", %MPEG2VideoExtension_arm_Appx%, %MPEG2VideoExtension_arm_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension", %VP9VideoExtensions_arm_Appx%, %VP9VideoExtensions_arm_License%, "%DependencyPackages%"
				)

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Web Media Extension", %WebMediaExtensions_Appx%, %WebMediaExtensions_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x86" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension", %WebpImageExtension_x86_Appx%, %WebpImageExtension_x86_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x64" (
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension x86", %WebpImageExtension_x86_Appx%, %WebpImageExtension_x86_License%, "%DependencyPackages%"
					call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension x64", %WebpImageExtension_x64_Appx%, %WebpImageExtension_x64_License%, "%DependencyPackages%"
				)

				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "arm64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension", %WebpImageExtension_arm_Appx%, %WebpImageExtension_arm_License%, "%DependencyPackages%"
			)

			if "%MetroApp%" equ "FeedbackHub" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Feedback Hub", %FeedbackHub_Appx%, %FeedbackHub_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "GetHelp" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Help", %GetHelp_Appx%, %GetHelp_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Getstarted" if "%ImageBuild%" leq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Started", %Getstarted_Appx%, %Getstarted_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Getstarted" if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Tips", %Getstarted_Appx%, %Getstarted_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Maps" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Maps", %Maps_Appx%, %Maps_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Messaging" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Messaging", %Messaging_Appx%, %Messaging_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "MixedRealityPortal" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mixed Reality Portal", %MixedRealityPortal_Appx%, %MixedRealityPortal_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OfficeHub" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Office", %OfficeHub_Appx%, %OfficeHub_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OfficeHub" if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "My Office", %OfficeHub_Appx%, %OfficeHub_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OfficeOneNote" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office OneNote", %OfficeOneNote_Appx%, %OfficeOneNote_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OfficeSway" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office Sway", %OfficeSway_Appx%, %OfficeSway_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OneConnect" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paid WiFi and Mobile", %OneConnect_Appx%, %OneConnect_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "OneConnect" if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mobile Plans", %OneConnect_Appx%, %OneConnect_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Paint3D" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paint 3D", %Paint3D_Appx%, %Paint3D_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "People" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "People", %People_Appx%, %People_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Phone" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Phone", %Phone_Appx%, %Phone_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "PhoneCompanion" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Phone Companion", %PhoneCompanion_Appx%, %PhoneCompanion_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Photos" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Photos", %Photos_Appx%, %Photos_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Print3D" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Print 3D", %Print3D_Appx%, %Print3D_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ScreenSketch" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Snip and Sketch", %ScreenSketch_Appx%, %ScreenSketch_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SkypeApp" if "%ImageBuild%" leq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Skype App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SkypeApp" if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype Preview App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SkypeApp" if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SolitaireCollection" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Solitaire Collection", %SolitaireCollection_Appx%, %SolitaireCollection_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "SoundRecorder" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Voice Recorder", %SoundRecorder_Appx%, %SoundRecorder_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "StickyNotes" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sticky Notes", %StickyNotes_Appx%, %StickyNotes_License%, "%DependencyPackages%"

			if "%MetroApp%" equ "Store" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Store", %Store_Appx%, %Store_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Store Purchase App", %StorePurchaseApp_Appx%, %StorePurchaseApp_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Identity Provider", %XboxIdentityProvider_Appx%, %XboxIdentityProvider_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live", %XboxTCUI_Appx%, %XboxTCUI_License%, "%DependencyPackages%"
			)

			if "%MetroApp%" equ "ThreeDBuilder" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "3D Builder", %ThreeDBuilder_Appx%, %ThreeDBuilder_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ThreeDViewer" if "%ImageBuild%" equ "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "View 3D Preview", %ThreeDViewer_Appx%, %ThreeDViewer_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ThreeDViewer" if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mixed Reality Viewer", %ThreeDViewer_Appx%, %ThreeDViewer_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "Wallet" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Wallet", %Wallet_Appx%, %Wallet_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "WiFi" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "WiFi", %WiFi_Appx%, %WiFi_License%, "%DependencyPackages%"

			if "%MetroApp%" equ "XboxApp" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox App", %XboxApp_Appx%, %XboxApp_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Overlay", %XboxGameOverlay_Appx%, %XboxGameOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Gaming Overlay", %XboxGamingOverlay_Appx%, %XboxGamingOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Identity Provider", %XboxIdentityProvider_Appx%, %XboxIdentityProvider_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Speech Window", %XboxSpeechToTextOverlay_Appx%, %XboxSpeechToTextOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live", %XboxTCUI_Appx%, %XboxTCUI_License%, "%DependencyPackages%"
			)

			if "%MetroApp%" equ "YourPhone" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Your Phone", %YourPhone_Appx%, %YourPhone_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ZuneMusic" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Groove Music", %ZuneMusic_Appx%, %ZuneMusic_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ZuneVideo" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Movies and TV", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
			if "%MetroApp%" equ "ZuneVideo" if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Films and TV", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
		)

		:: Integrating All Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò to Install Image
		if "%MetroApp%" equ "AllApps" (
			if "%SelectedSourceOS%" equ "w81" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms", %Alarms_Appx%, %Alarms_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", %Calculator_Appx%, %Calculator_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calender, Mail and People", %CommunicationsApps_Appx%, %CommunicationsApps_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Finance", %BingFinance_Appx%, %BingFinance_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Food and Drink", %BingFoodDrink_Appx%, %BingFoodDrink_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Health and Fitness", %BingHealthFitness_Appx%, %BingHealthFitness_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Maps", %BingMaps_Appx%, %BingMaps_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing News", %BingNews_Appx%, %BingNews_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Sports", %BingSports_Appx%, %BingSports_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Travel", %BingTravel_Appx%, %BingTravel_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Help and Tips", %HelpAndTips_Appx%, %HelpAndTips_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office OneNote", %OfficeOneNote_Appx%, %OfficeOneNote_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reader", %Reader_Appx%, %Reader_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Reading List", %ReadingList_Appx%, %ReadingList_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Scan", %Scan_Appx%, %Scan_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sound Recorder", %SoundRecorder_Appx%, %SoundRecorder_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live Games", %XboxLiveGames_Appx%, %XboxLiveGames_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Music", %ZuneMusic_Appx%, %ZuneMusic_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Zune Video", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
			)

			if "%SelectedSourceOS%" equ "w10" (
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Alarms and Clock", %Alarms_Appx%, %Alarms_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "10240" if "%ImageBuild%" leq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "App Connector", %AppConnector_Appx%, %AppConnector_License%, ""

				if "%ImageBuild%" leq "10586" (
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Finance", %BingFinance_Appx%, %BingFinance_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing News", %BingNews_Appx%, %BingNews_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Sports", %BingSports_Appx%, %BingSports_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Bing Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"
				)

				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Weather", %BingWeather_Appx%, %BingWeather_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calculator", %Calculator_Appx%, %Calculator_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Camera", %Camera_Appx%, %Camera_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Calendar and Mail", %CommunicationsApps_Appx%, %CommunicationsApps_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "14393" if "%ImageBuild%" lss "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Desktop App Installer", %DesktopAppInstaller_Appx%, %DesktopAppInstaller_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Desktop App Installer", %DesktopAppInstaller_Appx%, %DesktopAppInstaller_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "17763" (
					if "%ImageArchitecture%" equ "x86" (
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension", %HEIFImageExtension_x86_Appx%, %HEIFImageExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension", %HEVCVideoExtension_x86_Appx%, %HEVCVideoExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension", %MPEG2VideoExtension_x86_Appx%, %MPEG2VideoExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension", %VP9VideoExtensions_x86_Appx%, %VP9VideoExtensions_x86_License%, "%DependencyPackages%"
					)

					if "%ImageArchitecture%" equ "x64" (
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension x86", %HEIFImageExtension_x86_Appx%, %HEIFImageExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension x64", %HEIFImageExtension_x64_Appx%, %HEIFImageExtension_x64_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension x86", %HEVCVideoExtension_x86_Appx%, %HEVCVideoExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension x64", %HEVCVideoExtension_x64_Appx%, %HEVCVideoExtension_x64_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension x86", %MPEG2VideoExtension_x86_Appx%, %MPEG2VideoExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension x64", %MPEG2VideoExtension_x64_Appx%, %MPEG2VideoExtension_x64_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension x86", %VP9VideoExtensions_x86_Appx%, %VP9VideoExtensions_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension x64", %VP9VideoExtensions_x64_Appx%, %VP9VideoExtensions_x64_License%, "%DependencyPackages%"
					)

					if "%ImageArchitecture%" equ "arm64" (
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEIF Image Extension", %HEIFImageExtension_arm_Appx%, %HEIFImageExtension_arm_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "HEVC Video Extension", %HEVCVideoExtension_arm_Appx%, %HEVCVideoExtension_arm_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "MPEG2 Video Extension", %MPEG2VideoExtension_arm_Appx%, %MPEG2VideoExtension_arm_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "VP9 Video Extension", %VP9VideoExtensions_arm_Appx%, %VP9VideoExtensions_arm_License%, "%DependencyPackages%"
					)
				)

				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Web Media Extension", %WebMediaExtensions_Appx%, %WebMediaExtensions_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "17763" (
					if "%ImageArchitecture%" equ "x86" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension", %WebpImageExtension_x86_Appx%, %WebpImageExtension_x86_License%, "%DependencyPackages%"

					if "%ImageArchitecture%" equ "x64" (
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension x86", %WebpImageExtension_x86_Appx%, %WebpImageExtension_x86_License%, "%DependencyPackages%"
						call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension x64", %WebpImageExtension_x64_Appx%, %WebpImageExtension_x64_License%, "%DependencyPackages%"
					)

					if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "arm64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Webp Image Extension", %WebpImageExtension_arm_Appx%, %WebpImageExtension_arm_License%, "%DependencyPackages%"
				)

				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Feedback Hub", %FeedbackHub_Appx%, %FeedbackHub_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Help", %GetHelp_Appx%, %GetHelp_License%, "%DependencyPackages%"
				if "%ImageBuild%" leq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Started", %Getstarted_Appx%, %Getstarted_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Tips", %Getstarted_Appx%, %Getstarted_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Maps", %Maps_Appx%, %Maps_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Messaging", %Messaging_Appx%, %Messaging_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17763" if "%ImageArchitecture%" equ "x64" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mixed Reality Portal", %MixedRealityPortal_Appx%, %MixedRealityPortal_License%, "%DependencyPackages%"
				if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Office", %OfficeHub_Appx%, %OfficeHub_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "My Office", %OfficeHub_Appx%, %OfficeHub_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office OneNote", %OfficeOneNote_Appx%, %OfficeOneNote_License%, "%DependencyPackages%"

				if "%ImageBuild%" equ "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Office Sway", %OfficeSway_Appx%, %OfficeSway_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paid WiFi and Mobile", %OneConnect_Appx%, %OneConnect_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mobile Plans", %OneConnect_Appx%, %OneConnect_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Paint 3D", %Paint3D_Appx%, %Paint3D_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "People", %People_Appx%, %People_License%, "%DependencyPackages%"

				if "%ImageBuild%" equ "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Phone", %Phone_Appx%, %Phone_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "10240" if "%ImageBuild%" leq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Phone Companion", %PhoneCompanion_Appx%, %PhoneCompanion_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Photos", %Photos_Appx%, %Photos_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Print 3D", %Print3D_Appx%, %Print3D_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Snip and Sketch", %ScreenSketch_Appx%, %ScreenSketch_License%, "%DependencyPackages%"
				if "%ImageBuild%" leq "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Get Skype App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "14393" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype Preview App", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Skype", %SkypeApp_Appx%, %SkypeApp_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Solitaire Collection", %SolitaireCollection_Appx%, %SolitaireCollection_License%, "%DependencyPackages%"
				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Voice Recorder", %SoundRecorder_Appx%, %SoundRecorder_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Sticky Notes", %StickyNotes_Appx%, %StickyNotes_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Store", %Store_Appx%, %Store_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Store Purchase App", %StorePurchaseApp_Appx%, %StorePurchaseApp_License%, "%DependencyPackages%"
				if "%ImageBuild%" leq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "3D Builder", %ThreeDBuilder_Appx%, %ThreeDBuilder_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Mixed Reality Viewer", %ThreeDViewer_Appx%, %ThreeDViewer_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "15063" if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "View 3D Preview", %ThreeDViewer_Appx%, %ThreeDViewer_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Wallet", %Wallet_Appx%, %Wallet_License%, "%DependencyPackages%"
				if "%ImageBuild%" equ "10586" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "WiFi", %WiFi_Appx%, %WiFi_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox App", %XboxApp_Appx%, %XboxApp_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Overlay", %XboxGameOverlay_Appx%, %XboxGameOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Gaming Overlay", %XboxGamingOverlay_Appx%, %XboxGamingOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "14393" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Identity Provider", %XboxIdentityProvider_Appx%, %XboxIdentityProvider_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "15063" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Game Speech Window", %XboxSpeechToTextOverlay_Appx%, %XboxSpeechToTextOverlay_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Xbox Live", %XboxTCUI_Appx%, %XboxTCUI_License%, "%DependencyPackages%"
				if "%ImageBuild%" geq "17763" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Your Phone", %YourPhone_Appx%, %YourPhone_License%, "%DependencyPackages%"

				call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Groove Music", %ZuneMusic_Appx%, %ZuneMusic_License%, "%DependencyPackages%"

				if "%ImageBuild%" geq "17134" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Films and TV", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
				if "%ImageBuild%" leq "16299" call :AddProvisionedAppxPackage "%InstallMount%\%%i", "Movies and TV", %ZuneVideo_Appx%, %ZuneVideo_License%, "%DependencyPackages%"
			)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò##########################
echo.-------------------------------------------------------------------------------
echo.

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

set Apps=
set MetroApp=

set Alarms_Appx=
set AppConnector_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 CommunicationsApps_Appx=
set DesktopAppInstaller_Appx=
set FeedbackHub_Appx=
set GetHelp_Appx=
set Getstarted_Appx=
set HEIFImageExtension_arm_Appx=
set HEIFImageExtension_x86_Appx=
set HEIFImageExtension_x64_Appx=
set HEVCVideoExtension_arm_Appx=
set HEVCVideoExtension_x86_Appx=
set HEVCVideoExtension_x64_Appx=
set HelpAndTips_Appx=
set Maps_Appx=
set Messaging_Appx=
set MixedRealityPortal_Appx=
set MPEG2VideoExtension_arm_Appx=
set MPEG2VideoExtension_x86_Appx=
set MPEG2VideoExtension_x64_Appx=
set OfficeHub_Appx=
set OfficeOneNote_Appx=
set OfficeSway_Appx=
set OneConnect_Appx=
set Paint3D_Appx=
set People_Appx=
set Phone_Appx=
set PhoneCompanion_Appx=
set Photos_Appx=
set Print3D_Appx=
set Reader_Appx=
set ReadingList_Appx=
set Scan_Appx=
set ScreenSketch_Appx=
set Skype_Appx=
set SolitaireCollection_Appx=
set SoundRecorder_Appx=
set StickyNotes_Appx=
set Store_Appx=
set StorePurchase_Appx=
set ThreeDBuilder_Appx=
set ThreeDViewer_Appx=
set VP9VideoExtensions_arm_Appx=
set VP9VideoExtensions_x86_Appx=
set VP9VideoExtensions_x64_Appx=
set Wallet_Appx=
set WebMediaExtensions_Appx=
set WebpImageExtension_arm_Appx=
set WebpImageExtension_x86_Appx=
set WebpImageExtension_x64_Appx=
set WiFi_Appx=
set Xbox_Appx=
set XboxGameOverlay_Appx=
set XboxGamingOverlay_Appx=
set XboxIdentityProvider_Appx=
set XboxLiveGames_Appx=
set XboxSpeechToTextOverlay_Appx=
set XboxTCUI_Appx=
set YourPhone_Appx=
set ZuneMusic_Appx=
set ZuneVideo_Appx=

set Alarms_License=
set AppConnector_License=
set BingFinance_License=
set BingFoodDrink_License=
set BingHealthFitness_License=
set BingMaps_License=
set BingNews_License=
set BingSports_License=
set BingTravel_License=
set BingWeather_License=
set Calculator_License=
set Camera_License=
set CommunicationsApps_License=
set DesktopAppInstaller_License=
set FeedbackHub_License=
set GetHelp_License=
set Getstarted_License=
set HEIFImageExtension_arm_License=
set HEIFImageExtension_x86_License=
set HEIFImageExtension_x64_License=
set HEVCVideoExtension_arm_License=
set HEVCVideoExtension_x86_License=
set HEVCVideoExtension_x64_License=
set HelpAndTips_License=
set Maps_License=
set Messaging_License=
set MixedRealityPortal_License=
set MPEG2VideoExtension_arm_License=
set MPEG2VideoExtension_x86_License=
set MPEG2VideoExtension_x64_License=
set OfficeHub_License=
set OfficeOneNote_License=
set OfficeSway_License=
set OneConnect_License=
set Paint3D_License=
set People_License=
set Phone_License=
set PhoneCompanion_License=
set Photos_License=
set Print3D_License=
set Reader_License=
set ReadingList_License=
set Scan_License=
set ScreenSketch_License=
set Skype_License=
set SolitaireCollection_License=
set SoundRecorder_License=
set StickyNotes_License=
set Store_License=
set StorePurchase_License=
set ThreeDBuilder_License=
set ThreeDViewer_License=
set VP9VideoExtensions_arm_License=
set VP9VideoExtensions_x86_License=
set VP9VideoExtensions_x64_License=
set Wallet_License=
set WebMediaExtensions_License=
set WebpImageExtension_arm_License=
set WebpImageExtension_x86_License=
set WebpImageExtension_x64_License=
set WiFi_License=
set Xbox_License=
set XboxGameOverlay_License=
set XboxGamingOverlay_License=
set XboxIdentityProvider_License=
set XboxLiveGames_License=
set XboxSpeechToTextOverlay_License=
set XboxTCUI_License=
set YourPhone_License=
set ZuneMusic_License=
set ZuneVideo_License=

set AdvertisingXaml_arm_Appx=
set AdvertisingXaml_arm64_Appx=
set AdvertisingXaml_x86_Appx=
set AdvertisingXaml_x64_Appx=
set MediaPlayReadyClient22_arm_Appx=
set MediaPlayReadyClient22_x86_Appx=
set MediaPlayReadyClient22_x64_Appx=
set NETNativeFramework13_arm_Appx=
set NETNativeFramework13_x86_Appx=
set NETNativeFramework13_x64_Appx=
set NETNativeFramework16_arm_Appx=
set NETNativeFramework16_x86_Appx=
set NETNativeFramework16_x64_Appx=
set NETNativeFramework17_arm_Appx=
set NETNativeFramework17_x86_Appx=
set NETNativeFramework17_x64_Appx=
set NETNativeFramework21_arm_Appx=
set NETNativeFramework21_x86_Appx=
set NETNativeFramework21_x64_Appx=
set NETNativeFramework22_arm_Appx=
set NETNativeFramework22_arm64_Appx=
set NETNativeFramework22_x86_Appx=
set NETNativeFramework22_x64_Appx=
set NETNativeRuntime13_arm_Appx=
set NETNativeRuntime13_x86_Appx=
set NETNativeRuntime13_x64_Appx=
set NETNativeRuntime14_arm_Appx=
set NETNativeRuntime14_x86_Appx=
set NETNativeRuntime14_x64_Appx=
set NETNativeRuntime16_arm_Appx=
set NETNativeRuntime16_x86_Appx=
set NETNativeRuntime16_x64_Appx=
set NETNativeRuntime17_arm_Appx=
set NETNativeRuntime17_x86_Appx=
set NETNativeRuntime17_x64_Appx=
set NETNativeRuntime21_arm_Appx=
set NETNativeRuntime21_x86_Appx=
set NETNativeRuntime21_x64_Appx=
set NETNativeRuntime22_arm_Appx=
set NETNativeRuntime22_arm64_Appx=
set NETNativeRuntime22_x86_Appx=
set NETNativeRuntime22_x64_Appx=
set ServicesStoreEngagement_arm_Appx=
set ServicesStoreEngagement_arm64_Appx=
set ServicesStoreEngagement_x86_Appx=
set ServicesStoreEngagement_x64_Appx=
set UIXaml20_arm_Appx=
set UIXaml20_arm64_Appx=
set UIXaml20_x86_Appx=
set UIXaml20_x64_Appx=
set UIXaml21_arm_Appx=
set UIXaml21_arm64_Appx=
set UIXaml21_x86_Appx=
set UIXaml21_x64_Appx=
set VCLibs12_arm_Appx=
set VCLibs12_x86_Appx=
set VCLibs12_x64_Appx=
set VCLibs14_arm_Appx=
set VCLibs14_arm64_Appx=
set VCLibs14_x86_Appx=
set VCLibs14_x64_Appx=
set VCLibsUWPDesktop14_arm_Appx=
set VCLibsUWPDesktop14_arm64_Appx=
set VCLibsUWPDesktop14_x86_Appx=
set VCLibsUWPDesktop14_x64_Appx=
set WinJS20_Appx=

set AdvertisingXaml=
set DependencyPackages=
set NETNativeFramework13=
set NETNativeFramework16=
set NETNativeFramework17=
set NETNativeFramework21=
set NETNativeFramework22=
set NETNativeRuntime13=
set NETNativeRuntime14=
set NETNativeRuntime16=
set NETNativeRuntime17=
set NETNativeRuntime21=
set NETNativeRuntime22=
set ServicesStoreEngagement=
set UIXaml20=
set UIXaml21=
set VCLibs14=
set VCLibsUWPDesktop14=

endlocal

:: Returning to Integrate Microsoft Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò²Ëµ¥
goto :IntMetroApps
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Integrate Microsoft Office Desktop Universal Windows Platform (UWP) Apps
::-------------------------------------------------------------------------------------------
: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 ToolKit - ¼¯³ÉMicrosoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò
echo.===============================================================================
echo.

:: Checking whether Microsoft Office Desktop (UWP) Apps folder is empty
if not exist "%OfficeUWP%\*.appxbundle" (
	echo.Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò°üÎÄ¼þ¼Ð ^<Packs\%OfficeUWP%^> Îª¿Õ...
	echo.
	echo.Çë¸´ÖÆ Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò°üÎÄ¼þµ½ÏàÓ¦µÄÎÄ¼þ¼Ð...
	echo.
	goto :Stop
)

if not exist "%OfficeUWP%\*.xml" (
	echo.Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò°üÎÄ¼þ¼Ð ^<Packs\%OfficeUWP%^> Îª¿Õ...
	echo.
	echo.Çë¸´ÖÆ Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò°üÎÄ¼þµ½ÏàÓ¦µÄÎÄ¼þ¼Ð...
	echo.
	goto :Stop
)

cls
echo.===============================================================================
echo.      MSMG ToolKit - ¼¯³É Microsoft Office Desktop ^(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 :IntFeatures
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"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Getting Microsoft Office Desktop (UWP) Apps files full pathnames
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 ToolKit - ¼¯³É Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Office Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò###################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%OfficeUWPApp%" equ "AllOfficeApps" echo.####¼¯³É Microsoft Office Desktop ^(UWP^) Apps############################
if "%OfficeUWPApp%" equ "OfficeAccess" echo.####¼¯³É Microsoft Office Desktop - Access ^(UWP^) Apps###################
if "%OfficeUWPApp%" equ "OfficeExcel" echo.####¼¯³É Microsoft Office Desktop - Excel ^(UWP^) Apps####################
if "%OfficeUWPApp%" equ "OfficeOutlook" echo.####¼¯³É Microsoft Office Desktop - Outlook ^(UWP^) Apps##################
if "%OfficeUWPApp%" equ "OfficePowerPoint" echo.####¼¯³É Microsoft Office Desktop - PowerPoint ^(UWP^) Apps###############
if "%OfficeUWPApp%" equ "OfficePublisher" echo.####¼¯³É Microsoft Office Desktop - Publisher ^(UWP^) Apps################
if "%OfficeUWPApp%" equ "OfficeWord" echo.####¼¯³É Microsoft Office Desktop - Word ^(UWP^) Apps#####################
echo.-------------------------------------------------------------------------------

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

		:: Getting Image Index Information
		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 Desktop ^(UWP^) Ó¦ÓÃ³ÌÐò###################
echo.-------------------------------------------------------------------------------
echo.

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

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

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

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Thin PC ¸½¼Ó¹¦ÄÜ
::-------------------------------------------------------------------------------------------
:IntThinPcPkgs

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.            MSMG ToolKit - ¼¯³É Windows Thin PC ¸½¼Ó¹¦ÄÜ
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                              ¾¯         ¸æ
	echo.                              =============
	echo.
	echo.  ÔÚ¼¯³ÉÓïÑÔ°ü»òÈÎºÎ Windows ¹¦ÄÜÖ®Ç°£¬Çë²»Òª¼¯³ÉÈÎºÎ¸üÐÂ¡£
	echo.  Èç¹ûÄúÔÚ¼¯³ÉÈÎºÎ¸üÐÂÖ®Ç°¼¯³ÉÁË°üº¬ÒÀÀµÓÚÓïÑÔ/¹¦ÄÜµÄ×ÊÔ´µÄÈÎºÎ¸üÐÂ
	echo.  ^(ÐÞ²¹³ÌÐò£¬Í¨ÓÃ·¢ÐÐ°æ±¾ [GDR]£¬ÁãÈÕ²¹¶¡[ZDP] »ò Service Pack [SP] ^)£¬
	echo.  ¸üÐÂÖÐ°üº¬µÄÓïÑÔ/¹¦ÄÜÌØ¶¨µÄ¸ü¸ÄÎ´Ó¦ÓÃ£¬Äú½«²»µÃ²»ÖØÐÂ¼¯³É¸üÐÂ¡£
	echo.  ÔÚ°²×°¸üÐÂÖ®Ç°£¬ÇëÊ¼ÖÕ¼¯³ÉÓïÑÔ°ü/Windows ¹¦ÄÜ¡£
	echo.
	echo.
	echo.  Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

set Feature=

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Windows Thin PC ¸½¼Ó¹¦ÄÜ
echo.===============================================================================

:: Checking whether Multi-Index servicing mode is selected
if /i "%ImageIndexNo%" equ "A" (
	echo.ÆôÓÃ¶àË÷Òý·þÎñÄ£Ê½Ê±£¬´Ë¹¦ÄÜ²»¿ÉÓÃ...
	echo.
	echo.ÇëÊ¹ÓÃµ¥¸öË÷ÒýÖØÐÂÑ¡ÔñÀ´Ô´...
	goto :Stop
)

:: Checking whether the selected Source OS is a Windows Thin PC OS
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 Backup ^& Restore
echo.  [C]  Windows Basic Help
echo.  [D]  Windows Defender
echo.  [E]  Windows DVD Maker
echo.  [F]  Windows Fax ^& Scan
echo.  [G]  Windows ISO Burner
echo.  [H]  Windows Media Center
echo.  [I]  Windows Media Player Premium Codecs
echo.  [J]  Windows Mobility Center
echo.  [K]  Windows Parental Control
echo.  [L]  Windows Photo Viewer
echo.  [M]  Windows Search
echo.  [N]  Windows Speech ^& Text with Speech US English Pack
echo.  [O]  Windows Tablet PC Support
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 ToolKit - ¼¯³É Microsoft .NET Framework 3.5 ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "BackupRestore" echo.       MSMG ToolKit - Integrate Windows Backup ^& Restore ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "BasicHelp" echo.         MSMG ToolKit - ¼¯³É Windows Basic Help ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "Defender" echo.          MSMG ToolKit - ¼¯³É Windows Defender ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "DVDMaker" echo.          MSMG ToolKit - ¼¯³É Windows DVD Maker ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "FaxScan" echo.           MSMG ToolKit - ¼¯³É Windows Fax ^& Scan ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "ISOBurner" echo.          MSMG ToolKit - ¼¯³É Windows ISO Burner ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "MediaCenter" echo.        MSMG ToolKit - Integrate Windows Media Center ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "PremiumCodecs" echo.     MSMG ToolKit - Integrate Windows Media Player Premium Codecs ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "MobilityCenter" echo.        MSMG ToolKit - Integrate Windows Mobility Center ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "ParentalControl" echo.       MSMG ToolKit - Integrate Windows Parental Control ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "PhotoViewer" echo.          MSMG ToolKit - ¼¯³É Windows Photo Viewer ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "Search" echo.             MSMG ToolKit - ¼¯³É Windows Search ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "SpeechText" echo.        MSMG ToolKit - Integrate Windows Speech ^& Text ¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "TabletPC" echo.          MSMG ToolKit - ¼¯³É Windows Tablet PC¸½¼Ó¹¦ÄÜ
if "%Feature%" equ "All" echo.            MSMG ToolKit - ¼¯³É Windows Thin PC ¸½¼Ó¹¦ÄÜ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether Windows Thin PC ¸½¼Ó¹¦ÄÜ folder is empty
if not exist "%ThinPC%\*.*" (
	echo.Windows Thin PC ¸½¼Ó¹¦ÄÜ folder ^<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 Backup ^& Restore ¸½¼Ó¹¦ÄÜ################
if "%Feature%" equ "BasicHelp" echo.####¿ªÊ¼¼¯³É Windows Basic Help ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "Defender" echo.####¿ªÊ¼¼¯³É Windows Defender ¸½¼Ó¹¦ÄÜ#######################
if "%Feature%" equ "DVDMaker" echo.####¿ªÊ¼¼¯³É Windows DVD Maker ¸½¼Ó¹¦ÄÜ######################
if "%Feature%" equ "FaxScan" echo.####¿ªÊ¼¼¯³É Windows Fax ^& Scan ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "ISOBurner" echo.####¿ªÊ¼¼¯³É Windows ISO Burner ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "MediaCenter" echo.####¿ªÊ¼¼¯³É Windows Media Center ¸½¼Ó¹¦ÄÜ###################
if "%Feature%" equ "PremiumCodecs" echo.####¿ªÊ¼¼¯³É Windows Media Player Premium Codecs ¸½¼Ó¹¦ÄÜ##########
if "%Feature%" equ "MobilityCenter" echo.####¿ªÊ¼¼¯³É Windows Mobility Center ¸½¼Ó¹¦ÄÜ################
if "%Feature%" equ "ParentalControl" echo.####¿ªÊ¼¼¯³É Windows Parental Control ¸½¼Ó¹¦ÄÜ###############
if "%Feature%" equ "PhotoViewer" echo.####¿ªÊ¼¼¯³É Windows Photo Viewer ¸½¼Ó¹¦ÄÜ###################
if "%Feature%" equ "Search" echo.####¿ªÊ¼¼¯³É Windows Search ¸½¼Ó¹¦ÄÜ#########################
if "%Feature%" equ "SpeechText" echo.####¿ªÊ¼¼¯³É Windows Speech ^& Text ¸½¼Ó¹¦ÄÜ##################
if "%Feature%" equ "TabletPC" echo.####¿ªÊ¼¼¯³É Windows Tablet PC ¸½¼Ó¹¦ÄÜ######################
if "%Feature%" equ "All" echo.####¿ªÊ¼¼¯³É Windows Thin PC ¸½¼Ó¹¦ÄÜ#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####¼¯³É Microsoft .NET Framework 3.5 Add-on Feature####################
if "%Feature%" equ "BackupRestore" echo.####¼¯³É Windows Backup ^& Restore ¸½¼Ó¹¦ÄÜ#######################
if "%Feature%" equ "BasicHelp" echo.####¼¯³É Windows Basic Help ¸½¼Ó¹¦ÄÜ##############################
if "%Feature%" equ "Defender" echo.####¼¯³É Windows Defender ¸½¼Ó¹¦ÄÜ################################
if "%Feature%" equ "DVDMaker" echo.####¼¯³É Windows DVD Maker ¸½¼Ó¹¦ÄÜ###############################
if "%Feature%" equ "FaxScan" echo.####¼¯³É Windows Fax ^& Scan ¸½¼Ó¹¦ÄÜ##############################
if "%Feature%" equ "ISOBurner" echo.####¼¯³É Windows ISO Burner ¸½¼Ó¹¦ÄÜ##############################
if "%Feature%" equ "MediaCenter" echo.####¼¯³É Windows Media Center ¸½¼Ó¹¦ÄÜ############################
if "%Feature%" equ "PremiumCodecs" echo.####¼¯³É Windows Media Player Premium Codecs ¸½¼Ó¹¦ÄÜ###################
if "%Feature%" equ "MobilityCenter" echo.####¼¯³É Windows Mobility Center ¸½¼Ó¹¦ÄÜ#########################
if "%Feature%" equ "ParentalControl" echo.####¼¯³É Windows Parental Control ¸½¼Ó¹¦ÄÜ########################
if "%Feature%" equ "PhotoViewer" echo.####¼¯³É Windows Photo Viewer ¸½¼Ó¹¦ÄÜ############################
if "%Feature%" equ "Search" echo.####¼¯³É Windows Search ¸½¼Ó¹¦ÄÜ##################################
if "%Feature%" equ "SpeechText" echo.####¼¯³É Windows Speech ^& Text ¸½¼Ó¹¦ÄÜ###########################
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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%ImageEdition%" equ "Embedded" (
			if "%Feature%" equ "NetFx35" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft IIS Windows Process Activation Service Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.0 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.0 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.5 Client Profile Package...
				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 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows ISO Burner Package...
				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 Package
				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 Package...
				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 Package...
				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 Package..
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player MPEG3 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player MPEG4 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player WMV Premium Codec Package...
				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 Natural ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Search Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
			)
			
			if "%Feature%" equ "SpeechText" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Speech ^& Text US English Language Pack Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Speech ^& Text Package...
				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 Process Activation Service Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IIS-WAS~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.0 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.0 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx30Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.5 Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft .NET Framework 3.5 Client Profile Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-NetFx35Client~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Backup ^& Restore Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-BackupRestore~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Basic Help Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-HelpEngine~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Defender Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-AntiMalware~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows DVD Maker Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-DVDBurning~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Fax ^& Scan Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Fax-Scan~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows ISO Burner Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-IMAPIv2~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Center Feature...
				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 Package
				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 Package...
				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 Package...
				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 Package..
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG2andDolbyDecoder~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player MPEG3 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG3~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player MPEG4 Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-MPEG4~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Media Player WMV Premium Codec Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-PremiumCodecs-WMV~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Mobility Center Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-MobilePC~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Parental Control Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-ParentalControl~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Photo Viewer Feature...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Photos-Viewer~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Natural ÓïÑÔ°ü...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Natural-Language~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Search Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Search~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Speech ^& Text US English Language Pack Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech-LP-ENG~31bf3856ad364e35~x86~~6.1.7600.16385.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Speech ^& Text Package...
				echo.-------------------------------------------------------------------------------
				call :AddPackage "%InstallMount%\%%i", "%ThinPC%\WinEmb-Speech~31bf3856ad364e35~x86~~6.1.7601.17514.cab"
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Windows Tablet PC Support Feature...
				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.Generating Microsoft .NET Framework 3.5 Add-on Feature Integration Log...
			if "%Feature%" equ "BackupRestore" echo.Generating Windows Backup ^& Restore Add-on Feature Integration Log...
			if "%Feature%" equ "BasicHelp" echo.Generating Windows Basic Help Add-on Feature Integration Log...
			if "%Feature%" equ "Defender" echo.Generating Windows Defender Add-on Feature Integration Log...
			if "%Feature%" equ "DVDMaker" echo.Generating Windows DVD Maker Add-on Feature Integration Log...
			if "%Feature%" equ "FaxScan" echo.Generating Windows Fax ^& Scan Add-on Feature Integration Log...
			if "%Feature%" equ "ISOBurner" echo.Generating Windows ISO Burner Add-on Feature Integration Log...
			if "%Feature%" equ "MediaCenter" echo.Generating Windows Media Center Add-on Feature Integration Log...
			if "%Feature%" equ "PremiumCodecs" echo.Generating Windows Media Player Premium Codecs Features Integration Log...
			if "%Feature%" equ "MobilityCenter" echo.Generating Windows Mobility Center Add-on Feature Integration Log...
			if "%Feature%" equ "ParentalControl" echo.Generating Windows Parental Control Add-on Feature Integration Log...
			if "%Feature%" equ "PhotoViewer" echo.Generating Windows Photo Viewer Add-on Feature Integration Log...
			if "%Feature%" equ "Search" echo.Generating Windows Search Add-on Feature Integration Log...
			if "%Feature%" equ "SpeechText" echo.Generating Windows Speech ^& Text Add-on Feature Integration Log...
			if "%Feature%" equ "TabletPC" echo.Generating Windows Tablet PC Add-on Feature Integration Log...
			if "%Feature%" equ "All" echo.Generating Thin PC Add-on Features Integration Log...
			echo.-------------------------------------------------------------------------------
			echo.Writing Thin PC Add-on Features ^<Logs\ThinPC.txt^> Log file.
			call :GetPackages "%InstallMount%\%%i", "ThinPC.txt"
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
if "%Feature%" equ "NetFx35" echo.####Íê³É¼¯³É Microsoft .NET Framework 3.5 Add-on Feature###########
if "%Feature%" equ "BackupRestore" echo.####Íê³É¼¯³É Windows Backup ^& Restore Add-on Feature###############
if "%Feature%" equ "BasicHelp" echo.####Íê³É¼¯³É Windows Basic Help ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "Defender" echo.####Íê³É¼¯³É Windows Defender ¸½¼Ó¹¦ÄÜ#######################
if "%Feature%" equ "DVDMaker" echo.####Íê³É¼¯³É Windows DVD Maker ¸½¼Ó¹¦ÄÜ######################
if "%Feature%" equ "FaxScan" echo.####Íê³É¼¯³É Windows Fax ^& Scan ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "ISOBurner" echo.####Íê³É¼¯³É Windows ISO Burner ¸½¼Ó¹¦ÄÜ#####################
if "%Feature%" equ "MediaCenter" echo.####Íê³É¼¯³É Windows Media Center Add-on Feature###################
if "%Feature%" equ "PremiumCodecs" echo.####Íê³É¼¯³É Windows Media Player Premium Codecs Features##########
if "%Feature%" equ "MobilityCenter" echo.####Íê³É¼¯³É Windows Mobility Center Add-on Feature################
if "%Feature%" equ "ParentalControl" echo.####Íê³É¼¯³É Windows Parental Control Add-on Feature###############
if "%Feature%" equ "PhotoViewer" echo.####Íê³É¼¯³É Windows Photo Viewer Add-on Feature###################
if "%Feature%" equ "Search" echo.####Íê³É¼¯³É Windows Search ¸½¼Ó¹¦ÄÜ#########################
if "%Feature%" equ "SpeechText" echo.####Íê³É¼¯³É Windows Speech ^& Text Add-on Feature##################
if "%Feature%" equ "TabletPC" echo.####Íê³É¼¯³É Windows Tablet PC ¸½¼Ó¹¦ÄÜ######################
if "%Feature%" equ "All" echo.####Íê³É¼¯³É Windows Thin PC ¸½¼Ó¹¦ÄÜ#######################
echo.-------------------------------------------------------------------------------

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

set Feature=

endlocal

:: Returning to Integrate Windows Thin PC ¸½¼Ó¹¦ÄÜ Menu
goto :IntThinPcPkgs
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Diagnostics and Recovery Toolset ^(DaRT^) 7.0/8.1/10
::-------------------------------------------------------------------------------------------
:IntDaRT

setlocal

set DaRT=
set DartType=
set PackageLanguage=
set DebugTools=

cls
echo.===============================================================================
if "%SelectedSourceOS%" equ "w7" echo.              MSMG ToolKit - ¼¯³É Microsoft DaRT 7.0 ¹¤¾ß
if "%SelectedSourceOS%" equ "w81" echo.              MSMG ToolKit - ¼¯³É Microsoft DaRT 8.1 ¹¤¾ß
if "%SelectedSourceOS%" equ "w10" echo.               MSMG ToolKit - ¼¯³É Microsoft DaRT 10 ¹¤¾ß
echo.===============================================================================

if "%IsDialogsEnabled%" equ "Yes" (
	echo.
	echo.
	echo.
	echo.                              ¾¯         ¸æ
	echo.                              =============
	echo.
	echo. Microsoft DaRT 8.1/10 ¹¤¾ß°üº¬µÄ¹¦ÄÜÊ¹¹ÜÀíÔ±»ò·þÎñÌ¨¹¤×÷ÈËÔ±¿ÉÒÔÔ¶³ÌÔËÐÐ
	echo. DaRT ¹¤¾ßÀ´½â¾ö×îÖÕÓÃ»§¼ÆËã»úÉÏµÄÎÊÌâ¡£
	echo. ´ËÍâ£¬Äú¿ÉÒÔ½«¹ú¼Ê±ê×¼»¯×éÖ¯ ^(ISO^) Ó³Ïñ±£´æµ½ USB ÉÁ´æÇý¶¯Æ÷£¬»ò½« ISO
	echo. Ó³Ïñ·ÅÔÚÍøÂçÉÏÒÔ½«ÆäÄÚÈÝ×÷Îª»Ö¸´·ÖÇø°üº¬ÔÚ¼ÆËã»úÓ²ÅÌÉÏ¡£
	echo. ÕâÐ©¹¦ÄÜÌá¹©ÁËÁé»îÐÔ£¬µ«Í¬Ê±Ò²´øÀ´ÁËÇ±ÔÚµÄ°²È«·çÏÕ£¬ÄúÔÚÅäÖÃ DaRT Ê±Ó¦¿¼
	echo. ÂÇÕâÐ©·çÏÕ¡£
	echo.
	echo.
	echo.
	echo. Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

echo.
echo.  [1]  ¼¯³Éµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
echo.
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "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 ToolKit - ¼¯³É Microsoft DaRT 7.0 Tools
if "%SelectedSourceOS%" equ "w81" echo.              MSMG ToolKit - ¼¯³É Microsoft DaRT 8.1 Tools
if "%SelectedSourceOS%" equ "w10" echo.               MSMG ToolKit - ¼¯³É Microsoft DaRT 10 Tools
echo.===============================================================================
echo.

:: Checking whether the Source Boot Image is selected
if "%DartType%" equ "Boot" if "%IsBootImageSelected%" equ "No" (
	echo.Î´Ñ¡Ôñ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ...
	echo.
	echo.Ñ¡ÔñÀ´Ô´Ê±£¬ÇëÑ¡Ôñ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ¡£
	goto :Stop
)

:: Checking whether the Source Recovery Image is selected
if "%DartType%" equ "Recovery" if "%IsRecoveryImageSelected%" equ "No" (
	echo.Î´Ñ¡Ôñ Windows »Ö¸´Ó³Ïñ...
	echo.
	echo.Ñ¡ÔñÀ´Ô´Ê±£¬ÇëÑ¡Ôñ Windows »Ö¸´Ó³Ïñ¡£
	goto :Stop
)

:: Setting Package Language
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"
)

if "%ImageDefaultLanguage%" equ "de-DE" set "PackageLanguage=de-DE"
if "%ImageDefaultLanguage%" equ "es-ES" set "PackageLanguage=es-ES"
if "%ImageDefaultLanguage%" equ "fr-FR" set "PackageLanguage=fr-FR"
if "%ImageDefaultLanguage%" equ "it-IT" set "PackageLanguage=it-IT"
if "%ImageDefaultLanguage%" equ "ja-JP" set "PackageLanguage=ja-JP"
if "%ImageDefaultLanguage%" equ "ko-KR" set "PackageLanguage=ko-KR"
if "%ImageDefaultLanguage%" equ "pt-BR" set "PackageLanguage=pt-BR"
if "%ImageDefaultLanguage%" equ "ru-RU" set "PackageLanguage=ru-RU"
if "%ImageDefaultLanguage%" equ "zh-CN" set "PackageLanguage=zh-CN"
if "%ImageDefaultLanguage%" equ "zh-TW" set "PackageLanguage=zh-TW"
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"

:: Setting Microsoft DaRT Tools Pack folder path
set "DaRT=%DaRT%\%SelectedSourceOS%"

:: Setting Microsoft DaRT Tools Debug Tools Package filename
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" leq "17763" set "DebugTools=DebugTools_%ImageVersion%.tpk"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "DebugTools=DebugTools_10.0.18362.tpk"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" set "DebugTools=DebugTools_10.0.19041.tpk"
)

:: Checking whether Microsoft DaRT 7/8.1/10 Tools Base Package file exist
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" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\DaRT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft DaRT 7/8.1/10 Tools Language Package file exist
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" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\DaRT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft DaRT 10 Debug Tools Package file exist
if "%SelectedSourceOS%" equ "w10" if not exist "%DaRT%\%DebugTools%" (
	echo.Microsoft DaRT 10 Tools °üÎÄ¼þ¼Ð¶ªÊ§ÒÔÏÂÎÄ¼þ...
	echo.
	echo."%DebugTools%"
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\DaRT\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%DartType%" equ "Boot" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.  MSMG ToolKit - ¼¯³É Microsoft DaRT 7 ¹¤¾ßµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
	if "%SelectedSourceOS%" equ "w81" echo. MSMG ToolKit - ¼¯³É Microsoft DaRT 8.1 ¹¤¾ßµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
	if "%SelectedSourceOS%" equ "w10" echo.  MSMG ToolKit - ¼¯³É Microsoft DaRT 10 ¹¤¾ßµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ
	echo.===============================================================================
	echo.

	:: Getting Boot Image Index Architecture
	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 °²×°³ÌÐòÆô¶¯Ó³Ïñ#########
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 2
	echo.    Image Architecture       : %ImageArchitecture%
	echo.    Image Version            : %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 °²×°³ÌÐòÆô¶¯Ó³Ïñ##################
	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 ¹¤¾ß»ù´¡°ü...
	echo.-------------------------------------------------------------------------------
	if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\DaRT.tpk", 1, "%BootMount%\2"
	if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\DaRT.tpk", 2, "%BootMount%\2"

	if "%SelectedSourceOS%" equ "w10" if not exist "%BootMount%\2\Windows\System32\fmapi.dll" (
		if /i "%ImageIndexNo%" equ "A" copy /y "%InstallMount%\1\Windows\System32\fmapi.dll" "%BootMount%\2\Windows\System32" >nul
		if /i "%ImageIndexNo%" neq "A" if %ImageCount% equ 1 copy /y "%InstallMount%\1\Windows\System32\fmapi.dll" "%BootMount%\2\Windows\System32" >nul
		if /i "%ImageIndexNo%" neq "A" if %ImageCount% gtr 1 (
			for /l %%i in (1, 1, %ImageCount%) do (
				if exist "%WinReMount%\%%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%] ÓïÑÔ°ü...
	echo.-------------------------------------------------------------------------------
	if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", 1, "%BootMount%\2"
	if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", 2, "%BootMount%\2"

	if "%SelectedSourceOS%" equ "w10" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Microsoft DaRT 10 µ÷ÊÔ¹¤¾ß°ü...
		echo.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\%DebugTools%", 1, "%BootMount%\2"
		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\%DebugTools%", 2, "%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 Æô¶¯Ó³Ïñ#########
	echo.-------------------------------------------------------------------------------
)

if "%DartType%" equ "Recovery" (
	cls
	echo.===============================================================================
	if "%SelectedSourceOS%" equ "w7" echo.   MSMG ToolKit - ¼¯³É Microsoft DaRT 7 ¹¤¾ßµ½ Windows »Ö¸´Ó³Ïñ
	if "%SelectedSourceOS%" equ "w81" echo.  MSMG ToolKit - ¼¯³É Microsoft DaRT 8.1 ¹¤¾ßµ½ Windows »Ö¸´Ó³Ïñ
	if "%SelectedSourceOS%" equ "w10" echo.   MSMG ToolKit - ¼¯³É Microsoft DaRT 10 ¹¤¾ßµ½ Windows »Ö¸´Ó³Ïñ
	echo.===============================================================================
	echo.
	:: Getting Recovery Image Index Architecture
	if /i "%ImageIndexNo%" equ "A" call :GetImageArchitecture "%InstallMount%\1\%WinReWim%", 1 >nul
	if /i "%ImageIndexNo%" neq "A" if %ImageCount% equ 1 call :GetImageArchitecture "%InstallMount%\1\%WinReWim%", 1 >nul
	if /i "%ImageIndexNo%" neq "A" if %ImageCount% gtr 1 (
		for /l %%i in (1, 1, %ImageCount%) do (
			if exist "%WinReMount%\%%i" call :GetImageArchitecture "%WinReMount%\%%i\%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 »Ö¸´Ó³Ïñ#####
	echo.-------------------------------------------------------------------------------
	echo.
	echo.    Image                    : WinRE.wim
	echo.    Image Index              : 1
	echo.    Image Architecture       : %ImageArchitecture%
	echo.    Image Version            : %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 »Ö¸´Ó³Ïñ##############
	echo.-------------------------------------------------------------------------------
	echo.
	for /l %%i in (1, 1, %ImageCount%) do (
		if exist "%WinReMount%\%%i" (
			if not %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]====================
			if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
			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 ¹¤¾ß»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\DaRT.tpk", 1, "%WinReMount%\%%i"
			if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\DaRT.tpk", 2, "%WinReMount%\%%i"
			if "%SelectedSourceOS%" equ "w10" if not exist "%WinReMount%\%%i\Windows\System32\fmapi.dll" copy /y "%InstallMount%\%%i\Windows\System32\fmapi.dll" "%WinReMount%\%%i\Windows\System32" >nul

			call :RemoveFile "%WinReMount%\%%i\Windows\System32\winpeshl.ini"
			echo.[LaunchApps]>>"%WinReMount%\%%i\Windows\System32\winpeshl.ini"
			echo.%%windir%%\system32\wpeinit.exe>>"%WinReMount%\%%i\Windows\System32\winpeshl.ini"
			echo.%%windir%%\system32\netstart.exe>>"%WinReMount%\%%i\Windows\System32\winpeshl.ini"
			echo.%%systemdrive%%\sources\recovery\recenv.exe>>"%WinReMount%\%%i\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%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", 1, "%WinReMount%\%%i"
			if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\DaRT_%PackageLanguage%.tpk", 2, "%WinReMount%\%%i"

			if "%SelectedSourceOS%" equ "w10" (
				echo.-------------------------------------------------------------------------------
				echo.¼¯³É Microsoft DaRT 10 µ÷ÊÔ¹¤¾ß°ü...
				echo.-------------------------------------------------------------------------------
				if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DaRT%\%DebugTools%", 1, "%WinReMount%\%%i"
				if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DaRT%\%DebugTools%", 2, "%WinReMount%\%%i"
			)
		)
	)

	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 »Ö¸´Ó³Ïñ#####
	echo.-------------------------------------------------------------------------------
)

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

set DaRT=
set DartType=
set PackageLanguage=
set DebugTools=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft DirectX 9.0c
::-------------------------------------------------------------------------------------------
:IntDirectX9c

setlocal

cls
echo.===============================================================================
echo.               MSMG ToolKit - ¼¯³É Microsoft DirectX 9.0c
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether Microsoft DirectX 9.0c Pack file exist
if not exist "%DirectX9c%\DirectX9c.tpk" (
	echo.Microsoft DirectX 9.0c Pack file "DirectX9c.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\DirectX9c^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft DirectX 9.0c Pack file exist
if not exist "%DirectX9c%\DirectX9c_%ImageArchitecture%.reg" (
	echo.Microsoft DirectX 9.0c Pack file "DirectX9c_%ImageArchitecture%.reg" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\DirectX9c^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft DirectX 9.0c################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		echo.-------------------------------------------------------------------------------
		echo.Integrating Microsoft DirectX 9.0c Package...
		echo.-------------------------------------------------------------------------------
		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%DirectX9c%\DirectX9c.tpk", 1, "%InstallMount%\%%i"
		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%DirectX9c%\DirectX9c.tpk", 2, "%InstallMount%\%%i"
		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft DirectX 9.0c Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%DirectX9c%\DirectX9c_%ImageArchitecture%.reg"
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft DirectX 9.0c################################
echo.-------------------------------------------------------------------------------

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

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Games
::-------------------------------------------------------------------------------------------
:IntGames

setlocal

set Game=
set PackageLanguage=

cls
echo.===============================================================================
echo.                   MSMG ToolKit - ¼¯³É Microsoft ÓÎÏ·
echo.===============================================================================

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Checking whether the selected Source OS is a Windows 7 Client Edition
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 ToolKit - ¼¯³É Microsoft ÓÎÏ·²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1]  Chess Titans
	echo.
	echo.  [2]  Mahjong Titans
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]  All Games
	echo.
	echo.  [X]  ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:12AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 4 goto :IntFeatures
	if errorlevel 3 set "Game=W7Games"
	if errorlevel 2 set "Game=MahjongTitans"
	if errorlevel 1 set "Game=ChessTitans"
)

:: Checking whether the selected Source OS is not a Windows 7 Client Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - ¼¯³É Microsoft ÓÎÏ·²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1]  Chess Titans
	echo.  [2]  FreeCell
	echo.  [3]  Hearts
	echo.  [4]  Mahjong Titans
	echo.  [5]  Minesweeper
	echo.  [6]  Purble Place
	echo.  [7]  Solitaire
	echo.  [8]  Spider Solitaire
	echo.
	echo.
	echo.
	echo.
	echo.  [A]  ËùÓÐÓÎÏ·
	echo.
	echo.  [X]  ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345678AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 10 goto :IntFeatures
	if errorlevel 9 set "Game=W7Games"
	if errorlevel 8 set "Game=SpiderSolitaire"
	if errorlevel 7 set "Game=Solitaire"
	if errorlevel 6 set "Game=PurblePlace"
	if errorlevel 5 set "Game=Minesweeper"
	if errorlevel 4 set "Game=MahjongTitans"
	if errorlevel 3 set "Game=Hearts"
	if errorlevel 2 set "Game=FreeCell"
	if errorlevel 1 set "Game=ChessTitans"
)

:: Checking whether the selected Source OS is not Windows 7
if "%SelectedSourceOS%" neq "w7" (
	cls
	echo.===============================================================================
	echo.                MSMG ToolKit - ¼¯³É Microsoft ÓÎÏ·²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1]  Chess Titans
	echo.  [2]  FreeCell
	echo.  [3]  Hearts
	echo.  [4]  Mahjong Titans
	echo.  [5]  Minesweeper
	echo.  [6]  Purble Place
	echo.  [7]  Solitaire
	echo.  [8]  Spider Solitaire
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]  ËùÓÐÓÎÏ·
	echo.
	echo.  [X]  ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:12345678AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 10 goto :IntFeatures
	if errorlevel 9 set "Game=W7Games"
	if errorlevel 8 set "Game=SpiderSolitaire"
	if errorlevel 7 set "Game=Solitaire"
	if errorlevel 6 set "Game=PurblePlace"
	if errorlevel 5 set "Game=Minesweeper"
	if errorlevel 4 set "Game=MahjongTitans"
	if errorlevel 3 set "Game=Hearts"
	if errorlevel 2 set "Game=FreeCell"
	if errorlevel 1 set "Game=ChessTitans"
)

cls
echo.===============================================================================
echo.                   MSMG ToolKit - ¼¯³É Microsoft ÓÎÏ·
echo.===============================================================================
echo.

:: Checking whether Microsoft Games Pack file exist
if not exist "%Games%\Games_%ImageArchitecture%.tpk" (
	echo.Microsoft ÓÎÏ·°üÎÄ¼þ "Games_%ImageArchitecture%.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Games^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft Games Pack file exist
if not exist "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk" (
	echo.Microsoft ÓÎÏ·°üÎÄ¼þ "Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Games^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Microsoft Games Pack file exist
for %%j in (W7Games,ChessTitans,FreeCell,Hearts,MahjongTitans,Minesweeper,PurblePlace,Solitaire,SpiderSolitaire) do (
	if "%Game%" equ "%%j" if not exist "%Games%\%Game%.reg" (
		echo.Microsoft ÓÎÏ·°üÎÄ¼þ "%Game%.reg" Î´ÕÒµ½...
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Games^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft ÓÎÏ·#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		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 "ChessTitans" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Chess Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Chess Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "FreeCell" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft FreeCell ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft FreeCell ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "Hearts" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "MahjongTitans" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "Minesweeper" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "PurblePlace" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "Solitaire" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "SpiderSolitaire" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
		)

		if "%Game%" equ "W7Games" 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 Chess Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Chess Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 2, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
		)

		if "%Game%" equ "W7Games" if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Client" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Chess Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%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", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft FreeCell ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
		)

		if "%Game%" equ "W7Games" if "%SelectedSourceOS%" neq "w7" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Chess Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 2, "%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", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft FreeCell ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 3, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Hearts ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 4, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Mahjong Titans ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 5, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Minesweeper ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 6, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Purble Place ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 7, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 8, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ·»ù´¡°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%.tpk", 9, "%InstallMount%\%%i"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É Microsoft Spider Solitaire ÓÎÏ· [%ImageDefaultLanguage%] ÓïÑÔ°ü...
			echo.-------------------------------------------------------------------------------
			call :ApplyImage "%Games%\Games_%ImageArchitecture%_%ImageDefaultLanguage%.tpk", 9, "%InstallMount%\%%i"
		)

		echo.-------------------------------------------------------------------------------
		echo.Importing Microsoft Games Registry Settings...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"

		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		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 "MahjongTitans" call :ImportRegistry2Image "%Games%\MahjongTitans.reg"
		if "%Game%" equ "Minesweeper" call :ImportRegistry2Image "%Games%\Minesweeper.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 "W7Games" call :ImportRegistry2Image "%Games%\W7Games.reg"

		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry

		:: Deleting Non-Windows Media Center Related Games Shortcuts
		if /i not exist "%InstallMount%\%%i\Windows\ehome" (
			for %%z in (Chess, FreeCell, Hearts, Mahjong, Minesweeper, Purble Place, Solitaire, SpiderSolitaire) do (
				if /i exist "%InstallMount%\%%i\Program Files\Microsoft Games\%%z" (
					cd "%InstallMount%\%%i\Program Files\Microsoft Games\%%z" >nul
					if /i exist desktop.ini (
						attrib -h -s -a desktop.ini
						del /f /q desktop.ini >nul
					)
					cd "%ROOT%" >nul
					call :RemoveFile "%InstallMount%\%%i\Program Files\Microsoft Games\%%z\*MCE.*"
				)
			)
		)
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Games#######################################
echo.-------------------------------------------------------------------------------

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

set Game=

endlocal

:: Returning to Integrate Microsoft Games Menu
goto :IntGames
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Sidebar
::-------------------------------------------------------------------------------------------
:IntSidebar

setlocal

set PackageIndex=

cls
echo.===============================================================================
echo.                   MSMG ToolKit - ¼¯³É Windows ²à±ßÀ¸
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Index
if "%ImageArchitecture%" equ "x86" set "PackageIndex=1"
if "%ImageArchitecture%" equ "x64" set "PackageIndex=2"

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar.tpk" (
	echo.Windows ²à±ßÀ¸°üÎÄ¼þ "Sidebar.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Sidebar^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar_%ImageDefaultLanguage%.tpk" (
	echo.Windows ²à±ßÀ¸°üÎÄ¼þ "Sidebar_%ImageDefaultLanguage%.tpk" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Sidebar^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Sidebar Pack file exist
if not exist "%Sidebar%\Sidebar_%ImageArchitecture%.reg" (
	echo.Windows ²à±ßÀ¸°üÎÄ¼þ "Sidebar_%ImageArchitecture%.reg" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Sidebar^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows ²à±ßÀ¸#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		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.Taking Image Registry Ownership...
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		call :ImportRegistry2Image "%Sidebar%\Sidebar_%ImageArchitecture%.reg"
		call :ImportRegistry2Image "%Sidebar%\3rdPartyGadgets_%ImageArchitecture%.reg"
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
		echo.

		:: Deleting Microsoft Sidebar Media Center files if the Source Edition is not MediaCenter
		if /i not exist "%InstallMount%\%%i\Windows\ehome" call :RemoveFolder "%InstallMount%\%%i\Program Files\Windows Sidebar\Gadgets\MediaCenter.Gadget"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows ²à±ßÀ¸#######################################
echo.-------------------------------------------------------------------------------

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

set PackageIndex=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Visual C++ Runtime
::-------------------------------------------------------------------------------------------
:IntVCRuntime

setlocal

set PackageIndex=

cls
echo.===============================================================================
echo.            MSMG ToolKit - ¼¯³É Microsoft Visual C++ Runtime
echo.===============================================================================
echo.

:: Setting Microsoft Visual C++ Runtime Pack folder path
set "VCRuntime=%VCRuntime%\%SelectedSourceOS%"

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Index
if "%ImageArchitecture%" equ "x86" set "PackageIndex=1"
if "%ImageArchitecture%" equ "x64" set "PackageIndex=2"

:: Checking whether Microsoft Visual C++ Runtime Pack file exist
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_2019, 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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		:: Getting Image Index Information
		call :GetImageIndexInfo "%InstallWim%", %%i >nul

		if "%SelectedSourceOS%" neq "w10" (
			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_2019, VC_Legacy) do (
			call :ImportRegistry2Image "%VCRuntime%\%%i_%ImageArchitecture%.reg"
		)

		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft Visual C++ Runtime##########################
echo.-------------------------------------------------------------------------------

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

set VCRuntime=
set PackageIndex=

endlocal

:: Returning to Integrate Features Menu
goto :IntFeatures
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Updates Menu
::-------------------------------------------------------------------------------------------
:IntUpdatesMenu

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.                    MSMG ToolKit - ¼¯³É Windows ¸üÐÂ
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                              ¾¯         ¸æ
	echo.                              =============
	echo.
	echo.  ÔÚ¼¯³ÉÓïÑÔ°ü»òÈÎºÎ Windows ¹¦ÄÜÖ®Ç°£¬Çë²»Òª¼¯³ÉÈÎºÎ¸üÐÂ¡£
	echo.  Èç¹ûÄúÔÚ¼¯³ÉÈÎºÎ¸üÐÂÖ®Ç°¼¯³ÉÁË°üº¬ÒÀÀµÓÚÓïÑÔ/¹¦ÄÜµÄ×ÊÔ´µÄÈÎºÎ¸üÐÂ
	echo.  ^(ÐÞ²¹³ÌÐò£¬Í¨ÓÃ·¢ÐÐ°æ±¾ [GDR]£¬ÁãÈÕ²¹¶¡[ZDP] »òS ervice Pack [SP] ^)£¬
	echo.  ÔòÓïÑÔ/¹¦ÄÜ- ¸üÐÂÖÐ°üº¬µÄÌØ¶¨¸ü¸Ä²»»áÓ¦ÓÃ£¬Äú½«±ØÐëÖØÐÂ¼¯³É¸üÐÂ¡£
	echo.  ÔÚ°²×°¸üÐÂÖ®Ç°£¬ÇëÊ¼ÖÕ¼¯³ÉÓïÑÔ°ü/Windows ¹¦ÄÜ¡£
	echo.
	echo.
	echo.  Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¼¯³É 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 ToolKit - ¼¯³É WHD Update Pack Menu
echo.===============================================================================
echo.
if "%SelectedSourceOS%" equ "w7" (
	echo.  [1]   Ê¹ÓÃ Service Pack 2 ¼¯³É WHD ¸üÐÂ°ü
	echo.
	echo.  [2]   ²»Ê¹ÓÃ Service Pack 2 ¼¯³É WHD ¸üÐÂ°ü
	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%" equ "w10" (
	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=0
		goto :IntW7WHDUpdatesMenu
	)
	if errorlevel 1 (
		set IsW7SP1CRUSelected=1
		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%" equ "w10" (
	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 "1" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - ¼¯³É WHD Updates with Service Pack 2
	echo.===============================================================================
	echo.          ## Windows 7 SP1 aka Service Pack 2 ±ãÀû»ã×Ü¸üÐÂ ##
	echo.
	echo.KB3125574 Ò»¸öÈ«ÃæµÄ»ã×Ü¸üÐÂ£¬ÆäÖÐ°üº¬ Windows 7 SP1 ·¢ÐÐºóÖ±ÖÁ 2016 Äê 4 ÔÂµÄ
	echo.¼¸ºõËùÓÐÐÞ²¹³ÌÐò¡£
	echo.
	echo.Èç¹ûÄú´òËã¼¯³ÉÒÔÏÂÈÎºÎ¹¦ÄÜ²¿¼þ°ü£¬ÇëÊ×ÏÈ¼¯³ÉËüÃÇ ^(before KB3125574^)£¬ÒÔ±ã»ã
	echo.×ÜÖ®ºó¿ÉÒÔ¼¯³ÉÆä¸üÐÂµÄ×é¼þ£º
	echo.
	echo.ÔÚ¡° WHD ¸½¼ÓºÍ¸½¼Ó¸üÐÂ¡±²¿·ÖÖÐÕÒµ½ÁË DCA2.0, AD LDS, VirtualPC, WorkFolders, 
	echo.Server Essentials Á¬½ÓÆ÷¡£
	echo.
	echo.´Ë¸üÐÂÖ¼ÔÚ¼ò»¯ Windows 7 µÄ¸üÐÂ¹ý³Ì£¬µ«ËüÊÇÍêÈ«¿ÉÑ¡µÄ£¬²¢ÇÒ³öÓÚ¾¡Ö°µ÷²éµÄÄ¿µÄ£¬
	echo.Çë×¢ÒâËüÈ·Êµ°üº¬Ò»Ð©Ò£²â¸üÐÂ×é¼þ ^(3068708, 3075249^)¡£
	echo.Òò´Ë£¬Èç¹ûÄú²»Ï£ÍûÕâÑù×ö£¬ÔòÓ¦´Ó¡°¼¯³ÉWHD¸üÐÂ¡±²Ëµ¥ÖÐÑ¡Ôñ¡°²»´ø Service Pack 2 µÄ
	echo.¼¯³É WHD ¸üÐÂ¡±Ñ¡Ïî¡£
	echo.
	echo.ÄúÒ²¿ÉÒÔÔÚ¼¯³É»ã×ÜÊ±×èÖ¹ÕâÐ©Ò£²âÐ§¹û£¬Çë²Î¿¼´ËÖ÷ÌâÒÔ»ñÈ¡ÏêÏ¸ÐÅÏ¢£º
	echo.http://forums.mydigitallife.info/threads/68131
	echo.===============================================================================
	pause
)
cls
echo.===============================================================================
echo.                   MSMG ToolKit - ¼¯³É 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.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" (
	choice /C:12345X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 6 goto :IntegrateMenu
	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 ToolKit - ¼¯³É WHD »ù±¾¸üÐÂ²Ëµ¥
if "%SelectedSourceOS%" equ "w10" echo.              MSMG ToolKit - ¼¯³É 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 ToolKit - ¼¯³É 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 ¸üÐÂÂúÒâµÄ¸üÐÂ
	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 ToolKit - ¼¯³É WHD ¶îÍâ¸üÐÂ²Ëµ¥
echo.===============================================================================

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "0" (
	echo.  [1]   »î¶¯Ä¿Â¼ÇáÐÍÄ¿Â¼·þÎñ ^(ADLDS^)
	echo.
	echo.  [2]   ÎÄ¼þ¹ÜÀí API
	echo.
	echo.  [3]   Microsoft ÐéÄâ 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 "1" (
	echo.
	echo.  [1]   »î¶¯Ä¿Â¼ÇáÐÍÄ¿Â¼·þÎñ ^(ADLDS^)
	echo.
	echo.  [2]   ÎÄ¼þ¹ÜÀí API
	echo.
	echo.  [3]   Microsoft ÐéÄâ PC
	echo.
	echo.  [4]   Í¬²½´úÀíÓò»·¾³ ^(¹¤×÷ÎÄ¼þ¼Ð^)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
)

if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "0" (
	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 "1" (
	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"
)

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate WHD Baseline/General Updates to Windows Setup Boot, Install & Recovery Image
::-------------------------------------------------------------------------------------------
:IntWHDBaseline

setlocal

:: Setting WHD Updates Type
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "Boot" (
    if "%SelectedSourceOS%" equ "w81" echo.   MSMG ToolKit - Integrate WHD Baseline Updates to Windows Setup Boot Image
    if "%SelectedSourceOS%" equ "w10" echo.    MSMG ToolKit - Integrate WHD General Updates to Windows Setup Boot Image
)

if "%UpdateType%" equ "Install" (
    if "%SelectedSourceOS%" equ "w81" echo. MSMG ToolKit - Integrate WHD Baseline Updates to Windows Setup Install Image
    if "%SelectedSourceOS%" equ "w10" echo.  MSMG ToolKit - Integrate WHD General Updates to Windows Setup Install Image
)

if "%UpdateType%" equ "InstallRecovery" (
    if "%SelectedSourceOS%" equ "w81" echo.                  MSMG ToolKit - Integrate WHD Baseline Updates
    if "%SelectedSourceOS%" equ "w10" echo.                   MSMG ToolKit - Integrate WHD General Updates
    echo.                    to Windows Setup Install ^& Recovery Images
)

if "%UpdateType%" equ "BootInstallRecovery" (
    if "%SelectedSourceOS%" equ "w81" echo.                  MSMG ToolKit - Integrate WHD Baseline Updates
    if "%SelectedSourceOS%" equ "w10" echo.                   MSMG ToolKit - Integrate WHD General Updates
    echo.                to Windows Setup Boot, Install ^& Recovery Images
)
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
)

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

:: Settings WHD Baseline Updates folder path
if "%SelectedSourceOS%" equ "w81" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\Baseline"
if "%SelectedSourceOS%" equ "w10" (
	if "%ImageBuild%" leq "17763" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\10.0.%ImageBuild%"
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\10.0.18362"
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%\10.0.19041"
)

:: Checking whether WHD Baseline Updates folder is empty
:: Windows 8.1 RTM (Build : 6.3.9600.16384)
if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
	if not exist "%Updates%\RTM\*.msu" if not exist "%Updates%\RTM\*.cab" (
		echo.WHD »ù×¼¸üÐÂÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline\RTM^> Îª¿Õ...
	)

	if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
		echo.
		echo.WHD »ù×¼¸üÐÂÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Baseline^> Îª¿Õ...
	)

	echo.
	echo.Çë½« WHD »ù×¼¸üÐÂ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

:: Windows 8.1 Post-RTM
if "%SelectedSourceOS%" equ "w81" 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%" equ "w10" if not exist "%Updates%\Cumulative\*.msu" if not exist "%Updates%\Cumulative\*.cab" (
	if "%ImageBuild%" leq "17763" echo.WHD General Updates folder ^<WHD\w10\%ImageArchitecture%\10.0.%ImageBuild%\Cumulative^> Îª¿Õ...
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.WHD General Updates folder ^<WHD\w10\%ImageArchitecture%\10.0.18362\Cumulative^> Îª¿Õ...
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" echo.WHD General Updates folder ^<WHD\w10\%ImageArchitecture%\10.0.19041\Cumulative^> Îª¿Õ...
	echo.
	echo.Çë½« WHD »ù×¼¸üÐÂ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.##################Starting Integrating WHD Baseline Updates####################
if "%SelectedSourceOS%" equ "w10" echo.##################Starting Integrating WHD General Updates#####################
if "%UpdateType%" equ "Boot" echo.########################to Windows Setup Boot Image############################
if "%UpdateType%" equ "Install" echo.######################to Windows Setup Install Image###########################
if "%UpdateType%" equ "InstallRecovery" echo.#################to Windows Setup Install ^& Recovery Images#####################
if "%UpdateType%" equ "BootInstallRecovery" echo.##############to Windows Setup Boot, Install ^& Recovery Images#################
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" equ "Boot" (
	echo.    Image                    : Boot.wim
	echo.    Image Index              : 1, 2
)

if "%UpdateType%" equ "Install" (
	echo.    Image                    : Install.wim	
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
)

if "%UpdateType%" equ "InstallRecovery" (
	echo.    Image                    : Install.wim        ^|  WinRE.wim
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%                  ^|      1
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%                  ^|      1
)

if "%UpdateType%" equ "BootInstallRecovery" (
	echo.    Image                    : Boot.wim         ^|  Install.wim   ^|  WinRE.wim
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1, 2             ^|      1-%ImageCount%              ^|      1
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : 1, 2             ^|      %ImageIndexNo%         ^|      1
)

echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.####´¦Àí WHD »ù×¼¸üÐÂ°ü###################################
if "%SelectedSourceOS%" equ "w10" echo.####´¦Àí WHD ³£¹æ¸üÐÂ°ü####################################
echo.-------------------------------------------------------------------------------
echo.
:: Creating WHD Baseline Updates Temporary folder
if "%SelectedSourceOS%" equ "w81" echo.´´½¨ WHD »ù×¼¸üÐÂÁÙÊ±ÎÄ¼þ¼Ð...
if "%SelectedSourceOS%" equ "w10" echo.´´½¨ WHD ³£¹æ¸üÐÂÁÙÊ±ÎÄ¼þ¼Ð...
call :RemoveFolder "%Temp%\Updates"
call :CreateFolder "%Temp%\Updates"
echo.

:: Extracting .CAB files From .MSU Package files to CAB Temporary folder
echo.ÌáÈ¡ .CAB °üÎÄ¼þµ½ÁÙÊ±ÎÄ¼þ¼Ð...

:: Windows 8.1 RTM (Build : 6.3.9600.16384)
if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" expand "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: Copy .CAB files from .MSU package files to CAB Temporary folder
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2919355-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2932046-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2937592-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938439-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" %XCopy% "%Updates%\RTM\Windows8.1-KB2938772-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: Copy .CAB files from .MSU package files to CAB Temporary folder
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB2934018-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh (IR4 Build : 6.3.9600.17056)
if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB4566425-%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

	:: Copy .CAB files from .MSU package files to CAB Temporary folder
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3000850-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3003057-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 8.1 with Update Refresh (IR5 Build : 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-KB4566425-%ImageArchitecture%*.msu" expand "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.msu" -F:Win*.cab "%Temp%\Updates" >nul

	:: Copy .CAB files from .MSU package files to CAB Temporary folder
	if exist "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB3021910-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
	if exist "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" %XCopy% "%Updates%\Windows8.1-KB4566425-%ImageArchitecture%*.cab" "%Temp%\Updates" >nul
)

:: Windows 10
if "%SelectedSourceOS%" equ "w10" (
	for /d %%j in (Dynamic, Cumulative, Enablement, FlashPlayer, NetCumulative, ServicingStack, SetupMedia, WEF, WinPE) do (
		if exist "%Updates%\%%j\*%ImageArchitecture%*.msu" (
			call :CreateFolder "%Temp%\Updates\%%j"
			expand -R "%Updates%\%%j\*%ImageArchitecture%*.msu" -F:*.cab "%Temp%\Updates\%%j" >nul
			call :RemoveFile "%Temp%\Updates\%%j\wsusscan.cab"
			expand -R "%Temp%\Updates\%%j\*.cab" -F:* "%Temp%\Updates\%%j" >nul
			if "%%j" equ "Cumulative" if exist "%Temp%\Updates\%%j\Cab_*.cab" expand -R "%Temp%\Updates\%%j\Cab_*.cab" -F:* "%Temp%\Updates\%%j" >nul
			call :RemoveFile "%Temp%\Updates\%%j\*.cab"
		)

		if exist "%Updates%\%%j\*%ImageArchitecture%*.cab" (
			call :CreateFolder "%Temp%\Updates\%%j"
			expand -R "%Updates%\%%j\*%ImageArchitecture%*.cab" -F:* "%Temp%\Updates\%%j" >nul
			if "%%j" equ "Cumulative" if exist "%Temp%\Updates\%%j\Cab_*.cab" expand -R "%Temp%\Updates\%%j\Cab_*.cab" -F:* "%Temp%\Updates\%%j" >nul
			call :RemoveFile "%Temp%\Updates\%%j\*.cab"
		)
	)
	if exist "%Updates%\Defender\defender-update-kit-%ImageArchitecture%.zip" (
		call :CreateFolder "%Temp%\Updates\Defender"
		%Zip% x -y "%Updates%\Defender\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"
	)
)

echo.
echo.Íê³ÉÌáÈ¡ .CAB °üÎÄ¼þµ½ÁÙÊ±ÎÄ¼þ¼Ð...
echo.
if "%UpdateType%" neq "Boot" if exist "%Temp%\Updates\Enablement\Update.mum" (
	choice /C:YN /N /M "ÊÇ·ñÒªÌø¹ý¼¯³É Microsoft Edge Chromium? ['Y'es/'N'o] : "
	if !errorlevel! equ 1 (
		del /f /q "%Temp%\Updates\Enablement\Update.mum" >nul
		del /f /q "%Temp%\Updates\Enablement\Update.cat" >nul

		if "%ImageArchitecture%" equ "x86" (
			rd /q /s "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_d4e678d60dbf374c" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~x86~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_88ed58c8b45ef5b335c7e00f1d272a1c_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\x86_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~x86~~*.cat" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			rd /q /s "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051459c61ca882" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~amd64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_84b67765c88012e177d65b696e48302e_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\amd64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~amd64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)

		if "%ImageArchitecture%" equ "arm64" (
			rd /q /s "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_10.0.19041.681_none_31051c93c61c9d1e" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.mum" >nul
			del /f /q "%Temp%\Updates\Enablement\package_1_for_kb4562830~31bf3856ad364e35~arm64~~*.cat" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_d29030e5eb1fbfc0c65c0cd08e617938_31bf3856ad364e35_*.manifest" >nul
			del /f /q "%Temp%\Updates\Enablement\arm64_microsoft-windows-e..-firsttimeinstaller_31bf3856ad364e35_*.manifest" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.cat" "%Temp%\Updates\Enablement\Update.cat" >nul
			move /y "%Temp%\Updates\Enablement\microsoft-windows-20h2enablement-package~31bf3856ad364e35~arm64~~10.0.19041.681.mum" "%Temp%\Updates\Enablement\Update.mum" >nul
		)
	)
	echo.
)

if "%UpdateType%" neq "Install" if "%UpdateType%" neq "InstallRecovery" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####¼¯³É WHD »ù×¼¸üÐÂµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ###############
    if "%SelectedSourceOS%" equ "w10" echo.####¼¯³É WHD ³£¹æ¸üÐÂµ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ################
    echo.-------------------------------------------------------------------------------
	echo.

    for /l %%i in (1, 1, 2) do (
	    echo.=============================[Boot.wim, Index : %%i]=============================
	    echo.
	    :: Windows 8.1 RTM (Build : 6.3.9600.16384)
	    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Prerequisite Update ^(KB3021910^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Update ^(KB2919355^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2932046^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2937592^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938439^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938772^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
	    )

		:: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
		if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	    )

	    :: Windows 8.1 with Update (IR4 Build : 6.3.9600.17056)
	    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			echo.-------------------------------------------------------------------------------
			echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
	    )

	    :: Windows 8.1 with Update Refresh (IR5 Build : 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 »ù×¼¹¦ÄÜ°ü¸üÐÂ ^(KB4566425^) µ½Æô¶¯Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%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.-------------------------------------------------------------------------------
					if "%ImageArchitecture%" equ "x86" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 1, "%BootMount%\%%i"
					if "%ImageArchitecture%" equ "x64" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 2, "%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", 1, "%BootMount%\%%i"
		    		call :MountImageRegistry "%BootMount%\%%i"
			    	call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
				    call :UnMountImageRegistry
			    )

			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É Windows 10 ·þÎñ¶ÑÕ»¸üÐÂµ½Æô¶¯Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\ServicingStack"
		    )

		    if exist "%Temp%\Updates\Enablement\Update.mum" (
			    echo.-------------------------------------------------------------------------------
			    if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.¼¯³É Windows 10 v1909 ¹¦ÄÜ¸üÐÂµ½Æô¶¯Ó³Ïñ...
				if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" echo.¼¯³É Windows 10 v20H2 ¹¦ÄÜ¸üÐÂµ½Æô¶¯Ó³Ïñ...
				echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Enablement"
			)

		    if exist "%Temp%\Updates\Cumulative\Update.mum" (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É Windows 10 ÀÛ»ý¸üÐÂµ½Æô¶¯Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%BootMount%\%%i", "%Temp%\Updates\Cumulative"
		    )
	    )

	    if exist "%Temp%\Updates\WinPE\*.cab" (
		    echo.-------------------------------------------------------------------------------
		    echo.¼¯³É Windows 10 WinPE ¸üÐÂµ½Æô¶¯Ó³Ïñ...
		    echo.-------------------------------------------------------------------------------
		    call :AddPackage "%BootMount%\2", "%Temp%\Updates\WinPE"
	    )
    )

	:: Windows 10
    if "%SelectedSourceOS%" equ "w10" if exist "%Temp%\Updates\SetupMedia\*.cab" (
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows 10 °²×°Ã½Ìå¸üÐÂ...
	    echo.-------------------------------------------------------------------------------
	    echo.
		echo.ÌáÈ¡ Windows 10 °²×°Ã½Ìå¸üÐÂµ½ ^<DVD^> ÎÄ¼þ¼Ð¡£
	    expand -R "%Temp%\Updates\SetupMedia\*.cab" -F:* "%DVD%\sources" >nul
	    cd /d "%DVD%\sources\" >nul

		for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
		    if "%ImageDefaultLanguage%" neq "%%i" rd /q /s "%DVD%\sources\%%i" >nul 2>&1
	    )

		cd /d "%ROOT%\" >nul
		echo.
	)
)

if "%UpdateType%" neq "Boot" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####¼¯³É WHD »ù×¼¸üÐÂµ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ############
    if "%SelectedSourceOS%" equ "w10" 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, Index : %%i]============================
		    if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		    echo.

		    :: Windows 8.1 RTM (Build : 6.3.9600.16384)
		    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Prerequisite Update ^(KB3021910^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Update ^(KB2919355^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2932046^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2937592^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938439^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938772^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3014442^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3014442^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update (IR4 Build : 6.3.9600.17056)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3014442^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3014442-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
			    if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½°²×°Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    )

			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½°²×°Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
		    )

		    :: Windows 10
		    if "%SelectedSourceOS%" equ "w10" (
			    :: Importing Registry fix to Enable Integrating Windows 10 LTSB 2015 Updates to Windows 10 Non-LTSB Editions.
			    if "%ImageBuild%" equ "10240" if "%ImageEdition%" neq "EnterpriseS" if "%ImageEdition%" neq "EnterpriseSN" (
			    	call :MountImageRegistry "%InstallMount%\%%i"
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~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-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384.mum" /f >nul
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10240.16384" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
			    	call :UnMountImageRegistry
			    )

			    :: Importing Registry fix to Enable Integrating Windows 10 Education/Enterprise Updates to Windows 10 Non Education/Enterprise (N) Editions.
			    if "%ImageBuild%" equ "10586" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" (
			    	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-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.10586.0.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
			    )

			    :: Importing Registry fix to Enable Integrating Windows 10 Education/Enterprise/LTSB 2016 Updates to Windows 10 Non Education/Enterprise/LTSB 2016 Editions.
			    if "%ImageBuild%" equ "14393" if "%ImageEdition%" neq "Education" if "%ImageEdition%" neq "EducationN" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "EnterpriseN" if "%ImageEdition%" neq "EnterpriseS" if "%ImageEdition%" neq "EnterpriseSN" (
			    	call :MountImageRegistry "%InstallMount%\%%i"
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~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-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0.mum" /f >nul
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~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-EnterpriseEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.14393.0" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
			    	call :UnMountImageRegistry
			    )

			    :: Importing Registry fix to Enable Integrating Windows Updates to Windows 10 Pro for Workstation Edition.
			    if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "ProfessionalWorkstation" (
			    	call :MountImageRegistry "%InstallMount%\%%i"
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-ProfessionalEdition~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-ProfessionalEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-ProfessionalEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.mum" /f >nul
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-ProfessionalEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /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-ProfessionalEdition~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-ProfessionalEdition~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-ProfessionalEdition~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-ProfessionalEdition~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-ProfessionalEdition~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-ProfessionalEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
			    	call :UnMountImageRegistry
			    )

			    :: Importing Registry fix to Enable Integrating Windows Updates to Windows 10 Pro for Workstation 'N' Edition.
			    if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "ProfessionalWorkstationN" (
			    	call :MountImageRegistry "%InstallMount%\%%i"
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-ProfessionalNEdition~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-ProfessionalNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallName" /t REG_SZ /d "Microsoft-Windows-ProfessionalNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15.mum" /f >nul
			    	reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-ProfessionalNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /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-ProfessionalNEdition~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-ProfessionalNEdition~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-ProfessionalNEdition~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-ProfessionalNEdition~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-ProfessionalNEdition~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-ProfessionalNEdition~31bf3856ad364e35~%PackageArchitecture%~~10.0.16299.15" /v "InstallUser" /t REG_SZ /d "S-1-5-18" /f >nul
			    	call :UnMountImageRegistry
			    )

			    if exist "%Temp%\Updates\ServicingStack\Update.mum" (
			    	if "%ImageBuild%" equ "10240" if "%ImageServicePackBuild%" equ "16384" (
			    		echo.-------------------------------------------------------------------------------
			    		echo.Ó¦ÓÃ Windows 10 v1507 ÀÛ»ý¸üÐÂ¼¯³ÉÐÞ¸´³ÌÐò...
			    		echo.-------------------------------------------------------------------------------
			    		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 1, "%InstallMount%\%%i"
			    		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 2, "%InstallMount%\%%i"
			    		call :MountImageRegistry "%InstallMount%\%%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", 1, "%InstallMount%\%%i"
			    		call :MountImageRegistry "%InstallMount%\%%i"
			    		call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
			    		call :UnMountImageRegistry
			    	)

			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É Windows 10 Servicing Stack Update µ½°²×°Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\ServicingStack"
			    )

			    if exist "%Temp%\Updates\Dynamic\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É Windows 10 Dynamic Updates µ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Dynamic"
			    )

			    if exist "%Temp%\Updates\FlashPlayer\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É Adobe Flash Player Security Update µ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\FlashPlayer"
			    )

			    if exist "%Temp%\Updates\NetCumulative\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É .NET Cumulative Update µ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\NetCumulative"
			    )

			    if exist "%Temp%\Updates\WEP\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É Windows Experience Feature Pack Update µ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\WEP"
			    )

			    if exist "%Temp%\Updates\Cumulative\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É Windows 10 Cumulative Update µ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Cumulative"
			    )

			    if exist "%Temp%\Updates\Enablement\Update.mum" (
				    echo.-------------------------------------------------------------------------------
				    if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.¼¯³É Windows 10 v1909 ¹¦ÄÜ¸üÐÂµ½°²×°Ó³Ïñ...
				    if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" echo.¼¯³É Windows 10 v20H2 ¹¦ÄÜ¸üÐÂµ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\Enablement"
			    )

			    if exist "%Temp%\Updates\Defender\package-defender.xml" (
				    echo.-------------------------------------------------------------------------------
				    echo.¼¯³É Windows Defender ¶¨Òå¸üÐÂµ½°²×°Ó³Ïñ...
				    echo.-------------------------------------------------------------------------------
				    echo.
				    for /f %%x IN ('"dir /b %Temp%\Updates\Defender\Platform" 2^>nul') do (set "DefenderVersion=%%x")

				    echo.¸´ÖÆ Windows Defender ¶¨Òå¸üÐÂ ^(v!DefenderVersion!^).
				    %XCopy% "%Temp%\Updates\Defender\Definition Updates\Updates" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Definition Updates\Updates" >nul

				    echo.¸´ÖÆ Windows Defender Æ½Ì¨¸üÐÂ¡£
				    %XCopy% /s "%Temp%\Updates\Defender\Platform" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform" >nul

				    echo.¸´ÖÆ MpAsDesc.dll ÎÄ¼þ¡£
				    Copy "%InstallMount%\%%i\Program Files\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!" >nul
				    if "%ImageArchitecture%" equ "x64" Copy "%InstallMount%\%%i\Program Files (x86)\Windows Defender\MpAsDesc.dll" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86" >nul

				    echo.¸´ÖÆ MpAsDesc.dll.mui ÎÄ¼þ¡£
				    for /d %%y in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
					    if exist "%InstallMount%\%%i\Program Files\Windows Defender\%%y" (
						    call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y"
						    Copy "%InstallMount%\%%i\Program Files\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\%%y\mpasdesc.dll.mui" >nul

						    if "%ImageArchitecture%" equ "x64" (
							    call :CreateFolder "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y"
							    Copy "%InstallMount%\%%i\Program Files (x86)\Windows Defender\%%y\mpasdesc.dll.mui" "%InstallMount%\%%i\ProgramData\Microsoft\Windows Defender\Platform\!DefenderVersion!\x86\%%y\mpasdesc.dll.mui" >nul
						    )
					    )
				    )

				    echo.¸´ÖÆ Package-defender.xml µ½ Windows ÁÙÊ±ÎÄ¼þ¼Ð¡£
				    Copy "%Temp%\Updates\Defender\package-defender.xml" "%InstallMount%\%%i\Windows\Temp" >nul
				    echo.
			    )
		    )
	    )
    )
)

if "%UpdateType%" neq "Boot" if "%UpdateType%" neq "Install" (
    echo.-------------------------------------------------------------------------------
    if "%SelectedSourceOS%" equ "w81" echo.####¼¯³É WHD »ù×¼¸üÐÂµ½ Windows °²×°³ÌÐò»Ö¸´Ó³Ïñ###########
    if "%SelectedSourceOS%" equ "w10" echo.####¼¯³É WHD ³£¹æ¸üÐÂµ½ Windows °²×°³ÌÐò»Ö¸´Ó³Ïñ############
    echo.-------------------------------------------------------------------------------

    for /l %%i in (1, 1, %ImageCount%) do (
	    if exist "%WinReMount%\%%i" (
		    echo.
		    if not %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]=====================
		    if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
		    echo.
		
		    :: Windows 8.1 RTM (Build : 6.3.9600.16384)
		    if "%SelectedSourceOS%" equ "w81" if %ImageServicePackBuild% equ 16384 (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Prerequisite Update ^(KB3021910^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Update ^(KB2919355^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2919355-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2932046^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2932046-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2937592^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2937592-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938439^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938439-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2938772^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2938772-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update (IR3 Build : 6.3.9600.17031)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17031" (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB2934018^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB2934018-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update Refresh (IR4 Build : 6.3.9600.17056)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17056" (
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3000850^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3000850-%ImageArchitecture%.cab"
			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3003057^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3003057-%ImageArchitecture%.cab"
		    )

		    :: Windows 8.1 with Update Refresh (IR5 Build : 6.3.9600.17415)
		    if "%SelectedSourceOS%" equ "w81" if "%ImageServicePackBuild%" equ "17415" (
			    if exist "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab" (
			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É WHD Baseline Feature Pack Update ^(KB3021910^) µ½»Ö¸´Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB3021910-%ImageArchitecture%.cab"
			    )

			    echo.-------------------------------------------------------------------------------
			    echo.¼¯³É WHD Baseline Feature Pack Update ^(KB4566425^) µ½»Ö¸´Ó³Ïñ...
			    echo.-------------------------------------------------------------------------------
			    call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Windows8.1-KB4566425-%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.-------------------------------------------------------------------------------
			    		if "%ImageArchitecture%" equ "x86" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 1, "%WinReMount%\%%i"
			    		if "%ImageArchitecture%" equ "x64" call :ApplyImage "%W10CUFix%\TH1CUFix.tpk", 2, "%WinReMount%\%%i"
			    		call :MountImageRegistry "%WinReMount%\%%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", 1, "%WinReMount%\%%i"
			    		call :MountImageRegistry "%WinReMount%\%%i"
			    		call :ImportRegistry2Image "%W10CUFix%\RS1CUFix.reg" 2>nul
			    		call :UnMountImageRegistry
			    	)
		
			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É Windows 10 Servicing Stack Update µ½»Ö¸´Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\ServicingStack"
			    )

		    	if exist "%Temp%\Updates\Enablement\Update.mum" (
			    	echo.-------------------------------------------------------------------------------
				    if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.¼¯³É Windows 10 v1909 ¹¦ÄÜ¸üÐÂµ½»Ö¸´Ó³Ïñ...
				    if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" echo.¼¯³É Windows 10 v20H2 ¹¦ÄÜ¸üÐÂµ½»Ö¸´Ó³Ïñ...
					echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Enablement"
				)

			    if exist "%Temp%\Updates\Cumulative\Update.mum" (
			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É Windows 10 Cumulative Update µ½»Ö¸´Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\Cumulative"
			    )
	
			    if exist "%Temp%\Updates\WinPE\*.cab" (
			    	echo.-------------------------------------------------------------------------------
			    	echo.¼¯³É Windows 10 WinPE Updates µ½»Ö¸´Ó³Ïñ...
			    	echo.-------------------------------------------------------------------------------
			    	call :AddPackage "%WinReMount%\%%i", "%Temp%\Updates\WinPE"
			    )
		    )
	    )
    )
)

if "%IsLogsEnabled%" equ "Yes" (
	echo.-------------------------------------------------------------------------------
	if "%SelectedSourceOS%" equ "w81" echo.Éú³É WHD »ù×¼¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%SelectedSourceOS%" equ "w10" echo.Éú³É WHD ³£¹æ¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	echo.-------------------------------------------------------------------------------
	echo.
	if "%SelectedSourceOS%" equ "w81" echo.Ð´Èë WHD »ù×¼¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%SelectedSourceOS%" equ "w10" 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" (
    	for /l %%i in (1, 1, %ImageCount%) do (
	    	if exist "%WinReMount%\%%i" (
				call :GetPackages "%WinReMount%\%%i", "Install_WinRE-%%i.txt"
    		)
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####ÇåÀíÁÙÊ±ÎÄ¼þ ^& ÎÄ¼þ¼Ð######################################
echo.-------------------------------------------------------------------------------
echo.
if "%SelectedSourceOS%" equ "w81" echo.ÇåÀí WHD »ù×¼¸üÐÂÁÙÊ±ÎÄ¼þ¼Ð¡£
if "%SelectedSourceOS%" equ "w10" echo.ÇåÀí WHD ³£¹æ¸üÐÂÁÙÊ±ÎÄ¼þ¼Ð¡£
call :RemoveFolder "%Temp%\Updates"
echo.
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w81" echo.##################Íê³É¼¯³É WHD »ù×¼¸üÐÂ####################
if "%SelectedSourceOS%" equ "w10" echo.##################Íê³É¼¯³É WHD ³£¹æ¸üÐÂ#####################
if "%UpdateType%" equ "Boot" echo.########################µ½ Windows °²×°³ÌÐòÆô¶¯Ó³Ïñ############################
if "%UpdateType%" equ "Install" echo.######################µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ###########################
if "%UpdateType%" equ "InstallRecovery" echo.#################µ½ Windows °²×°³ÌÐò°²×° ^& »Ö¸´Ó³Ïñ#####################
if "%UpdateType%" equ "BootInstallRecovery" echo.##############µ½ Windows °²×°³ÌÐòÆô¶¯, °²×° ^& »Ö¸´Ó³Ïñ#################
echo.-------------------------------------------------------------------------------

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

set UpdateType=
set PackageArchitecture=
set Updates=

endlocal

:: Reading Updated Image Information
if "%SelectedSourceOS%" equ "w10" (
	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
		)
	)
)

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Updates
:: Input Parameters [%~1 : UpdateType ]
::-------------------------------------------------------------------------------------------
:IntUpdates

setlocal

:: Setting WHD Updates Type
set "UpdateType=%~1"

cls
echo.===============================================================================
if "%UpdateType%" equ "WUpdates" echo.                   MSMG ToolKit - ¼¯³É Windows Updates
if "%UpdateType%" equ "General" echo.                 MSMG ToolKit - ¼¯³É WHD General Updates
if "%UpdateType%" equ "Hotfix" echo.                 MSMG ToolKit - ¼¯³É WHD Hotfix Updates
if "%UpdateType%" equ "Security" echo.               MSMG ToolKit - ¼¯³É WHD Security Updates
if "%UpdateType%" equ "NET35" echo.        MSMG ToolKit - ¼¯³É Microsoft .NET Framework 3.5 Updates
if "%UpdateType%" equ "WAT" echo.        MSMG ToolKit - ¼¯³É Windows Activation Technologies ^(WAT^)
if "%UpdateType%" equ "Windows10" echo.        MSMG ToolKit - ¼¯³É Windows 10 Upgrade Preparation Updates
if "%UpdateType%" equ "WinPE" echo.                MSMG ToolKit - ¼¯³É Windows PE Updates
if "%UpdateType%" equ "WUSatisfy" echo.           MSMG ToolKit - ¼¯³É Windows Update Satisfy Updates
if "%UpdateType%" equ "ADLDS" echo.   MSMG ToolKit - ¼¯³É Active Directory Lightweight Directory Services
if "%UpdateType%" equ "FMApi" echo.                    MSMG ToolKit - ¼¯³É File Management API
if "%UpdateType%" equ "Features" echo.                   MSMG ToolKit - ¼¯³É Windows Features
if "%UpdateType%" equ "VirtualPC" echo.             MSMG ToolKit - ¼¯³É Microsoft Virtual PC Feature
if "%UpdateType%" equ "WorkFolders" echo.  MSMG ToolKit - ¼¯³É Sync Agent for Domain Environmernts ^(Work Folders^)
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Settings Windows/WHD Updates Menu folder path
if "%UpdateType%" equ "WUpdates" set "Updates=%Updates%\%SelectedSourceOS%\%ImageArchitecture%"
if "%UpdateType%" neq "WUpdates" set "Updates=%WHD%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking Windows/WHD Updates folder is empty
if "%UpdateType%" equ "WUpdates" if not exist "%Updates%\*.msu" if not exist "%Updates%\*.cab" (
	echo.Windows Updates ÎÄ¼þ¼Ð ^<Updates\%SelectedSourceOS%\%ImageArchitecture%^> Îª¿Õ...
	echo.
	echo.Çë¸´ÖÆ Windows Updates files to respective ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%UpdateType%" equ "General" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#General\*.cab" (
		echo.WHD General Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#General^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD General Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "1" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD General Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD General Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\General\*.msu" if not exist "%Updates%\General\*.cab" (
		echo.WHD General Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\General^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD General Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

if "%UpdateType%" equ "Hotfix" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Hotfix\*.cab" (
		echo.WHD Hotfix Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Hotfix^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Hotfix Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "1" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD Hotfix Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Hotfix Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Hotfix\*.msu" if not exist "%Updates%\Hotfix\*.cab" (
		echo.WHD Hotfix Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Hotfix^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Hotfix Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

if "%UpdateType%" equ "Security" (
	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\#Security\*.cab" (
		echo.WHD Security Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\#Security^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Security Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "1" if not exist "%Updates%\Security\WithoutESU\*.msu" if not exist "%Updates%\Security\WithoutESU\*.cab" (
		echo.WHD Security Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security\WithoutESU^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Security Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "1" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD Security Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Security Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)
	
	if "%SelectedSourceOS%" equ "w81" if not exist "%Updates%\Security\*.msu" if not exist "%Updates%\Security\*.cab" (
		echo.WHD Security Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Security^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ WHD Security Updates files to respective ÎÄ¼þ¼Ð...
		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 Updates ÎÄ¼þ¼Ð
	echo.	       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\NET35^> Îª¿Õ...
	echo.
	echo. Çë¸´ÖÆ Microsoft .NET Framework 3.5 Updates files to respective ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%UpdateType%" equ "WAT" (
	if not exist "%Updates%\Additional\WAT\*.msu" if not exist "%Updates%\Additional\WAT\*.cab" (
		echo.                    Windows Activation Technologies ÎÄ¼þ¼Ð
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WAT^> Îª¿Õ...
		echo.
		echo.    Çë¸´ÖÆ Windows Activation Technologies files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows Activation Technologies Requires Client/Server Editions...
		goto :Stop
	)
)

if "%UpdateType%" equ "Windows10" (
	if not exist "%Updates%\Additional\Windows10\*.msu" if not exist "%Updates%\Additional\Windows10\*.cab" (
		echo.                  Windows 10 Upgrade Preparation Updates ÎÄ¼þ¼Ð
		echo.               ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\Windows10^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ Windows 10 Upgrade Preparation Updates files to Respective Folder..
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Windows10\*.cab" (
		echo.               Windows 10 Upgrade Preparation Updates ÎÄ¼þ¼Ð
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Windows10^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ Windows 10 Upgrade Preparation Updates files to Respective Folder..
		goto :Stop
	)

	if "%ImageEdition%" equ "Embedded" (
		echo.Windows 10 Upgrade Preparation Updates Requires Client Editions...
		goto :Stop
	)
)

if "%UpdateType%" equ "WinPE" if not exist "%Updates%\Additional\WinPE\*.msu" if not exist "%Updates%\Additional\WinPE\*.cab" (
	echo.Windows PE Updates ÎÄ¼þ¼Ð ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WinPE^> Îª¿Õ...
	echo.
	echo.Çë¸´ÖÆ Windows PE Updates files to respective ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%UpdateType%" equ "WUSatisfy" if not exist "%Updates%\Additional\WU.Satisfy\*.msu" if not exist "%Updates%\Additional\WU.Satisfy\*.cab" (
	echo.                    Windows Update Satisfy Updates ÎÄ¼þ¼Ð
	echo.              ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Additional\WU.Satisfy^> Îª¿Õ...
	echo.
	echo.    Çë¸´ÖÆ Windows Update Satisfy Updates files to respective ÎÄ¼þ¼Ð...
	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 Lightweight Directory Services Feature ÎÄ¼þ¼Ð
		echo.                 ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS^> Îª¿Õ...
		echo.
		echo.          Çë¸´ÖÆ ADLDS Feature files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if not exist "%Updates%\Extra\AD_LDS\Updates\*.msu" if not exist "%Updates%\Extra\AD_LDS\Updates\*.cab" (
		echo.     Active Directory Lightweight Directory Services Feature Updates ÎÄ¼þ¼Ð
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\AD_LDS\Updates^> Îª¿Õ...
		echo.
		echo.        Çë¸´ÖÆ ADLDS Feature Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\AD_LDS\*.cab" (
		echo.     Active Directory Lightweight Directory Services Feature Updates ÎÄ¼þ¼Ð
		echo.         ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\AD_LDS^> Îª¿Õ...
		echo.
		echo.        Çë¸´ÖÆ ADLDS Feature Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.           Active Directory Lightweight Directory Services Feature
		echo.             Requires Professional/Enterprise/Ultimate Editions...
		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.                        File Management API ÎÄ¼þ¼Ð
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\FM.Api^> Îª¿Õ...
	echo.
	echo.          Çë¸´ÖÆ File Management API files to respective ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%UpdateType%" equ "Features" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\_Features\*.cab" (
	echo.                           Windows Features ÎÄ¼þ¼Ð
	echo.        ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\_Features^> Îª¿Õ...
	echo.
	echo.          Çë¸´ÖÆ Windows Features files to respective ÎÄ¼þ¼Ð...
	goto :Stop
)

if "%UpdateType%" equ "VirtualPC" (
	if not exist "%Updates%\Extra\VirtualPC\*.msu" if not exist "%Updates%\Extra\VirtualPC\*.cab" (
		echo.                     Microsoft Virtual PC Feature ÎÄ¼þ¼Ð
		echo.                ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\VirtualPC^> Îª¿Õ...
		echo.
		echo.    Çë¸´ÖÆ Microsoft Virtual PC Feature files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\VirtualPC\*.cab" (
		echo.                Microsoft Virtual PC Feature Updates ÎÄ¼þ¼Ð
		echo.       ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\VirtualPC^> Îª¿Õ...
		echo.
		echo.Çë¸´ÖÆ Microsoft Virtual PC Feature Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

if "%UpdateType%" equ "WorkFolders" (
	if not exist "%Updates%\Extra\Addons\WorkFolders\*.msu" if not exist "%Updates%\Extra\Addons\WorkFolders\*.cab" (
		echo.       Sync Agent for Domain Environmernts ^(Work Folders^) Feature ÎÄ¼þ¼Ð
		echo.           ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\Addons\WorkFolders^> Îª¿Õ...
		echo.
		echo.         Çë¸´ÖÆ Sync Agent for Domain Environmernts ^(Work Folders^)
		echo.                   Feature files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%IsW7SP1CRUSelected%" equ "0" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.msu" if not exist "%Updates%\Extra\WithoutKB3125574\WorkFolders\*.cab" (
		echo.   Sync Agent for Domain Environmernts ^(Work Folders^) Feature Updates ÎÄ¼þ¼Ð
		echo.      ^<WHD\%SelectedSourceOS%\%ImageArchitecture%\Extra\WithoutKB3125574\WorkFolders^> Îª¿Õ...
		echo.
		echo.        Çë¸´ÖÆ Sync Agent for Domain Environmernts ^(Work Folders^)
		echo.                Feature Updates files to respective ÎÄ¼þ¼Ð...
		goto :Stop
	)

	if "%ImageEdition%" neq "Professional" if "%ImageEdition%" neq "Enterprise" if "%ImageEdition%" neq "Ultimate" (
		echo.           Sync Agent for Domain Environmernts ^(Work Folders^) Feature
		echo.             Requires Professional/Enterprise/Ultimate Editions...
		goto :Stop
	) else (
		goto :Continue
	)
)

:Continue
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "WUpdates" echo.####¿ªÊ¼¼¯³É Windows Updates#######################################
if "%UpdateType%" equ "General" echo.####¿ªÊ¼¼¯³É WHD General Updates###################################
if "%UpdateType%" equ "Hotfix" echo.####¿ªÊ¼¼¯³É WHD Hotfix Updates####################################
if "%UpdateType%" equ "Security" echo.####¿ªÊ¼¼¯³É WHD Security Updates##################################
if "%UpdateType%" equ "NET35" echo.######¿ªÊ¼¼¯³É Microsoft .NET Framework 3.5 Updates##################
if "%UpdateType%" equ "WAT" echo.####¿ªÊ¼¼¯³É Windows Activation Technologies ^(WAT^)#################
if "%UpdateType%" equ "Windows10" echo.####¿ªÊ¼¼¯³É Windows 10 Upgrade Preparation Updates################
if "%UpdateType%" equ "WinPE" echo.####¿ªÊ¼¼¯³É Windows PE Updates####################################
if "%UpdateType%" equ "WUSatisfy" echo.####¿ªÊ¼¼¯³É Windows Update Satisfy Updates########################
if "%UpdateType%" equ "ADLDS" echo.####¿ªÊ¼¼¯³É Active Directory Lightweight Directory Services#######
if "%UpdateType%" equ "FMApi" echo.####¿ªÊ¼¼¯³É File Management API###################################
if "%UpdateType%" equ "Features" echo.####¿ªÊ¼¼¯³É Windows Features######################################
if "%UpdateType%" equ "VirtualPC" echo.####¿ªÊ¼¼¯³É Microsoft Virtual PC Feature##########################
if "%UpdateType%" equ "WorkFolders" echo.####¿ªÊ¼¼¯³É Sync Agent for Domain Environmernts ^(Work Folders^)####
echo.-------------------------------------------------------------------------------
echo.
if "%UpdateType%" neq "WinPE" (
	echo.    Image                    : Install.wim
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
	if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
) else (
	echo.    Image                    : Boot.wim         ^|  WinRE.wim
	if /i "%ImageIndexNo%" neq "A" echo.    Image Indexes            :    2             ^|    1
	if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            :    2             ^|    1
)
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%UpdateType%" equ "WUpdates" echo.####Processing Windows Updates Packages########################################
if "%UpdateType%" equ "General" echo.####Processing WHD General Updates Packages####################################
if "%UpdateType%" equ "Hotfix" echo.####Processing WHD Hotfix Updates Packages#####################################
if "%UpdateType%" equ "Security" echo.####Processing WHD Security Updates Packages###################################
if "%UpdateType%" equ "NET35" echo.####Processing Microsoft .NET Framework 3.5 Updates Packages###################
if "%UpdateType%" equ "WAT" echo.####Processing Windows Activation Technologies ^(WAT^) Packages##################
if "%UpdateType%" equ "Windows10" echo.####Processing Windows 10 Upgrade Preparation Updates Packages#################
if "%UpdateType%" equ "WinPE" echo.####Processing Windows PE Updates Packages#####################################
if "%UpdateType%" equ "WUSatisfy" echo.####Processing Windows Update Satisfy Updates Packages#########################
if "%UpdateType%" equ "ADLDS" echo.####Processing Active Directory Lightweight Directory Services Packages########
if "%UpdateType%" equ "FMApi" echo.####Processing File Management API Packages####################################
if "%UpdateType%" equ "Features" echo.####Processing Windows Features Packages#######################################
if "%UpdateType%" equ "VirtualPC" echo.####Processing Microsoft Virtual PC Feature Packages###########################
if "%UpdateType%" equ "WorkFolders" echo.####Processing Sync Agent for Domain Environmernts ^(Work Folders^) Packages#####
echo.-------------------------------------------------------------------------------
echo.
:: Creating Windows/WHD Updates Temporary Folder
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 "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 ¸üÐÂÂú×ã¸üÐÂ³ÌÐò°üÁÙÊ±ÎÄ¼þ¼Ð...
if "%UpdateType%" equ "ADLDS" echo.´´½¨ ADLDS Èí¼þ°üÁÙÊ±ÎÄ¼þ¼Ð...
if "%UpdateType%" equ "FMApi" echo.´´½¨ÎÄ¼þ¹ÜÀí API Èí¼þ°üµÄÁÙÊ±ÎÄ¼þ¼Ð...
if "%UpdateType%" equ "Features" echo.´´½¨ Windows ¹¦ÄÜ°üÁÙÊ±ÎÄ¼þ¼Ð...
if "%UpdateType%" equ "VirtualPC" echo.´´½¨Î¢Èí 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 "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 "1" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "0" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

if "%UpdateType%" equ "WorkFolders" (
	if "%IsW7SP1CRUSelected%" equ "1" call :CreateFolder "%Temp%\Updates\%UpdateType%"
	if "%IsW7SP1CRUSelected%" equ "0" call :CreateFolder "%Temp%\Updates\%UpdateType%\Updates"
)

echo.Extracting .CAB Package files µ½ÁÙÊ±ÎÄ¼þ¼Ð...
echo.

:: Extracting/Copying Windows/WHD Updates .CAB files to Temporary Folder
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 "0" (
		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 "1" (
		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 "0" (
		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 "1" (
		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 "0" (
		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 "1" (
		if exist "%Updates%\%UpdateType%\WithoutESU\*%ImageArchitecture%*.msu" expand "%Updates%\%UpdateType%\WithoutESU\*.msu" -F:Win*.cab "%Temp%\Updates\%UpdateType%" >nul
		if exist "%Updates%\%UpdateType%\WithoutESU\*%ImageArchitecture%*.cab" %XCopy% "%Updates%\%UpdateType%\WithoutESU\*.cab" "%Temp%\Updates\%UpdateType%" >nul
		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 "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 "0" (
		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 "0" (
		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 "0" (
		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 "0" (
		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.Finished Extracting .CAB Package files µ½ÁÙÊ±ÎÄ¼þ¼Ð...
echo.
echo.-------------------------------------------------------------------------------
:: Integrating Windows/WHD Updates Packages to WIM Image
if "%UpdateType%" equ "WUpdates" echo.####¼¯³É Windows Updates################################################
if "%UpdateType%" equ "General" echo.####¼¯³É WHD General Updates############################################
if "%UpdateType%" equ "Hotfix" echo.####¼¯³É WHD Hotfix Updates#############################################
if "%UpdateType%" equ "Security" echo.####¼¯³É WHD Security Updates###########################################
if "%UpdateType%" equ "NET35" echo.####¼¯³É Microsoft .NET Framework 3.5 Updates###########################
if "%UpdateType%" equ "WAT" echo.####¼¯³É Windows Activation Technologies ^(WAT^) #########################
if "%UpdateType%" equ "Windows10" echo.####¼¯³É Windows 10 Upgrade Preparation Updates#########################
if "%UpdateType%" equ "WinPE" echo.####¼¯³É Windows PE Updates#############################################
if "%UpdateType%" equ "WUSatisfy" echo.####¼¯³É Windows Update Satisfy Updates#################################
if "%UpdateType%" equ "ADLDS" echo.####¼¯³É Active Directory Lightweight Directory Services Feature########
if "%UpdateType%" equ "FMApi" echo.####¼¯³É File Management API Feature####################################
if "%UpdateType%" equ "Features" echo.####¼¯³É Windows Features Updates#######################################
if "%UpdateType%" equ "VirtualPC" echo.####¼¯³É Microsoft Virtual PC Feature###################################
if "%UpdateType%" equ "WorkFolders" echo.####¼¯³É Sync Agent for Domain Environmernts ^(Work Folders^)#############
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%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 "0" (
				call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%"

				if exist "%Temp%\Updates\%UpdateType%\WUClient\WUClient*.cab" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows 7 - Windows Update ¿Í»§¶Ë¸üÐÂ³ÌÐò°ü...
					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 "1" (
				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 July 2016 »ã×Ü¸üÐÂ°ü...
				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 "0" if exist "%Temp%\Updates\%UpdateType%\Ent_Ultimate\*.cab" (
				if "%ImageEdition%" equ "Enterprise" (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows 7 Enterprise °æ±¾¸üÐÂ°ü...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)

				if "%ImageEdition%" equ "Ultimate"  (
					echo.-------------------------------------------------------------------------------
					echo.¼¯³É Windows 7 Ultimate °æ±¾¸üÐÂ°ü...
					echo.-------------------------------------------------------------------------------
					call :AddPackage "%InstallMount%\%%i", "%Temp%\Updates\%UpdateType%\Ent_Ultimate"
				)
			)

			if "%SelectedSourceOS%" equ "w7" if "%IsW7SP1CRUSelected%" equ "1" 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%"

			:: Applying Anti Microsoft Telemetry Client Patches
			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 "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 Updates µ½ Boot.wim Ó³Ïñ...
				echo.---------------------------------[Index : 2]-----------------------------------
				call :AddPackage "%BootMount%\2", "%Temp%\Updates\%UpdateType%"
			)

			if "%IsRecoveryImageSelected%" equ "Yes" (
				echo.-------------------------------------------------------------------------------
				echo.             ¼¯³É Windows PE Updates µ½ WinRE.wim Ó³Ïñ...
				echo.---------------------------------[Index : 1]-----------------------------------
				call :AddPackage "%WinReMount%\%%i", "%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 Pro WMC Edition - Windows ¸üÐÂÂúÒâ¸üÐÂ...
					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.¼¯³É»î¶¯Ä¿Â¼ÇáÁ¿¼¶Ä¿Â¼·þÎñ¸üÐÂ³ÌÐò°ü...
					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 "0"  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 "0" 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.Éú³É Windows ³£¹æ¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "Hotfix" echo.Éú³É WHD ÐÞ²¹³ÌÐò¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "Security" 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 ¸üÐÂÂú×ã¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "ADLDS" echo.Éú³É»î¶¯Ä¿Â¼ÇáÐÍÄ¿Â¼·þÎñ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	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.Ð´Èë Windows ³£¹æ¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "Hotfix" echo.Ð´Èë WHD ÐÞ²¹³ÌÐò¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "Security" 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 ¸üÐÂÂú×ã¸üÐÂ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	if "%UpdateType%" equ "ADLDS" echo.Ð´Èë»î¶¯Ä¿Â¼ÇáÐÍÄ¿Â¼·þÎñ¼¯³ÉÈÕÖ¾ÎÄ¼þ...
	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.
:: Cleaning Up Windows/WHD Updates Temporary folder...
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 "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 ¸üÐÂÂú×ã¸üÐÂÁÙÊ±ÎÄ¼þ¼Ð¡£
if "%UpdateType%" equ "ADLDS" echo.ÇåÀí»î¶¯Ä¿Â¼ÇáÐÍÄ¿Â¼·þÎñÁÙÊ±ÎÄ¼þ¼Ð¡£
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 Updates#######################################
if "%UpdateType%" equ "General" echo.####Íê³É¼¯³É WHD General Updates###################################
if "%UpdateType%" equ "Hotfix" echo.####Íê³É¼¯³É WHD Hotfix Updates####################################
if "%UpdateType%" equ "Security" echo.####Íê³É¼¯³É WHD Security Updates##################################
if "%UpdateType%" equ "NET35" echo.####Íê³É¼¯³É Microsoft .NET Framework 3.5 Updates##################
if "%UpdateType%" equ "WAT" echo.####Íê³É¼¯³É Windows Activation Technologies ^(WAT^) ################
if "%UpdateType%" equ "Windows10" echo.####Finished Windows 10 Upgrade Preparation Updates############################
if "%UpdateType%" equ "WinPE" echo.####Íê³É¼¯³É Windows PE Updates####################################
if "%UpdateType%" equ "WUSatisfy" echo.####Íê³É¼¯³É Windows Update Satisfy Updates########################
if "%UpdateType%" equ "ADLDS" echo.####Íê³É¼¯³É Active Directory Lightweight Directory Service Feature
if "%UpdateType%" equ "FMApi" echo.####Íê³É¼¯³É File Management API Feature###########################
if "%UpdateType%" equ "Features" echo.####Íê³É¼¯³É Windows Features Updates##############################
if "%UpdateType%" equ "VirtualPC" echo.####Íê³É¼¯³É Microsoft Virtual PC Feature##########################
if "%UpdateType%" equ "WorkFolders" echo.####Íê³É¼¯³É Sync Agent for Domain Environmernts ^(Work Folders^)####
echo.-------------------------------------------------------------------------------

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

set Updates=
set UpdateType=
set IsW7SP1CRUSelected=

endlocal

:: Reading Updated Image Information
if "%SelectedSourceOS%" equ "w10" (
	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
		)
	)
)

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Setup Media Updates
::-------------------------------------------------------------------------------------------
:IntWindowsSetupMediaUpdates

setlocal

cls
echo.===============================================================================
echo.                  MSMG ToolKit - ¸üÐÂ Windows °²×°³ÌÐòÃ½Ìå
echo.===============================================================================
echo.

If /i "%ImageIndexNo%" equ "A" (
	echo.Ñ¡Ôñ¶à¸öË÷ÒýÊ±£¬´Ë¹¦ÄÜ²»Æð×÷ÓÃ...
	pause
	goto :IntegrateMenu
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¸üÐÂ Windows °²×°³ÌÐòÃ½Ìå######################################
echo.-------------------------------------------------------------------------------
echo.
echo.»ñÈ¡ Windows °²×°³ÌÐòÃ½ÌåÓïÑÔÉèÖÃ...
echo.
for /f "tokens=* delims=" %%a in ('%DISM% /Get-WimInfo /WimFile:%BootWim% /Index:1 ^| findstr /i Default') do ( set ImageDefaultLanguage=%%a )
set ImageDefaultLanguage=%ImageDefaultLanguage:~1,-11%
echo.ÕÒµ½ Windows °²×°³ÌÐòÃ½ÌåÓïÑÔ : [%ImageDefaultLanguage%]
echo.
echo.¸´ÖÆ Windows °²×°Ã½Ìå¸üÐÂÎÄ¼þµ½ ^<DVD^> ÎÄ¼þ¼Ð...

:: Creating Directory Structures
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%\%ImageIndexNo%\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\Boot\Fonts\chs_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\chs_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\cht_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\cht_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\jpn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\jpn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\kor_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\kor_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\malgunn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgunn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\malgun_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\malgun_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\meiryon_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryon_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\meiryo_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\meiryo_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msjhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msjh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msjh_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msyhn_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyhn_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\msyh_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\msyh_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segmono_boot.ttf" "%DVD%\efi\microsoft\boot\fonts\segmono_boot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segoen_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoen_slboot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\Boot\Fonts\segoe_slboot.ttf" "%DVD%\efi\microsoft\boot\fonts\segoe_slboot.ttf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\apppatch\acres.dll" "%DVD%\sources\acres.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\actionqueue.dll" "%DVD%\sources\actionqueue.dll" >nul
rem "%DVD%\sources\adfscomp.dll" >nul
rem "%DVD%\sources\admtv3check.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\migwiz\cmi2migxml.dll" "%DVD%\sources\cmi2migxml.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\cmifw.dll" "%DVD%\sources\cmifw.dll" >nul
Copy /Y "%BootMount%\2\sources\cmisetup.dll" "%DVD%\sources\cmisetup.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\apppatch\drvmain.sdb" "%DVD%\sources\drvmain.sdb" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\CompatTel\drvmain32.sdb" "%DVD%\sources\drvmain32.sdb" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\luainstall.dll" "%DVD%\sources\luainstall.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\migapp.xml" "%DVD%\sources\migapp.xml" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\migcore.dll" "%DVD%\sources\migcore.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\mighost.exe" "%DVD%\sources\mighost.exe" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migisol.dll" "%DVD%\sources\migisol.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\migres.dll" "%DVD%\sources\migres.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\migstore.dll" "%DVD%\sources\migstore.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\PolicyDefinitions\reagent.admx" "%DVD%\sources\reagent.admx" >nul
Copy /Y "%BootMount%\2\sources\reagent.dll" "%DVD%\sources\reagent.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\migwiz\sfcn.dat" "%DVD%\sources\sfcn.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflcid.dat" "%DVD%\sources\sflcid.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflistw7.dat" "%DVD%\sources\sflistw7.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflistw8.dat" "%DVD%\sources\sflistw8.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflistw8.woa.dat" "%DVD%\sources\sflistw8.woa.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflistwb.dat" "%DVD%\sources\sflistwb.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sflistwb.woa.dat" "%DVD%\sources\sflistwb.woa.dat" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sfpat.inf" "%DVD%\sources\sfpat.inf" >nul
rem "%DVD%\sources\sfpatpg.inf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sfpatw7.inf" "%DVD%\sources\sfpatw7.inf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\migwiz\sfpatw8.inf" "%DVD%\sources\sfpatw8.inf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\apppatch\sysmain.sdb" "%DVD%\sources\sysmain.sdb" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\CompatTel\sysmain32.sdb" "%DVD%\sources\sysmain32.sdb" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\CompatTel\wica.dll" "%DVD%\sources\wica.dll" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\CompatTel\wica.ini" "%DVD%\sources\wica.ini" >nul
rem "%DVD%\sources\wicadevicefilters.xml" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\apppatch\%ImageDefaultLanguage%\acres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\acres.dll.mui" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\migwiz\%ImageDefaultLanguage%\migcore.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\migcore.dll.mui" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\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%\%ImageIndexNo%\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%\%ImageIndexNo%\Windows\System32\oobe\%ImageDefaultLanguage%\privacy.rtf" "%DVD%\sources\%ImageDefaultLanguage%\privacy.rtf" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\PolicyDefinitions\%ImageDefaultLanguage%\reagent.adml" "%DVD%\sources\%ImageDefaultLanguage%\reagent.adml" >nul
Copy /Y "%InstallMount%\%ImageIndexNo%\Windows\System32\%ImageDefaultLanguage%\reagent.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\reagent.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\rollback.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\rollback.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%\setup.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupcompat.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setuperror.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupplatform.exe.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setupresume.exe.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" "%DVD%\sources\%ImageDefaultLanguage%\setup_help_upgrade_or_custom.rtf" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\setup_help_whattokeep.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\smiengine.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\smiengine.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\spwizres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\spwizres.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgdriver.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\upgloader.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\upgloader.dll.mui" >nul
rem "%DVD%\sources\%ImageDefaultLanguage%\upgreport.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\uxlibres.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\vhdprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\vofflps.rtf" "%DVD%\sources\%ImageDefaultLanguage%\vofflps.rtf" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\w32uires.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\w32uires.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsclient.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wdsimage.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\wimprovider.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\%ImageDefaultLanguage%\winsetup.dll.mui" "%DVD%\sources\%ImageDefaultLanguage%\winsetup.dll.mui" >nul
Copy /Y "%BootMount%\2\sources\inf\setup.cfg" "%DVD%\sources\inf\setup.cfg" >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É Windows °²×°Ã½Ìå¸üÐÂ######################################
echo.-------------------------------------------------------------------------------
echo.
echo.===============================================================================
echo.
pause

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows 8.1 Media Center Generic Activation Tokens to Install Image
::-------------------------------------------------------------------------------------------
:IntWMCGActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo. MSMG ToolKit - ¼¯³É Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆ
	echo.===============================================================================
	echo.
	echo.
	echo.                            ÐÅ                 Ï¢
	echo.                            =====================
	echo.
	echo.  Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆÊÇ´ÓÍ¨¹ý Windows Store Éý¼¶·½·¨Éý¼¶
	echo.  µ½ Windows 8.1 Pro WMC ²Ù×÷ÏµÍ³µÄÎ´¼¤»îµÄ Windows 8.0 Pro WMC ²Ù×÷ÏµÍ³ÖÐ
	echo.  ÌáÈ¡µÄÍ¨ÓÃÁîÅÆÊý¾ÝÎÄ¼þ¡£
	echo.
	echo.  ÓÉÓÚ Windows 8.1 Pro ²Ù×÷ÏµÍ³²»½ÓÊÜ Windows 8.0 Pro WMC »ò WMC ¸½¼ÓÃÜÔ¿
	echo.  À´°²×°²Ù×÷ÏµÍ³£¬Òò´ËÕâÐ©Í¨ÓÃÁîÅÆÓÐÖúÓÚÊ¹Windows°²×°³ÌÐò½ÓÊÜ²¢°²×°
	echo.   Windows 8.0 Pro WMC »ò WMC ¸½¼ÓÃÜÔ¿À´½øÐÐ°²×°¡£
	echo.
	echo.  Ö®ºó£¬¿ÉÒÔÍ¨¹ýÔÚÏß»òµç»°¼¤»î·½·¨Ö±½Ó¼¤»îÒÑ°²×°µÄ²Ù×÷ÏµÍ³¡£
	echo.
	echo.
	echo.  Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

cls
echo.===============================================================================
echo.  MSMG ToolKit - ¼¯³É Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆ####
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆ#############
echo.-------------------------------------------------------------------------------
echo.

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		if "%ImageEdition%" equ "ProfessionalWMC" call :ApplyImage "%WMCGActTokens%", 1, "%InstallMount%\%%i"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows 8.1 Media Center Í¨ÓÃ¼¤»îÁîÅÆ####
echo.-------------------------------------------------------------------------------

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

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Pre-Activation Data
::-------------------------------------------------------------------------------------------
:IntPreActTokens

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - ¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý
	echo.===============================================================================
	echo.
	echo. MSMG ToolKit ½«Ê¹Äú¿ÉÒÔ½«ÏµÍ³¼¤»îÏêÏ¸ÐÅÏ¢¼¯³Éµ½ Windows °²×°¹âÅÌÓ³ÏñÖÐ£¬ÒÔÖ´ÐÐ
	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'es/'N'o] : "
	if errorlevel 2 goto :IntegrateMenu
)

setlocal

cls
echo.===============================================================================
echo.           MSMG ToolKit - ¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Settings Windows Pre-Activation Details folder path
set "PreActTokens=%PreActTokens%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Windows Pre-Activation Token data files exist
if not exist "%PreActTokens%\data.dat" if not exist "%PreActTokens%\cache.dat" if not exist "%PreActTokens%\tokens.dat" (
	echo.Windows Pre-Activation Token files folder ^<Packs\PreActTokens\%SelectedSourceOS%\%ImageArchitecture%^> is empty
	echo.
	choice /C:YN /N /M "ÄúÊÇ·ñÒª´ÓÏµÍ³ÎÄ¼þ¼Ð¸´ÖÆ¼¤»îÎÄ¼þ? ['Y'es/'N'o] : "
	if errorlevel 2 (
		echo.
		echo.Çë½«Ô¤ÏÈ¼¤»îÁîÅÆÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼Ð...
		goto :Stop
	)
	if errorlevel 1 (
		echo.
		echo.Copying Pre-Activation Token files from ^<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 ToolKit - ¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ Windows 8.1 ¼¤»î²úÆ·ÃÜÔ¿ÏêÏ¸ÐÅÏ¢#########################
echo.-------------------------------------------------------------------------------
echo.
set /p ProductKey=ÊäÈë´øÓÐ '-' µÄ²úÆ·ÃÜÔ¿: 
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows 8.1 ²úÆ·ÃÜÔ¿ [%ProductKey%]...
		echo.-------------------------------------------------------------------------------
		%DISM% /Image:"%InstallMount%\%%i" /Set-ProductKey:%ProductKey%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.¼¯³É Windows 8.1 Ô¤¼¤»îÁîÅÆÎÄ¼þ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.¸´ÖÆ Windows 8.1 Ô¤¼¤»îÁîÅÆÎÄ¼þ...
		Xcopy /O /H /R /K /Y %PreActTokens%\tokens.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\data.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0"
		Xcopy /O /H /R /K /Y %PreActTokens%\cache.dat "%InstallMount%\%%i\Windows\System32\spp\store\2.0\cache"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows 8.1 Ô¤¼¤»îÊý¾Ý#######################
echo.-------------------------------------------------------------------------------

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

set PreActTokens=
set ProductKey=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Terminal Server Patch
::-------------------------------------------------------------------------------------------
:IntCustomTerminalServer

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Terminal Server path according to selected Source OS
set "CustomTerminalServer=%CustomTerminalServer%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡ Pack file exist
if not exist "%CustomTerminalServer%\termsrv.dll" (
	echo.Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡ file "termsrv.dll" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Custom\TerminalServer\%SelectedSourceOS%\%ImageArchitecture%^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.¸´ÖÆ Microsoft Terminal Server [termsrv.dll] ²¹¶¡ÎÄ¼þ...
		echo.-------------------------------------------------------------------------------
		echo.
		%XCopy% %CustomTerminalServer%\*.* "%InstallMount%\%%i\Windows\System32"
		echo.
		echo.-------------------------------------------------------------------------------
		echo.µ¼Èë Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡×¢²á±íÉèÖÃ...
		echo.-------------------------------------------------------------------------------
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d "0" /f >nul
		Reg add "HKLM\TK_SYSTEM\ControlSet001\Control\Terminal Server" /v "fSingleSessionPerUser" /t REG_DWORD /d "0" /f >nul
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
		echo.
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Microsoft ÖÕ¶Ë·þÎñÆ÷²¹¶¡#######################
echo.-------------------------------------------------------------------------------

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

set CustomTerminalServer=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom UxTheme Patch
::-------------------------------------------------------------------------------------------
:IntCustomUxTheme

setlocal

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¼¯³É×Ô¶¨Òå UxTheme ²¹¶¡
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Custom UxTheme Patch Pack files path according to selected Source OS
set "CustomUxTheme=%CustomUxTheme%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom UxTheme Patch Pack file exist
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
		)
	)
)

:: Checking whether Custom UxTheme Patch Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.¸´ÖÆ×Ô¶¨Òå UxTheme ²¹¶¡ÎÄ¼þ...
		echo.
		%XCopy% %CustomUxTheme%\*.* "%InstallMount%\%%i\Windows\System32"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É×Ô¶¨Òå UxTheme ²¹¶¡##################################
echo.-------------------------------------------------------------------------------

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

set CustomUxTheme=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom Windows Recovery Image
::-------------------------------------------------------------------------------------------
:IntCustomRecoveryImage

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É×Ô¶¨Òå Windows »Ö¸´Ó³Ïñ
echo.===============================================================================
echo.

:: Checking whether Source Windows Recovery Image is selected
if "%IsRecoveryImageSelected%" equ "Yes" (
	echo.ÒÑÑ¡Ôñ Windows »Ö¸´Ó³Ïñ...
	echo.
	echo.Ñ¡ÔñÀ´Ô´Ê±£¬ÇëÌø¹ý Windows »Ö¸´Ó³Ïñ¡£
	goto :Stop
)

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Custom Windows Recovery Image file path according to selected Source OS
set "RecoveryImage=%RecoveryImage%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom Windows Recovery Image file exist
if not exist "%RecoveryImage%\winre.wim" (
	echo.×Ô¶¨Òå Windows »Ö¸´Ó³ÏñÎÄ¼þ "winre.wim" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Custom\RecoveryImage\%SelectedSourceOS%\%ImageArchitecture%^> ÎÄ¼þ¼Ð...
	goto :Stop
)
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É×Ô¶¨Òå Windows »Ö¸´Ó³Ïñ#########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i -^> WinRE.wim]====================
		if %%i gtr 9 echo.=====================[Install.wim, Index : %%i -^> WinRE.wim]===================
		echo.
		echo.¸´ÖÆ×Ô¶¨Òå Windows »Ö¸´»·¾³ (WinRE) Ó³Ïñ...
		%XCopy% %RecoveryImage%\*.* "%InstallMount%\%%i\Windows\System32\Recovery" >nul
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É×Ô¶¨Òå Windows »Ö¸´Ó³Ïñ#########################
echo.-------------------------------------------------------------------------------

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

set RecoveryImage=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom Default User Account Pictures
::-------------------------------------------------------------------------------------------
:IntUAP

setlocal

cls
echo.===============================================================================
echo.        MSMG ToolKit - ¼¯³É×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬
echo.===============================================================================
echo.

:: Setting Custom User Account Pictures path according to selected Source OS
set "UAP=%UAP%\%SelectedSourceOS%"

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬°üÎÄ¼þ "user.bmp" Î´ÕÒµ½...
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\UAP\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Server" (
	if not exist "%UAP%\user.bmp" (
		echo.×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬°üÎÄ¼þ "user.bmp" Î´ÕÒµ½...
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\UAP\%SelectedSourceOS%^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
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
		)
	)
)

:: Checking whether Custom Default User Account Pictures Pack file exist
if "%SelectedSourceOS%" equ "w10" (
	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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.ÕýÔÚ¸´ÖÆ×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬ÎÄ¼þ...
		echo.

		if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" neq "Server Core" (
			if "%ImageInstallationType%" neq "Server" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
			if "%ImageInstallationType%" equ "Server" %XCopy% %UAP%\user.bmp "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
		)

		if "%SelectedSourceOS%" neq "w7" %XCopy% %UAP%\*.* "%InstallMount%\%%i\ProgramData\Microsoft\User Account Pictures"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É×Ô¶¨ÒåÄ¬ÈÏÓÃ»§ÕÊ»§Í¼Æ¬##################
echo.-------------------------------------------------------------------------------

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

set UAP=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Custom System Files
::-------------------------------------------------------------------------------------------
:IntCustomFiles

setlocal

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¼¯³É×Ô¶¨ÒåÏµÍ³ÎÄ¼þ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Setting Custom System files path according to selected Source OS
set "CustomFiles=%CustomFiles%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom System files Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.Copying Custom System files...
		echo.
		%XCopy% %CustomFiles%\*.* "%InstallMount%\%%i"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É×Ô¶¨ÒåÏµÍ³ÎÄ¼þ###################################
echo.-------------------------------------------------------------------------------

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

set CustomFiles=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Microsoft Win32Calc Metro Skin
::-------------------------------------------------------------------------------------------
:IntWin32CalcMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Microsoft Win32Calc Metro Æ¤·ô
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

set "Skins=%Skins%\Win32Calc"

:: Checking whether Microsoft Win32Calc Metro Skin Pack file exist
if not exist "%Skins%\Win32Calc.exe.res" (
	echo.Microsoft Win32Calc Metro Æ¤·ô°üÎÄ¼þ "Win32Calc.exe.res" Î´ÕÒµ½...
	echo.
	echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Skins\Win32Calc^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Microsoft Win32Calc Metro Æ¤·ô########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Microsoft Win32Calc 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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.¸´ÖÆ Microsoft Win32Calc ÎÄ¼þµ½ÁÙÊ±ÎÄ¼þ¼Ð...
		if "%ImageArchitecture%" equ "x86" copy "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc_x.exe" >nul

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Windows\System32\Win32Calc.exe" "%Temp%\Win32Calc64_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\Win32Calc.exe" "%Temp%\Win32Calc32_x.exe" >nul
		)

		echo.
		echo.Ó¦ÓÃ Microsoft Win32Calc 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 Win32Calc ÎÄ¼þ...
		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 Win32Calc Metro Æ¤·ô########################
echo.-------------------------------------------------------------------------------

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

set Skins=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Photo Viewer Metro Skin
::-------------------------------------------------------------------------------------------
:IntWPVMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Windows Photo Viewer Metro Æ¤·ô
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

set "Skins=%Skins%\PhotoViewer"

:: Checking whether Windows Photo Viewer Metro Skin Pack file exist
for %%i in (PhotoViewer.dll.res, photowiz.dll.res) do (
	if not exist "%Skins%\%%i" (
		echo.Windows Photo Viewer Metro Æ¤·ô°üÎÄ¼þ "%%i" Î´ÕÒµ½...
		echo.
		echo.Çë¸´ÖÆÉÏÃæµÄÎÄ¼þµ½ ^<Packs\Skins\PhotoViewer^> ÎÄ¼þ¼Ð...
		goto :Stop
	)
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¼¯³É Windows Photo Viewer Metro Æ¤·ô#######################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼¯³É Windows Photo Viewer 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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.¸´ÖÆ Windows Photo Viewer ÎÄ¼þµ½ÁÙÊ±ÎÄ¼þ¼Ð...
		if "%ImageArchitecture%" equ "x86" (
			copy "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Program Files\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer64_x.dll" >nul
			copy "%InstallMount%\%%i\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll" "%Temp%\PhotoViewer32_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\System32\photowiz.dll" "%Temp%\photowiz64_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\photowiz.dll" "%Temp%\photowiz32_x.dll" >nul
		)

		echo.
		if "%ImageArchitecture%" equ "x86" (
			echo.Applying Windows Photo Viewer Metro Skin to [PhotoViewer.dll] file...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\PhotoViewer_x.dll", "%Temp%\PhotoViewer.dll", "%Skins%\PhotoViewer.dll.res" ,,,
			call :RemoveFile "%Temp%\PhotoViewer_x.dll"
			echo.
			echo.Applying Windows Photo Viewer Metro Skin to [photowiz.dll] file...
			"%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.Applying Windows Photo Viewer Metro Skin to [PhotoViewer.dll] file...
			"%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.Applying Windows Photo Viewer Metro Skin to [photowiz.dll] file...
			"%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.Copying Patched Windows Photo Viewer files...
		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 Photo Viewer Metro Æ¤·ô#######################
echo.-------------------------------------------------------------------------------

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

set Skins=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Integrate Windows Media Player Metro Skin
::-------------------------------------------------------------------------------------------
:IntWMPMetroSkin

setlocal

cls
echo.===============================================================================
echo.          MSMG ToolKit - ¼¯³É Windows Media Player Metro Æ¤·ô
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

set "Skins=%Skins%\MediaPlayer"

:: Checking whether Windows Media Player Metro Skin Pack file exist
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.¸´ÖÆ Windows Media Player ÎÄ¼þµ½ÁÙÊ±ÎÄ¼þ¼Ð...
		if "%ImageArchitecture%" equ "x86" (
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc_x.dll" >nul
		)

		if "%ImageArchitecture%" equ "x64" (
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" "%Temp%\setup_wm_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" "%Temp%\wmpconfig_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" "%Temp%\wmplayer_x.exe" >nul
			copy "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" "%Temp%\wmpshare_x.exe" >nul
			if exist "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" copy "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" "%Temp%\WMPSideShowGadget_x.exe" >nul
			copy "%InstallMount%\%%i\Windows\System32\wmploc.dll" "%Temp%\wmploc64_x.dll" >nul
			copy "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" "%Temp%\wmploc32_x.dll" >nul
		)

		echo.
		echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [setup_wm.exe] ÎÄ¼þ...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\setup_wm_x.exe", "%Temp%\setup_wm.exe", "%Skins%\setup_wm.exe.res" ,,,
		call :RemoveFile "%Temp%\setup_wm_x.exe"
		echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [wmpconfig.exe] ÎÄ¼þ...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpconfig_x.exe", "%Temp%\wmpconfig.exe", "%Skins%\wmpconfig.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpconfig_x.exe"
		echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [wmplayer.exe] ÎÄ¼þ...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmplayer_x.exe", "%Temp%\wmplayer.exe", "%Skins%\wmplayer.exe.res" ,,,
		call :RemoveFile "%Temp%\wmplayer_x.exe"
		echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [wmpshare.exe] ÎÄ¼þ...
		"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmpshare_x.exe", "%Temp%\wmpshare.exe", "%Skins%\wmpshare.exe.res" ,,,
		call :RemoveFile "%Temp%\wmpshare_x.exe"

		if exist "%Temp%\WMPSideShowGadget_x.exe" (
			echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [WMPSideShowGadget.exe] ÎÄ¼þ...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\WMPSideShowGadget_x.exe", "%Temp%\WMPSideShowGadget.exe", "%Skins%\WMPSideShowGadget.exe.res" ,,,
			call :RemoveFile "%Temp%\WMPSideShowGadget_x.exe"
		)

		if "%ImageArchitecture%" equ "x86" (
			echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [wmploc.dll] ÎÄ¼þ...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc_x.dll", "%Temp%\wmploc.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc_x.dll"
		)

		if "%ImageArchitecture%" equ "x64" (
			echo.Ó¦ÓÃ Windows Media Player Metro Æ¤·ôµ½ [wmploc.dll] ÎÄ¼þ...
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc32_x.dll", "%Temp%\wmploc32.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc32_x.dll"
			"%Temp%\ResourceHacker.exe" -addoverwrite "%Temp%\wmploc64_x.dll", "%Temp%\wmploc64.dll", "%Skins%\wmploc.dll.res" ,,,
			call :RemoveFile "%Temp%\wmploc64_x.dll"
		)

		echo.
		echo.¸´ÖÆ²¹¶¡ Windows Media Player ÎÄ¼þ...
		move /y "%Temp%\setup_wm.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\setup_wm.exe" >nul
		move /y "%Temp%\wmpconfig.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpconfig.exe" >nul
		move /y "%Temp%\wmplayer.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmplayer.exe" >nul
		move /y "%Temp%\wmpshare.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\wmpshare.exe" >nul
		if exist "%Temp%\WMPSideShowGadget.exe" move /y "%Temp%\WMPSideShowGadget.exe" "%InstallMount%\%%i\Program Files\Windows Media Player\WMPSideShowGadget.exe" >nul
		if "%ImageArchitecture%" equ "x86" move /y "%Temp%\wmploc.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc64.dll" "%InstallMount%\%%i\Windows\System32\wmploc.dll" >nul
		if "%ImageArchitecture%" equ "x64" move /y "%Temp%\wmploc32.dll" "%InstallMount%\%%i\Windows\SysWOW64\wmploc.dll" >nul
	)
)

call :RemoveFile "%Temp%\ResourceHacker.exe"
call :RemoveFile "%Temp%\ResourceHacker.ini"
call :RemoveFile "%Temp%\ResourceHacker.log"

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¼¯³É Windows Media Player Metro Æ¤·ô#######################
echo.-------------------------------------------------------------------------------

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

set Skins=

endlocal

:: Returning to Integrate Menu
goto :IntegrateMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to É¾³ý Windows ×é¼þ Menu
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsMenu

:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - É¾³ý 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
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - É¾³ý Windows ×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1]   ÍøÂç
	echo.
	echo.  [2]   ¶àÃ½Ìå
	echo.
	echo.  [3]   ÒþË½
	echo.
	echo.  [4]   Ô¶³Ì´¦Àí
	echo.
	echo.  [5]   ÏµÍ³
	echo.
	echo.  [6]   ÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.
	echo.  [7]   Windows Ó¦ÓÃ³ÌÐò
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 8 goto :RemoveWindowsComponentsMenu
	if errorlevel 7 goto :RemoveWindowsAppsMenu
	if errorlevel 6 goto :RemoveSystemAppsMenu
	if errorlevel 5 goto :RemoveSystemMenu
	if errorlevel 4 goto :RemoveRemotingMenu
	if errorlevel 3 goto :RemovePrivacyMenu
	if errorlevel 2 goto :RemoveMultimediaMenu
	if errorlevel 1 goto :RemoveInternetMenu
)

:RemoveInternetMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Internet Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - É¾³ý»¥ÁªÍø×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1] %C_AdobeFlashForWindows% Adobe Flash For Windows
	echo.
	if "%ImageBuild%" leq "19041" (
		echo.  [2] %C_InternetExplorer% Internet Explorer
		echo.
		echo.
	)
	if "%ImageBuild%" equ "19042" (
		echo.  [2] %C_EdgeChromium% Edge Chromium Browser
		echo.
		echo.  [3] %C_InternetExplorer% Internet Explorer
	)
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   ËùÓÐ»¥ÁªÍø×é¼þ
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:123AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 5 goto :SelectWindowsComponentsMenu
	if errorlevel 4 (
		set "C_AdobeFlashForWindows=-"
		if "%ImageBuild%" equ "19042" set "C_EdgeChromium=-"
		set "C_InternetExplorer=-"
	)
	if errorlevel 3 if "%ImageBuild%" equ "19042" (	if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%ImageBuild%" leq "19041" ( if "%C_InternetExplorer%" equ "+" ( set "C_InternetExplorer=-" ) else ( set "C_InternetExplorer=+" ) )
	if errorlevel 2 if "%ImageBuild%" equ "19042" ( if "%C_EdgeChromium%" equ "+" ( set "C_EdgeChromium=-" ) else ( set "C_EdgeChromium=+" ) )
	if errorlevel 1 ( if "%C_AdobeFlashForWindows%" equ "+" ( set "C_AdobeFlashForWindows=-" ) else ( set "C_AdobeFlashForWindows=+" ) )

	goto :RemoveInternetMenu
)

:RemoveMultimediaMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Multimedia Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                 MSMG ToolKit - É¾³ý¶àÃ½Ìå×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1] %C_FirstLogonAnimation% First Logon Animation
	echo.  [2] %C_GameExplorer% Game Explorer ^| Needed for Microsoft Games
	echo.  [3] %C_SnippingTool% Snipping Tool
	echo.  [4] %C_SpeechRecognition% Speech Recognition ^| Needed for Cortana
	echo.  [5] %C_WindowsMediaPlayer% Windows Media Player
	echo.  [6] %C_WindowsPhotoViewer% Windows Photo Viewer
	echo.  [7] %C_WinSAT% Windows System Assessment Tool ^| Needed for Microsoft Games
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   ËùÓÐ¶àÃ½Ìå×é¼þ
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:1234567AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 9 goto :SelectWindowsComponentsMenu
	if errorlevel 8 (
		set "C_Cortana=-"
		set "C_FirstLogonAnimation=-"
		set "C_GameExplorer=-"
		set "C_SnippingTool=-"
		set "C_SpeechRecognition=-"
		set "C_WindowsMediaPlayer=-"
		set "C_WindowsPhotoViewer=-"
		set "C_WinSAT=-"
	)
	if errorlevel 7 ( if "%C_WinSAT%" equ "+" ( set "C_WinSAT=-" ) else ( set "C_WinSAT=+" ) )
	if errorlevel 6 ( if "%C_WindowsPhotoViewer%" equ "+" ( set "C_WindowsPhotoViewer=-" ) else ( set "C_WindowsPhotoViewer=+" ) )
	if errorlevel 5 ( if "%C_WindowsMediaPlayer%" equ "+" ( set "C_WindowsMediaPlayer=-" ) else ( set "C_WindowsMediaPlayer=+" ) )
	if errorlevel 4 ( 
		if "%C_SpeechRecognition%" equ "+" ( 
			set "C_Cortana=-"
			set "C_SpeechRecognition=-"
		) else ( 
			set "C_SpeechRecognition=+"
		)
	)
	if errorlevel 3 ( if "%C_SnippingTool%" equ "+" ( set "C_SnippingTool=-" ) else ( set "C_SnippingTool=+" ) )
	if errorlevel 2 ( if "%C_GameExplorer%" equ "+" ( set "C_GameExplorer=-" ) else  ( set "C_ameExplorer=+" ) )
	if errorlevel 1 ( if "%C_FirstLogonAnimation%" equ "+" ( set "C_FirstLogonAnimation=-" ) else  ( set "C_FirstLogonAnimation=+" ) )

	goto :RemoveMultimediaMenu
)

:RemovePrivacyMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Privacy Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÒþË½×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [A] %C_AssignedAccess% Assigned Access
	echo.  [B] %C_CEIP_SQM% Customer Experience Improvement Program ^(CEIP^)
	echo.  [C] %C_FaceRecognition% Face Recognition
	echo.  [D] %C_KernelDebugging% Kernel Debugging ^| Depends on: Windows Error Reporting
	echo.  [E] %C_LocationService% Location Service
	echo.  [F] %C_PicturePassword% Picture Password
	echo.  [G] %C_PinEnrollment% Pin SignIn Support
	echo.  [H] %C_UnifiedTelemetryClient% Unified Telemetry Client ^(Asimov^) ^| Depends on: Windows Error Reporting
	echo.  [I] %C_WiFiNetworkManager% WiFi Network Manager ^(WiFi Sense^)
	if "%ImageBuild%" equ "17763" echo.  [J] %C_WindowsErrorReporting% Windows Error Reporting
	if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" echo.  [J] %C_WindowsErrorReporting% Windows Error Reporting ^| Needed for Out of Box Experience
	if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" echo.  [J] %C_WindowsErrorReporting% Windows Error Reporting
	echo.  [K] %C_WindowsInsiderHub% Windows Insider Hub
	echo.
	echo.
	echo.  [1]   ËùÓÐÒþË½×é¼þ
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJK1X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 13 goto :SelectWindowsComponentsMenu
	if errorlevel 12 (
		set "C_AssignedAccess=-"
		set "C_CEIP_SQM=-"
		set "C_FaceRecognition=-"
		set "C_KernelDebugging=-"
		set "C_LocationService=-"
		set "C_PicturePassword=-"
		set "C_PinEnrollment=-"
		set "C_UnifiedTelemetryClient=-"
		set "C_WiFiNetworkManager=-"
		set "C_WindowsErrorReporting=-"
		set "C_WindowsInsiderHub=-"
	)
	if errorlevel 11 ( if "%C_WindowsInsiderHub%" equ "+" ( set "C_WindowsInsiderHub=-" ) else ( set "C_WindowsInsiderHub=+" ) )
	if errorlevel 10 ( 
		if "%C_WindowsErrorReporting%" equ "+" ( 
			set "C_KernelDebugging=-"
			set "C_UnifiedTelemetryClient=-"
			set "C_WindowsErrorReporting=-"
		) else ( 
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 9  ( if "%C_WiFiNetworkManager%" equ "+" ( set "C_WiFiNetworkManager=-" ) else ( set "C_WiFiNetworkManager=+" ) )
	if errorlevel 8 ( 
		if "%C_UnifiedTelemetryClient%" equ "+" ( 
			set "C_UnifiedTelemetryClient=-"
		) else ( 
			set "C_UnifiedTelemetryClient=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 7  ( if "%C_PinEnrollment%" equ "+" ( set "C_PinEnrollment=-" ) else ( set "C_PinEnrollment=+" ) )
	if errorlevel 6  ( if "%C_PicturePassword%" equ "+" ( set "C_PicturePassword=-" ) else ( set "C_PicturePassword=+" ) )
	if errorlevel 5  ( if "%C_LocationService%" equ "+" ( set "C_LocationService=-" ) else ( set "C_LocationService=+" ) )
	if errorlevel 4 ( 
		if "%C_KernelDebugging%" equ "+" ( 
			set "C_KernelDebugging=-"
		) else ( 
			set "C_KernelDebugging=+"
			set "C_WindowsErrorReporting=+"
		)
	)
	if errorlevel 3  ( if "%C_FaceRecognition%" equ "+" ( set "C_FaceRecognition=-" ) else ( set "C_FaceRecognition=+" ) )
	if errorlevel 2  ( if "%C_CEIP_SQM%" equ "+" ( set "C_CEIP_SQM=-" ) else ( set "C_CEIP_SQM=+" ) )
	if errorlevel 1 ( 
		if "%C_AssignedAccess%" equ "+" ( 
			set "C_AssignedAccess=-"
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
		)
	)

	goto :RemovePrivacyMenu
)

:RemoveRemotingMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client Remoting Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÔ¶³Ì´¦Àí×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1] %C_HomeGroup% Home Group
	echo.
	echo.  [2] %C_MultiPointConnector% MultiPoint Connector
	echo.
	echo.  [3] %C_RemoteAssistance% Remote Assistance
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [A]   ËùÓÐÔ¶³Ì´¦Àí×é¼þ
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:123AX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 5 goto :SelectWindowsComponentsMenu
	if errorlevel 4 (
		set "C_HomeGroup=-"
		set "C_MultiPointConnector=-"
		set "C_RemoteAssistance=-"
	)
	if errorlevel 3 ( if "%C_RemoteAssistance%" equ "+" ( set "C_RemoteAssistance=-" ) else ( set "C_RemoteAssistance=+" ) )
	if errorlevel 2 ( if "%C_MultiPointConnector%" equ "+" ( set "C_MultiPointConnector=-" ) else ( set "C_MultiPointConnector=+" ) )
	if errorlevel 1 ( if "%C_HomeGroup%" equ "+" ( set "C_HomeGroup=-" ) else ( set "C_HomeGroup=+" ) )

	goto :RemoveRemotingMenu
)

:RemoveSystemMenu
:: Remove Windows 10 v1809/v1903/v1909/v2004/v20H2 Client System Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.  [A] %C_DeviceLockdown% Device Lockdown ^(Embedded Experience^)
	echo.  [B] %C_EaseOfAccessThemes% Ease of Access Themes
	echo.  [C] %C_EasyTransfer% Easy Transfer
	echo.  [D] %C_FileHistory% File History
	echo.  [E] %C_ManualSetup% Manual Setup ^(InPlace Upgrade^)
	echo.  [F] %C_Paint% Paint
	echo.  [G] %C_SecurityCenter% Security Center ^| Depends on: Windows Defender
	echo.  [H] %C_StepsRecorder% Steps Recorder
	echo.  [I] %C_SystemRestore% System Restore ^| Depends on: Windows Backup
	echo.  [J] %C_WindowsBackup% Windows Backup
	echo.  [K] %C_WindowsFirewall% Windows Firewall
	echo.  [L] %C_WindowsSubsystemForLinux% Windows Subsystem For Linux
	echo.  [M] %C_WindowsToGo% Windows To Go
	echo.  [N] %C_Wordpad% Wordpad
	echo.
	echo.  [1]   ËùÓÐÏµÍ³×é¼þ
	echo.
	echo.  [X]   ·µ»Ø
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMN1X /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 16 goto :SelectWindowsComponentsMenu
	if errorlevel 15 (
		set "C_DeviceLockdown=-"
		set "C_EaseOfAccessThemes=-"
		set "C_EasyTransfer=-"
		set "C_FileHistory=-"
		set "C_ManualSetup=-"
		set "C_Paint=-"
		set "C_SecurityCenter=-"
		set "C_StepsRecorder=-"
		set "C_SystemRestore=-"
		set "C_WindowsBackup=-"
		set "C_WindowsFirewall=-"
		set "C_WindowsSubsystemForLinux=-"
		set "C_WindowsToGo=-"
		set "C_Wordpad=-"
	)
	if errorlevel 14 ( if "%C_Wordpad%" equ "+" ( set "C_Wordpad=-" ) else ( set "C_Wordpad=+" ) )
	if errorlevel 13 ( if "%C_WindowsToGo%" equ "+" ( set "C_WindowsToGo=-" ) else ( set "C_WindowsToGo=+" ) )
	if errorlevel 12 ( if "%C_WindowsSubsystemForLinux%" equ "+" ( set "C_WindowsSubsystemForLinux=-" ) else ( set "C_WindowsSubsystemForLinux=+" ) )
	if errorlevel 11 ( if "%C_WindowsFirewall%" equ "+" ( set "C_WindowsFirewall=-" ) else ( set "C_WindowsFirewall=+" ) )
	if errorlevel 10 ( 
		if "%C_WindowsBackup%" equ "+" ( 
			set "C_SystemRestore=-"
			set "C_WindowsBackup=-"
		) else ( 
			set "C_WindowsBackup=+"
		)
	)
	if errorlevel 9 ( 
		if "%C_SystemRestore%" equ "+" ( 
			set "C_SystemRestore=-"
		) else ( 
			set "C_SystemRestore=+"
			set "C_WindowsBackup=+"
		)
	)
	if errorlevel 8 ( if "%C_StepsRecorder%" equ "+" ( set "C_StepsRecorder=-" ) else ( set "C_StepsRecorder=+" ) )
	if errorlevel 7 (
		if "%C_SecurityCenter%" equ "+" ( 
			set "C_SecurityCenter=-"
		) else ( 
			set "C_SecurityCenter=+"
			set "C_WindowsDefender=+"
		)
	)
	if errorlevel 6 ( if "%C_Paint%" equ "+" ( set "C_Paint=-" ) else ( set "C_Paint=+" ) )
	if errorlevel 5 ( if "%C_ManualSetup%" equ "+" ( set "C_ManualSetup=-" ) else ( set "C_ManualSetup=+" ) )
	if errorlevel 4 ( if "%C_FileHistory%" equ "+" ( set "C_FileHistory=-" ) else ( set "C_FileHistory=+" ) )
	if errorlevel 3 ( if "%C_EasyTransfer%" equ "+" ( set "C_EasyTransfer=-" ) else ( set "C_EasyTransfer=+" ) )
	if errorlevel 2 ( if "%C_EaseOfAccessThemes%" equ "+" ( set "C_EaseOfAccessThemes=-" ) else ( set "C_EaseOfAccessThemes=+" ) )
	if errorlevel 1 ( if "%C_DeviceLockdown%" equ "+" ( set "C_DeviceLockdown=-" ) else ( set "C_DeviceLockdown=+" ) )

	goto :RemoveSystemMenu
)

:RemoveSystemAppsMenu
:: Remove Windows 10 v1809 Client Enterprise LTSC 2019 Client System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AssignedAccessLockApp% Assigned Access Lock App ^| Depends on: Assigned Access
	echo.  [02] %C_AADBrokerPlugin% Azure Active Directory AppX Broker Plugin
	echo.  [03] %C_BioEnrollment% Bio Enrollment App
	echo.  [04] %C_CBSPreview% Camera Barcode Scanner
	echo.  [05] %C_ContentDeliveryManager% Content Delivery Manager ^| Needed for Out of Box Experience
	echo.  [06] %C_Cortana% Cortana, StartMenu ^& Settings Search App ^| Depends on: Speech Recognition
	echo.  [07] %C_EdgeDevToolsClient% Edge Developer Tools Client
	echo.  [08] %C_ECApp% Eye Control App
	echo.  [09] %C_FileExplorer% File Explorer App
	echo.  [10] %C_LockApp% Lockscreen App
	echo.  [11] %C_MapControl% Map Control
	echo.  [12] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [13] %C_ParentalControls% Parental Controls
	echo.  [14] %C_PeopleExperienceHost% People Bar
	echo.  [15] %C_QuickAssist% Quick Assist App
	echo.  [16] %C_RetailDemoContent% Retail Demo Content
	echo.  [17] %C_SettingSync% Setting Sync
	echo.  [18] %C_SkypeORTC% Skype ORTC
	echo.  [19] %C_SmartScreen% Smart Screen ^| Depends on: Windows Defender
	echo.  [20] %C_Win32WebViewHost% Win32 Web View Host
	echo.  [21] %C_WindowsDefender% Windows Defender App
	echo.  [22] %C_WindowsMixedReality% Windows Mixed Reality
	echo.  [23] %C_WindowsReaderPDF% Windows Reader ^(PDF^)
	echo.  [24] %C_XboxGameCallableUI% Xbox Game Callable UI
	echo.
	echo.  [A]    ËùÓÐÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_AADBrokerPlugin=-"
		set "C_AssignedAccessLockApp=-"
		set "C_BioEnrollment=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_ECApp=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_NarratorQuickStart=-"
		set "C_ParentalControls=-"
		set "C_PeopleExperienceHost=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
	)
	if "!MenuChoice!" equ "24" ( if "%C_XboxGameCallableUI%" equ "+" ( set "C_XboxGameCallableUI=-" ) else ( set "C_XboxGameCallableUI=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_WindowsReaderPDF%" equ "+" ( set "C_WindowsReaderPDF=-" ) else ( set "C_WindowsReaderPDF=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_WindowsMixedReality%" equ "+" ( set "C_WindowsMixedReality=-" ) else ( set "C_WindowsMixedReality=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_SmartScreen=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "20" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "19" (
		if "%C_SmartScreen%" equ "+" ( 
			set "C_SmartScreen=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "18" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_PeopleExperienceHost%" equ "+" ( set "C_PeopleExperienceHost=-" ) else ( set "C_PeopleExperienceHost=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_MapControl%" equ "+" ( set "C_MapControl=-" ) else ( set "C_MapControl=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_EdgeDevToolsClient%" equ "+" ( set "C_EdgeDevToolsClient=-" ) else ( set "C_EdgeDevToolsClient=+" ) )
	if "!MenuChoice!" equ "06" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "05" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)

	goto :RemoveSystemAppsMenu
)

:: Remove Windows 10 v1809 Client Enterprise N LTSC 2019 Client System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AssignedAccessLockApp% Assigned Access Lock App ^| Depends on: Assigned Access
	echo.  [02] %C_AADBrokerPlugin% Azure Active Directory AppX Broker Plugin
	echo.  [03] %C_BioEnrollment% Bio Enrollment App
	echo.  [04] %C_CBSPreview% Camera Barcode Scanner
	echo.  [05] %C_ContentDeliveryManager% Content Delivery Manager ^| Needed for Out of Box Experience
	echo.  [06] %C_Cortana% Cortana, StartMenu ^& Settings Search App ^| Depends on: Speech Recognition
	echo.  [07] %C_EdgeDevToolsClient% Edge Developer Tools Client
	echo.  [08] %C_ECApp% Eye Control App
	echo.  [09] %C_FileExplorer% File Explorer App
	echo.  [10] %C_LockApp% Lockscreen App
	echo.  [11] %C_MapControl% Map Control
	echo.  [12] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [13] %C_ParentalControls% Parental Controls
	echo.  [14] %C_PeopleExperienceHost% People Bar
	echo.  [15] %C_QuickAssist% Quick Assist App
	echo.  [16] %C_RetailDemoContent% Retail Demo Content
	echo.  [17] %C_SettingSync% Setting Sync
	echo.  [18] %C_SkypeORTC% Skype ORTC
	echo.  [19] %C_SmartScreen% Smart Screen ^| Depends on: Windows Defender
	echo.  [20] %C_Win32WebViewHost% Win32 Web View Host
	echo.  [21] %C_WindowsDefender% Windows Defender App
	echo.  [22] %C_WindowsMixedReality% Windows Mixed Reality
	echo.  [23] %C_WindowsReaderPDF% Windows Reader ^(PDF^)
	echo.  [24] %C_XboxGameCallableUI% Xbox Game Callable UI
	echo.
	echo.  [A]    ËùÓÐÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_AADBrokerPlugin=-"
		set "C_AssignedAccessLockApp=-"
		set "C_BioEnrollment=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_ECApp=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_NarratorQuickStart=-"
		set "C_ParentalControls=-"
		set "C_PeopleExperienceHost=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
	)
	if "!MenuChoice!" equ "24" ( if "%C_XboxGameCallableUI%" equ "+" ( set "C_XboxGameCallableUI=-" ) else ( set "C_XboxGameCallableUI=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_WindowsReaderPDF%" equ "+" ( set "C_WindowsReaderPDF=-" ) else ( set "C_WindowsReaderPDF=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_WindowsMixedReality%" equ "+" ( set "C_WindowsMixedReality=-" ) else ( set "C_WindowsMixedReality=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_SmartScreen=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "20" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "19" (
		if "%C_SmartScreen%" equ "+" ( 
			set "C_SmartScreen=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "18" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_PeopleExperienceHost%" equ "+" ( set "C_PeopleExperienceHost=-" ) else ( set "C_PeopleExperienceHost=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_MapControl%" equ "+" ( set "C_MapControl=-" ) else ( set "C_MapControl=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_EdgeDevToolsClient%" equ "+" ( set "C_EdgeDevToolsClient=-" ) else ( set "C_EdgeDevToolsClient=+" ) )
	if "!MenuChoice!" equ "06" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "05" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)

	goto :RemoveSystemAppsMenu
)

:: Remove Windows 10 v1809 Client Edition System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AssignedAccessLockApp% Assigned Access Lock App ^| Depends on: Assigned Access
	echo.  [02] %C_AADBrokerPlugin% Azure Active Directory AppX Broker Plugin
	echo.  [03] %C_BioEnrollment% Bio Enrollment App
	echo.  [04] %C_CBSPreview% Camera Barcode Scanner
	echo.  [05] %C_PPIProjection% Connect App
	echo.  [06] %C_ContentDeliveryManager% Content Delivery Manager ^| Needed for Out of Box Experience
	echo.  [07] %C_Cortana% Cortana, StartMenu ^& Settings Search App ^| Depends on: Speech Recognition
	echo.  [08] %C_Edge% Edge Classic Browser
	echo.  [09] %C_EdgeDevToolsClient% Edge Developer Tools Client ^| Depends on: Edge Classic Browser
	echo.  [10] %C_ECApp% Eye Control App
	echo.  [11] %C_FileExplorer% File Explorer App
	echo.  [12] %C_LockApp% Lockscreen App
	echo.  [13] %C_MapControl% Map Control
	echo.  [14] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [15] %C_OneDrive% OneDrive Desktop Client
	echo.  [16] %C_ParentalControls% Parental Controls
	echo.  [17] %C_PeopleExperienceHost% People Bar
	echo.  [18] %C_QuickAssist% Quick Assist App
	echo.  [19] %C_RetailDemoContent% Retail Demo Content
	echo.  [20] %C_SettingSync% Setting Sync
	echo.  [21] %C_SkypeORTC% Skype ORTC
	echo.  [22] %C_SmartScreen% Smart Screen ^| Depends on: Windows Defender
	echo.  [23] %C_SecureAssessmentBrowser% Take Test App
	echo.  [24] %C_Win32WebViewHost% Win32 Web View Host
	echo.  [25] %C_WindowsDefender% Windows Defender App
	echo.  [26] %C_WindowsMixedReality% Windows Mixed Reality
	echo.  [27] %C_WindowsReaderPDF% Windows Reader ^(PDF^) ^| Depends on: Edge Classic Browser
	echo.  [28] %C_XboxGameCallableUI% Xbox Game Callable UI
	echo.
	echo.  [A]    ËùÓÐÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AssignedAccessLockApp=-"
		set "C_BioEnrollment=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_PPIProjection=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SolitaireCollection=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsStore=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
	)
	if "!MenuChoice!" equ "28" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "27" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "26" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			set "C_3DViewer=-"
			if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "25" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_SmartScreen=-"
            set "C_WindowsStore=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "24" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "22" (
		if "%C_SmartScreen%" equ "+" ( 
			set "C_SmartScreen=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "21" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "17" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "16" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "13" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "12" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "09" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "08" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "07" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else ( 
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "06" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)

	goto :RemoveSystemAppsMenu
)

:: Remove Windows 10 v1903/v1909 Client Edition System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AssignedAccessLockApp% Assigned Access Lock App ^| Depends on: Assigned Access
	echo.  [02] %C_AADBrokerPlugin% Azure Active Directory AppX Broker Plugin
	echo.  [03] %C_BioEnrollment% Bio Enrollment App
	echo.  [04] %C_CallingShellApp% Calling Shell App
	echo.  [05] %C_CBSPreview% Camera Barcode Scanner
	echo.  [06] %C_PPIProjection% Connect App
	echo.  [07] %C_ContentDeliveryManager% Content Delivery Manager ^| Needed for Out of Box Experience
	echo.  [08] %C_Cortana% Cortana, StartMenu ^& Settings Search App ^| Depends on: Speech Recognition
	echo.  [09] %C_Edge% Edge Classic Browser
	echo.  [10] %C_EdgeDevToolsClient% Edge Developer Tools Client ^| Depends on: Edge Classic Browser
	echo.  [11] %C_ECApp% Eye Control App
	echo.  [12] %C_FileExplorer% File Explorer App
	echo.  [13] %C_LockApp% Lockscreen App
	echo.  [14] %C_MapControl% Map Control
	echo.  [15] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [16] %C_OneDrive% OneDrive Desktop Client
	echo.  [17] %C_ParentalControls% Parental Controls
	echo.  [18] %C_PeopleExperienceHost% People Bar
	echo.  [19] %C_QuickAssist% Quick Assist App
	echo.  [20] %C_RetailDemoContent% Retail Demo Content
	echo.  [21] %C_SettingSync% Setting Sync
	echo.  [22] %C_SkypeORTC% Skype ORTC
	echo.  [23] %C_SmartScreen% Smart Screen ^| Depends on: Windows Defender
	echo.  [24] %C_SecureAssessmentBrowser% Take Test App
	echo.  [25] %C_Win32WebViewHost% Win32 Web View Host
	echo.  [26] %C_WindowsDefender% Windows Defender App
	echo.  [27] %C_WindowsMixedReality% Windows Mixed Reality
	echo.  [28] %C_WindowsReaderPDF% Windows Reader ^(PDF^) ^| Depends on: Edge Classic Browser
	echo.  [29] %C_XboxGameCallableUI% Xbox Game Callable UI
	echo.
	echo.  [A]    ËùÓÐÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_AADBrokerPlugin=-"
		set "C_AssignedAccessLockApp=-"
		set "C_BioEnrollment=-"
		set "C_CallingShellApp=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_Cortana=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_ParentalControls=-"
		set "C_PeopleExperienceHost=-"
		set "C_PPIProjection=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_SkypeORTC=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
	)

	if "!MenuChoice!" equ "29" ( if "%C_XboxGameCallableUI%" equ "+" ( set "C_XboxGameCallableUI=-" ) else ( set "C_XboxGameCallableUI=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_WindowsReaderPDF%" equ "+" ( set "C_WindowsReaderPDF=-" ) else ( set "C_WindowsReaderPDF=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_WindowsMixedReality%" equ "+" ( set "C_WindowsMixedReality=-" ) else ( set "C_WindowsMixedReality=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_WindowsDefender%" equ "+" ( set "C_WindowsDefender=-" ) else ( set "C_WindowsDefender=+" ) )
	if "!MenuChoice!" equ "25" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_SmartScreen%" equ "+" ( set "C_SmartScreen=-" ) else ( set "C_SmartScreen=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_PeopleExperienceHost%" equ "+" ( set "C_PeopleExperienceHost=-" ) else ( set "C_PeopleExperienceHost=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_MapControl%" equ "+" ( set "C_MapControl=-" ) else ( set "C_MapControl=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "12" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "11" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_EdgeDevToolsClient%" equ "+" ( set "C_EdgeDevToolsClient=-" ) else ( set "C_EdgeDevToolsClient=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_Edge%" equ "+" ( set "C_Edge=-" ) else ( set "C_Edge=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_Cortana%" equ "+" ( set "C_Cortana=-" ) else ( set "C_Cortana=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_PPIProjection%" equ "+" ( set "C_PPIProjection=-" ) else ( set "C_PPIProjection=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_CallingShellApp%" equ "+" ( set "CallingShellApp=-" ) else ( set "CallingShellApp=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "01" ( if "%C_AssignedAccessLockApp%" equ "+" ( set "C_AssignedAccessLockApp=-" ) else ( set "C_AssignedAccessLockApp=+" ) )

	goto :RemoveSystemAppsMenu
)

:: Remove Windows 10 v2004/v20H2 Client Edition System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AssignedAccessLockApp% Assigned Access Lock App ^| Depends on: Assigned Access
	echo.  [02] %C_AADBrokerPlugin% Azure Active Directory AppX Broker Plugin
	echo.  [03] %C_BioEnrollment% Bio Enrollment App
	echo.  [04] %C_CallingShellApp% Calling Shell App
	echo.  [05] %C_CBSPreview% Camera Barcode Scanner
	echo.  [06] %C_ContentDeliveryManager% Content Delivery Manager ^| Needed for Out of Box Experience
	echo.  [07] %C_Edge% Edge Classic Browser
	echo.  [08] %C_EdgeDevToolsClient% Edge Developer Tools Client ^| Depends on: Edge Classic Browser
	echo.  [09] %C_ECApp% Eye Control App
	echo.  [10] %C_FileExplorer% File Explorer App
	echo.  [11] %C_LockApp% Lockscreen App
	echo.  [12] %C_MapControl% Map Control
	echo.  [13] %C_NarratorQuickStart% Narrator QuickStart
	echo.  [14] %C_OneDrive% OneDrive Desktop Client
	echo.  [15] %C_ParentalControls% Parental Controls
	echo.  [16] %C_PeopleExperienceHost% People Bar
	echo.  [17] %C_QuickAssist% Quick Assist App
	echo.  [18] %C_RetailDemoContent% Retail Demo Content
	echo.  [19] %C_SettingSync% Setting Sync
	echo.  [20] %C_SkypeORTC% Skype ORTC
	echo.  [21] %C_SmartScreen% Smart Screen ^| Depends on: Windows Defender
	echo.  [22] %C_SecureAssessmentBrowser% Take Test App
	echo.  [23] %C_Win32WebViewHost% Win32 Web View Host
	echo.  [24] %C_WindowsDefender% Windows Defender App
	echo.  [25] %C_WindowsMixedReality% Windows Mixed Reality
	echo.  [26] %C_WindowsReaderPDF% Windows Reader ^(PDF^) ^| Depends on: Edge Classic Browser
	echo.  [27] %C_XboxGameCallableUI% Xbox Game Callable UI
	echo.
	echo.  [A]    ËùÓÐÏµÍ³Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AADBrokerPlugin=-"
		set "C_AssignedAccessLockApp=-"
		set "C_BioEnrollment=-"
		set "C_CallingShellApp=-"
		set "C_CBSPreview=-"
		set "C_ContentDeliveryManager=-"
		set "C_ECApp=-"
		set "C_Edge=-"
		set "C_EdgeDevToolsClient=-"
		set "C_FileExplorer=-"
		set "C_LockApp=-"
		set "C_MapControl=-"
		set "C_Maps=-"
		if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
		set "C_NarratorQuickStart=-"
		set "C_OneDrive=-"
		set "C_ParentalControls=-"
		set "C_People=-"
		set "C_PeopleExperienceHost=-"
		set "C_QuickAssist=-"
		set "C_RetailDemoContent=-"
		set "C_SecureAssessmentBrowser=-"
		set "C_SecurityCenter=-"
		set "C_SettingSync=-"
		set "C_StickyNotes=-"
		set "C_SkypeORTC=-"
		set "C_SolitaireCollection=-"
		set "C_SmartScreen=-"
		set "C_Win32WebViewHost=-"
		set "C_WindowsDefender=-"
		set "C_WindowsMixedReality=-"
		set "C_WindowsStore=-"
		set "C_WindowsReaderPDF=-"
		set "C_XboxGameCallableUI=-"
	)

	if "!MenuChoice!" equ "27" (
		if "%C_XboxGameCallableUI%" equ "+" ( 
			set "C_SolitaireCollection=-"
			set "C_XboxGameCallableUI=-"
		) else (
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "26" (
		if "%C_WindowsReaderPDF%" equ "+" ( 
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
			set "C_WindowsReaderPDF=+"
		)
	)
	if "!MenuChoice!" equ "25" (
		if "%C_WindowsMixedReality%" equ "+" ( 
			set "C_3DViewer=-"
			if "%ImageArchitecture%" equ "x64" set "C_MixedRealityPortal=-"
			set "C_WindowsMixedReality=-"
		) else ( 
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "24" (
		if "%C_WindowsDefender%" equ "+" ( 
			set "C_SecurityCenter=-"
			set "C_SmartScreen=-"
			set "C_StickyNotes=-"
            set "C_WindowsStore=-"
			set "C_WindowsDefender=-"
		) else ( 
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "23" ( if "%C_Win32WebViewHost%" equ "+" ( set "C_Win32WebViewHost=-" ) else ( set "C_Win32WebViewHost=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_SecureAssessmentBrowser%" equ "+" ( set "C_SecureAssessmentBrowser=-" ) else ( set "C_SecureAssessmentBrowser=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_SmartScreen%" equ "+" ( 
			set "C_SmartScreen=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "20" ( if "%C_SkypeORTC%" equ "+" ( set "C_SkypeORTC=-" ) else ( set "C_SkypeORTC=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_SettingSync%" equ "+" ( set "C_SettingSync=-" ) else ( set "C_SettingSync=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_RetailDemoContent%" equ "+" ( set "C_RetailDemoContent=-" ) else ( set "C_RetailDemoContent=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_QuickAssist%" equ "+" ( set "C_QuickAssist=-" ) else ( set "C_QuickAssist=+" ) )
	if "!MenuChoice!" equ "16" (
		if "%C_PeopleExperienceHost%" equ "+" ( 
			set "C_People=-"
			set "C_PeopleExperienceHost=-"
		) else (
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "15" ( if "%C_ParentalControls%" equ "+" ( set "C_ParentalControls=-" ) else ( set "C_ParentalControls=+" ) )
	if "!MenuChoice!" equ "14" ( if "%C_OneDrive%" equ "+" ( set "C_OneDrive=-" ) else ( set "C_OneDrive=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_NarratorQuickStart%" equ "+" ( set "C_NarratorQuickStart=-" ) else ( set "C_NarratorQuickStart=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_MapControl%" equ "+" ( 
			set "C_MapControl=-"
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_LockApp%" equ "+" ( set "C_LockApp=-" ) else ( set "C_LockApp=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_FileExplorer%" equ "+" ( set "C_FileExplorer=-" ) else ( set "C_FileExplorer=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_ECApp%" equ "+" ( set "C_ECApp=-" ) else ( set "C_ECApp=+" ) )
	if "!MenuChoice!" equ "08" (
		if "%C_EdgeDevToolsClient%" equ "+" ( 
			set "C_EdgeDevToolsClient=-"
		) else (
			set "C_Edge=+"
			set "C_EdgeDevToolsClient=+"
		)
	)
	if "!MenuChoice!" equ "07" (
		if "%C_Edge%" equ "+" ( 
			set "C_Edge=-"
			set "C_EdgeDevToolsClient=-"
			set "C_WindowsReaderPDF=-"
		) else (
			set "C_Edge=+"
		)
	)
	if "!MenuChoice!" equ "06" ( if "%C_ContentDeliveryManager%" equ "+" ( set "C_ContentDeliveryManager=-" ) else ( set "C_ContentDeliveryManager=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_CBSPreview%" equ "+" ( set "C_CBSPreview=-" ) else ( set "C_CBSPreview=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_CallingShellApp%" equ "+" ( set "CallingShellApp=-" ) else ( set "CallingShellApp=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_BioEnrollment%" equ "+" ( set "C_BioEnrollment=-" ) else ( set "C_BioEnrollment=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_AADBrokerPlugin%" equ "+" ( set "C_AADBrokerPlugin=-" ) else ( set "C_AADBrokerPlugin=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AssignedAccessLockApp%" equ "+" ( 
			set "C_AssignedAccessLockApp=-"
		) else ( 
			set "C_AssignedAccess=+"
			set "C_AssignedAccessLockApp=+"
		)
	)

	goto :RemoveSystemAppsMenu
)

:RemoveWindowsAppsMenu
:: Remove Windows 10 v1809 Client Enterprise LTSC 2019 Client System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseS" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1] %C_WindowsStore% Windows Store ºó¶Ë
	echo.
	echo.  [2] %C_XboxApp% Xbox App ºó¶Ë
	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 :SelectWindowsComponentsMenu
	if errorlevel 2 ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if errorlevel 1 ( if "%C_WindowsStore%" equ "+" ( set "C_WindowsStore=-" ) else ( set "C_WindowsStore=+" ) )
)

:: Remove Windows 10 v1809 Client Enterprise N LTSC 2019 Client System Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageFlag%" equ "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ýÏµÍ³Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1] %C_WindowsStore% Windows Store ºó¶Ë
	echo.
	echo.  [2] %C_XboxApp% Xbox App ºó¶Ë
	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 :SelectWindowsComponentsMenu
	if errorlevel 2 ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if errorlevel 1 ( if "%C_WindowsStore%" equ "+" ( set "C_WindowsStore=-" ) else ( set "C_WindowsStore=+" ) )
)

:: Remove Windows 10 v1809/v1903/v1909 Client 32-Bit Client Windows Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x86" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ý Windows Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AdvertisingXaml% Advertising Xaml
	echo.  [02] %C_Alarms% Alarms ^& Clock App
	echo.  [03] %C_Calculator% Calculator App
	echo.  [04] %C_Camera% Camera App
	echo.  [05] %C_DesktopAppInstaller% Desktop App Installer
	echo.  [06] %C_FeedbackHub% Feedback Hub App
	echo.  [07] %C_ZuneVideo% Films ^& TV App
	echo.  [08] %C_GetHelp% Get Help App
	echo.  [09] %C_VP9VideoExtensions% Google's VP9 WebM Video Codec Plugin
	echo.  [10] %C_ZuneMusic% Groove Music App
	echo.  [11] %C_HEIFImageExtension% High Efficiency Image File ^(HEIF^) Codec Plugin
	echo.  [12] %C_Maps% Maps App ^| Depends on: Map Control
	echo.  [13] %C_Messaging% Messaging App
	echo.  [14] %C_WalletService% Microsoft Pay App
	echo.  [15] %C_3DViewer% Mixed Reality Viewer App ^| Depends on: Windows Mixed Reality
	echo.  [16] %C_OneConnect% Mobile Plans App
	echo.  [17] %C_OfficeHub% My Office App
	echo.  [18] %C_OfficeOneNote% OneNote App
	echo.  [19] %C_Paint3D% Paint 3D App
	echo.  [20] %C_People% People App ^| Depends on: People Bar
	echo.  [21] %C_Photos% Photos App
	echo.  [22] %C_Print3D% Print 3D App
	echo.  [23] %C_ScreenSketch% Screen Sketch App
	echo.  [24] %C_SkypeApp% Skype App
	echo.  [25] %C_SolitaireCollection% Solitaire Collection App ^| Depends on: Xbox Game Callable UI
	if "%ImageBuild%" equ "17763" echo.  [26] %C_StickyNotes% Sticky Notes App
	if "%ImageBuild%" neq "17763" echo.  [26] %C_StickyNotes% Sticky Notes App ^| Depends on: Windows Store
	echo.  [27] %C_Getstarted% Tips App
	echo.  [28] %C_SoundRecorder% Voice Recorder App
	echo.  [29] %C_BingWeather% Weather App ^| Depends on: Advertising Xaml
	echo.  [30] %C_WebMediaExtensions% Web Media Codec Plugin
	echo.  [31] %C_WebpImageExtensions% WebP Image Codec Plugin
	echo.  [32] %C_CommunicationsApps% Windows Mail App ^| Depends on: Advertising Xaml
	echo.  [33] %C_WindowsStore% Windows Store ^| Depends on: Smart Screen
	echo.  [34] %C_XboxApp% Xbox App
	echo.  [35] %C_XboxIdentityProvider% Xbox Identity Provider
	echo.  [36] %C_YourPhone% Your Phone App
	echo.
	echo.  [A]    ËùÓÐ Windows Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_Messaging=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_OneConnect=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_Print3D=-"
		set "C_ScreenSketch=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtensions=-"
		set "C_WindowsStore=-"
		set "C_XboxApp=-"
		set "C_XboxIdentityProvider=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if "!MenuChoice!" equ "36" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "35" ( if "%C_XboxIdentityProvider%" equ "+" ( set "C_XboxIdentityProvider=-" ) else ( set "C_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if "!MenuChoice!" equ "33" (
		if "%C_WindowsStore%" equ "+" ( 
            set "C_StickyNotes=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsStore=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "32" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "31" ( if "%C_WebpImageExtensions%" equ "+" ( set "C_WebpImageExtensions=-" ) else ( set "C_WebpImageExtensions=+" ) )
	if "!MenuChoice!" equ "30" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "29" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "28" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "27" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "26" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsDefender=+"
			set "C_WindowsStore=+"
		)
	)
	if "!MenuChoice!" equ "25" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "24" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_Print3D%" equ "+" ( set "C_Print3D=-" ) else ( set "C_Print3D=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "20" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "19" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_OneConnect%" equ "+" ( set "C_OneConnect=-" ) else ( set "C_OneConnect=+" ) )
	if "!MenuChoice!" equ "15" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_Messaging%" equ "+" ( set "C_Messaging=-" ) else ( set "C_Messaging=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)
)

:: Remove Windows 10 v1809/v1903/v1909 Client Non Enterprise (N) LTSC 2019 64-Bit Client Windows Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "18363" if "%ImageArchitecture%" equ "x64" if "%ImageFlag%" neq "EnterpriseS" if "%ImageFlag%" neq "EnterpriseSN" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ý Windows Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AdvertisingXaml% Advertising Xaml
	echo.  [02] %C_Alarms% Alarms ^& Clock App
	echo.  [03] %C_Calculator% Calculator App
	echo.  [04] %C_Camera% Camera App
	echo.  [05] %C_DesktopAppInstaller% Desktop App Installer
	echo.  [06] %C_FeedbackHub% Feedback Hub App
	echo.  [07] %C_ZuneVideo% Films ^& TV App
	echo.  [08] %C_GetHelp% Get Help App
	echo.  [09] %C_VP9VideoExtensions% Google's VP9 WebM Video Codec Plugin
	echo.  [10] %C_ZuneMusic% Groove Music App
	echo.  [11] %C_HEIFImageExtension% High Efficiency Image File ^(HEIF^) Codec Plugin
	echo.  [12] %C_Maps% Maps App ^| Depends on: Map Control
	echo.  [13] %C_Messaging% Messaging App
	echo.  [14] %C_WalletService% Microsoft Pay App
	echo.  [15] %C_MixedRealityPortal% Mixed Reality Portal App ^| Depends on: Windows Mixed Reality
	echo.  [16] %C_3DViewer% Mixed Reality Viewer App ^| Depends on: Windows Mixed Reality
	echo.  [17] %C_OneConnect% Mobile Plans App
	echo.  [18] %C_OfficeHub% My Office App
	echo.  [19] %C_OfficeOneNote% OneNote App
	echo.  [20] %C_Paint3D% Paint 3D App
	echo.  [21] %C_People% People App ^| Depends on: People Bar
	echo.  [22] %C_Photos% Photos App
	echo.  [23] %C_Print3D% Print 3D App
	echo.  [24] %C_ScreenSketch% Screen Sketch App
	echo.  [25] %C_SkypeApp% Skype App
	echo.  [26] %C_SolitaireCollection% Solitaire Collection App ^| Depends on: Xbox Game Callable UI
	if "%ImageBuild%" equ "17763" echo.  [27] %C_StickyNotes% Sticky Notes App
	if "%ImageBuild%" neq "17763" echo.  [27] %C_StickyNotes% Sticky Notes App ^| Depends on: Windows Store
	echo.  [28] %C_Getstarted% Tips App
	echo.  [29] %C_SoundRecorder% Voice Recorder App
	echo.  [30] %C_BingWeather% Weather App ^| Depends on: Advertising Xaml
	echo.  [31] %C_WebMediaExtensions% Web Media Codec Plugin
	echo.  [32] %C_WebpImageExtensions% WebP Image Codec Plugin
	echo.  [33] %C_CommunicationsApps% Windows Mail App ^| Depends on: Advertising Xaml
	echo.  [34] %C_WindowsStore% Windows Store ^| Depends on: Smart Screen
	echo.  [35] %C_XboxApp% Xbox App
	echo.  [36] %C_XboxIdentityProvider% Xbox Identity Provider
	echo.  [37] %C_YourPhone% Your Phone App
	echo.
	echo.  [A]    ËùÓÐ Windows Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_Messaging=-"
		set "C_MixedRealityPortal=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_OneConnect=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_Print3D=-"
		set "C_ScreenSketch=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtensions=-"
		set "C_WindowsStore=-"
		set "C_XboxApp=-"
		set "C_XboxIdentityProvider=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if "!MenuChoice!" equ "37" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "36" ( if "%C_XboxIdentityProvider%" equ "+" ( set "C_XboxIdentityProvider=-" ) else ( set "C_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "35" ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if "!MenuChoice!" equ "34" (
		if "%C_WindowsStore%" equ "+" ( 
            set "C_StickyNotes=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsStore=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "33" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "32" ( if "%C_WebpImageExtensions%" equ "+" ( set "C_WebpImageExtensions=-" ) else ( set "C_WebpImageExtensions=+" ) )
	if "!MenuChoice!" equ "31" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "30" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "29" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "27" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsDefender=+"
			set "C_WindowsStore=+"
		)
	)
	if "!MenuChoice!" equ "26" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "25" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "24" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "23" ( if "%C_Print3D%" equ "+" ( set "C_Print3D=-" ) else ( set "C_Print3D=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "21" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "20" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "19" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OneConnect%" equ "+" ( set "C_OneConnect=-" ) else ( set "C_OneConnect=+" ) )
	if "!MenuChoice!" equ "16" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "15" (
		if "%C_MixedRealityPortal%" equ "+" ( 
			set "C_MixedRealityPortal=-"
		) else ( 
			set "C_MixedRealityPortal=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_Messaging%" equ "+" ( set "C_Messaging=-" ) else ( set "C_Messaging=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "05" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)
)

:: Remove Windows 10 v2004/v20H2 32-Bit Client Windows Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageArchitecture%" equ "x86" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ý Windows Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AdvertisingXaml% Advertising Xaml
	echo.  [02] %C_Alarms% Alarms ^& Clock App
	echo.  [03] %C_Calculator% Calculator App
	echo.  [04] %C_Camera% Camera App
	echo.  [05] %C_Cortana% Cortana App ^| Depends on: Speech Recognition
	echo.  [06] %C_DesktopAppInstaller% Desktop App Installer
	echo.  [07] %C_FeedbackHub% Feedback Hub App
	echo.  [08] %C_GetHelp% Get Help App
	echo.  [09] %C_VP9VideoExtensions% Google's VP9 WebM Video Codec Plugin
	echo.  [10] %C_ZuneMusic% Groove Music App
	echo.  [11] %C_HEIFImageExtension% High Efficiency Image File ^(HEIF^) Codec Plugin
	echo.  [12] %C_Maps% Maps App ^| Depends on: Map Control
	echo.  [13] %C_WalletService% Microsoft Pay App
	echo.  [14] %C_3DViewer% Mixed Reality Viewer App ^| Depends on: Windows Mixed Reality
	echo.  [15] %C_ZuneVideo% Films ^& TV App
	echo.  [16] %C_OfficeHub% My Office App
	echo.  [17] %C_OfficeOneNote% OneNote App
	echo.  [18] %C_Paint3D% Paint 3D App
	echo.  [19] %C_People% People App ^| Depends on: People Bar
	echo.  [20] %C_Photos% Photos App
	echo.  [21] %C_ScreenSketch% Screen Sketch App
	echo.  [22] %C_SkypeApp% Skype App
	echo.  [23] %C_SolitaireCollection% Solitaire Collection App ^| Depends on: Xbox Game Callable UI
	echo.  [24] %C_StickyNotes% Sticky Notes App ^| Depends on: Windows Store
	echo.  [25] %C_Getstarted% Tips App
	echo.  [26] %C_SoundRecorder% Voice Recorder App
	echo.  [27] %C_BingWeather% Weather App ^| Depends on: Advertising Xaml
	echo.  [28] %C_WebMediaExtensions% Web Media Codec Plugin
	echo.  [29] %C_WebpImageExtensions% WebP Image Codec Plugin
	echo.  [30] %C_CommunicationsApps% Windows Mail App ^| Depends on: Advertising Xaml
	echo.  [31] %C_WindowsStore% Windows Store ^| Depends on: Smart Screen
	echo.  [32] %C_XboxApp% Xbox App
	echo.  [33] %C_XboxIdentityProvider% Xbox Identity Provider
	echo.  [34] %C_YourPhone% Your Phone App
	echo.
	echo.  [A]    ËùÓÐ Windows Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_ScreenSketch=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtensions=-"
		set "C_WindowsStore=-"
		set "C_XboxApp=-"
		set "C_XboxIdentityProvider=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if "!MenuChoice!" equ "34" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "33" ( if "%C_XboxIdentityProvider%" equ "+" ( set "C_XboxIdentityProvider=-" ) else ( set "C_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "32" ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if "!MenuChoice!" equ "31" (
		if "%C_WindowsStore%" equ "+" ( 
            set "C_StickyNotes=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsStore=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "30" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "29" ( if "%C_WebpImageExtensions%" equ "+" ( set "C_WebpImageExtensions=-" ) else ( set "C_WebpImageExtensions=+" ) )
	if "!MenuChoice!" equ "28" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "27" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "26" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "25" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "24" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsDefender=+"
			set "C_WindowsStore=+"
		)
	)
	if "!MenuChoice!" equ "23" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "22" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "20" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "19" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "18" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "15" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "14" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "13" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "05" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else (
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)
)

:: Remove Windows 10 v2004/v20H2 64-Bit Client Windows Apps Menu
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19042" if "%ImageArchitecture%" equ "x64" (
	cls
	echo.===============================================================================
	echo.                  MSMG ToolKit - É¾³ý Windows Ó¦ÓÃ³ÌÐò²Ëµ¥
	echo.===============================================================================
	echo.  [01] %C_AdvertisingXaml% Advertising Xaml
	echo.  [02] %C_Alarms% Alarms ^& Clock App
	echo.  [03] %C_Calculator% Calculator App
	echo.  [04] %C_Camera% Camera App
	echo.  [05] %C_Cortana% Cortana App ^| Depends on: Speech Recognition
	echo.  [06] %C_DesktopAppInstaller% Desktop App Installer
	echo.  [07] %C_FeedbackHub% Feedback Hub App
	echo.  [08] %C_GetHelp% Get Help App
	echo.  [09] %C_VP9VideoExtensions% Google's VP9 WebM Video Codec Plugin
	echo.  [10] %C_ZuneMusic% Groove Music App
	echo.  [11] %C_HEIFImageExtension% High Efficiency Image File ^(HEIF^) Codec Plugin
	echo.  [12] %C_Maps% Maps App ^| Depends on: Map Control
	echo.  [13] %C_WalletService% Microsoft Pay App
	echo.  [14] %C_MixedRealityPortal% Mixed Reality Portal App ^| Depends on: Windows Mixed Reality
	echo.  [15] %C_3DViewer% Mixed Reality Viewer App ^| Depends on: Windows Mixed Reality
	echo.  [16] %C_ZuneVideo% Films ^& TV App
	echo.  [17] %C_OfficeHub% My Office App
	echo.  [18] %C_OfficeOneNote% OneNote App
	echo.  [19] %C_Paint3D% Paint 3D App
	echo.  [20] %C_People% People App ^| Depends on: People Bar
	echo.  [21] %C_Photos% Photos App
	echo.  [22] %C_ScreenSketch% Screen Sketch App
	echo.  [23] %C_SkypeApp% Skype App
	echo.  [24] %C_SolitaireCollection% Solitaire Collection App ^| Depends on: Xbox Game Callable UI
	echo.  [25] %C_StickyNotes% Sticky Notes App ^| Depends on: Windows Store
	echo.  [26] %C_Getstarted% Tips App
	echo.  [27] %C_SoundRecorder% Voice Recorder App
	echo.  [28] %C_BingWeather% Weather App ^| Depends on: Advertising Xaml
	echo.  [29] %C_WebMediaExtensions% Web Media Codec Plugin
	echo.  [30] %C_WebpImageExtensions% WebP Image Codec Plugin
	echo.  [31] %C_CommunicationsApps% Windows Mail App ^| Depends on: Advertising Xaml
	echo.  [32] %C_WindowsStore% Windows Store ^| Depends on: Smart Screen
	echo.  [33] %C_XboxApp% Xbox App
	echo.  [34] %C_XboxIdentityProvider% Xbox Identity Provider
	echo.  [35] %C_YourPhone% Your Phone App
	echo.
	echo.  [A]    ËùÓÐ Windows Ó¦ÓÃ³ÌÐò
	echo.  [X]    ·µ»Ø
	echo.===============================================================================
	set /p MenuChoice=ÊäÈëÄúµÄÑ¡Ôñ : 

	if /i "!MenuChoice!" equ "X" goto :SelectWindowsComponentsMenu
	if /i "!MenuChoice!" equ "A" (
		set "C_3DViewer=-"
		set "C_AdvertisingXaml=-"
		set "C_Alarms=-"
		set "C_BingWeather=-"
		set "C_Calculator=-"
		set "C_Camera=-"
		set "C_CommunicationsApps=-"
		set "C_Cortana=-"
		set "C_DesktopAppInstaller=-"
		set "C_FeedbackHub=-"
		set "C_GetHelp=-"
		set "C_Getstarted=-"
		set "C_HEIFImageExtension=-"
		set "C_Maps=-"
		set "C_MixedRealityPortal=-"
		set "C_OfficeHub=-"
		set "C_OfficeOneNote=-"
		set "C_Paint3D=-"
		set "C_People=-"
		set "C_Photos=-"
		set "C_ScreenSketch=-"
		set "C_SkypeApp=-"
		set "C_SolitaireCollection=-"
		set "C_SoundRecorder=-"
		set "C_StickyNotes=-"
		set "C_VP9VideoExtensions=-"
		set "C_WalletService=-"
		set "C_WebMediaExtensions=-"
		set "C_WebpImageExtensions=-"
		set "C_WindowsStore=-"
		set "C_XboxApp=-"
		set "C_XboxIdentityProvider=-"
		set "C_YourPhone=-"
		set "C_ZuneMusic=-"
		set "C_ZuneVideo=-"
	)
	if "!MenuChoice!" equ "35" ( if "%C_YourPhone%" equ "+" ( set "C_YourPhone=-" ) else ( set "C_YourPhone=+" ) )
	if "!MenuChoice!" equ "34" ( if "%C_XboxIdentityProvider%" equ "+" ( set "C_XboxIdentityProvider=-" ) else ( set "C_XboxIdentityProvider=+" ) )
	if "!MenuChoice!" equ "33" ( if "%C_XboxApp%" equ "+" ( set "C_XboxApp=-" ) else ( set "C_XboxApp=+" ) )
	if "!MenuChoice!" equ "32" (
		if "%C_WindowsStore%" equ "+" ( 
            set "C_StickyNotes=-"
			set "C_WindowsStore=-"
		) else ( 
			set "C_SmartScreen=+"
			set "C_WindowsStore=+"
			set "C_WindowsDefender=+"
		)
	)
	if "!MenuChoice!" equ "31" (
		if "%C_CommunicationsApps%" equ "+" ( 
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_CommunicationsApps=+"
		)
	)
	if "!MenuChoice!" equ "30" ( if "%C_WebpImageExtensions%" equ "+" ( set "C_WebpImageExtensions=-" ) else ( set "C_WebpImageExtensions=+" ) )
	if "!MenuChoice!" equ "29" ( if "%C_WebMediaExtensions%" equ "+" ( set "C_WebMediaExtensions=-" ) else ( set "C_WebMediaExtensions=+" ) )
	if "!MenuChoice!" equ "28" (
		if "%C_BingWeather%" equ "+" ( 
			set "C_BingWeather=-"
		) else (
			set "C_AdvertisingXaml=+"
			set "C_BingWeather=+"
		)
	)
	if "!MenuChoice!" equ "27" ( if "%C_SoundRecorder%" equ "+" ( set "C_SoundRecorder=-" ) else ( set "C_SoundRecorder=+" ) )
	if "!MenuChoice!" equ "26" ( if "%C_Getstarted%" equ "+" ( set "C_Getstarted=-" ) else ( set "C_Getstarted=+" ) )
	if "!MenuChoice!" equ "25" (
		if "%C_StickyNotes%" equ "+" ( 
			set "C_StickyNotes=-"
		) else (
			set "C_StickyNotes=+"
			set "C_WindowsDefender=+"
			set "C_WindowsStore=+"
		)
	)
	if "!MenuChoice!" equ "24" (
		if "%C_SolitaireCollection%" equ "+" ( 
			set "C_SolitaireCollection=-"
		) else (
			set "C_SolitaireCollection=+"
			set "C_XboxGameCallableUI=+"
		)
	)
	if "!MenuChoice!" equ "23" ( if "%C_SkypeApp%" equ "+" ( set "C_SkypeApp=-" ) else ( set "C_SkypeApp=+" ) )
	if "!MenuChoice!" equ "22" ( if "%C_ScreenSketch%" equ "+" ( set "C_ScreenSketch=-" ) else ( set "C_ScreenSketch=+" ) )
	if "!MenuChoice!" equ "21" ( if "%C_Photos%" equ "+" ( set "C_Photos=-" ) else ( set "C_Photos=+" ) )
	if "!MenuChoice!" equ "20" (
		if "%C_People%" equ "+" ( 
			set "C_People=-"
		) else ( 
			set "C_People=+"
			set "C_PeopleExperienceHost=+"
		)
	)
	if "!MenuChoice!" equ "19" ( if "%C_Paint3D%" equ "+" ( set "C_Paint3D=-" ) else ( set "C_Paint3D=+" ) )
	if "!MenuChoice!" equ "18" ( if "%C_OfficeOneNote%" equ "+" ( set "C_OfficeOneNote=-" ) else ( set "C_OfficeOneNote=+" ) )
	if "!MenuChoice!" equ "17" ( if "%C_OfficeHub%" equ "+" ( set "C_OfficeHub=-" ) else ( set "C_OfficeHub=+" ) )
	if "!MenuChoice!" equ "16" ( if "%C_ZuneVideo%" equ "+" ( set "C_ZuneVideo=-" ) else ( set "C_ZuneVideo=+" ) )
	if "!MenuChoice!" equ "15" (
		if "%C_3DViewer%" equ "+" ( 
			set "C_3DViewer=-"
		) else ( 
			set "C_3DViewer=+"
			set "C_WindowsMixedReality=+"
		)
	)
	if "!MenuChoice!" equ "14" ( if "%C_MixedRealityPortal%" equ "+" ( set "C_MixedRealityPortal=-" ) else ( set "C_MixedRealityPortal=+" ) )
	if "!MenuChoice!" equ "13" ( if "%C_WalletService%" equ "+" ( set "C_WalletService=-" ) else ( set "C_WalletService=+" ) )
	if "!MenuChoice!" equ "12" (
		if "%C_Maps%" equ "+" ( 
			set "C_Maps=-"
		) else (
			set "C_MapControl=+"
			set "C_Maps=+"
		)
	)
	if "!MenuChoice!" equ "11" ( if "%C_HEIFImageExtension%" equ "+" ( set "C_HEIFImageExtension=-" ) else ( set "C_HEIFImageExtension=+" ) )
	if "!MenuChoice!" equ "10" ( if "%C_ZuneMusic%" equ "+" ( set "C_ZuneMusic=-" ) else ( set "C_ZuneMusic=+" ) )
	if "!MenuChoice!" equ "09" ( if "%C_VP9VideoExtensions%" equ "+" ( set "C_VP9VideoExtensions=-" ) else ( set "C_VP9VideoExtensions=+" ) )
	if "!MenuChoice!" equ "08" ( if "%C_GetHelp%" equ "+" ( set "C_GetHelp=-" ) else ( set "C_GetHelp=+" ) )
	if "!MenuChoice!" equ "07" ( if "%C_FeedbackHub%" equ "+" ( set "C_FeedbackHub=-" ) else ( set "C_FeedbackHub=+" ) )
	if "!MenuChoice!" equ "06" ( if "%C_DesktopAppInstaller%" equ "+" ( set "C_DesktopAppInstaller=-" ) else ( set "C_DesktopAppInstaller=+" ) )
	if "!MenuChoice!" equ "05" (
		if "%C_Cortana%" equ "+" ( 
			set "C_Cortana=-"
		) else (
			set "C_Cortana=+"
			set "C_SpeechRecognition=+"
		)
	)
	if "!MenuChoice!" equ "04" ( if "%C_Camera%" equ "+" ( set "C_Camera=-" ) else ( set "C_Camera=+" ) )
	if "!MenuChoice!" equ "03" ( if "%C_Calculator%" equ "+" ( set "C_Calculator=-" ) else ( set "C_Calculator=+" ) )
	if "!MenuChoice!" equ "02" ( if "%C_Alarms%" equ "+" ( set "C_Alarms=-" ) else ( set "C_Alarms=+" ) )
	if "!MenuChoice!" equ "01" (
		if "%C_AdvertisingXaml%" equ "+" ( 
			set "C_AdvertisingXaml=-"
			set "C_BingWeather=-"
			set "C_CommunicationsApps=-"
		) else (
			set "C_AdvertisingXaml=+"
		)
	)

	goto :RemoveWindowsAppsMenu
)

:: Returning to É¾³ý Windows ×é¼þ Menu.
goto :SelectWindowsComponentsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to É¾³ý Windows ×é¼þ
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponents

setlocal

set Components=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - É¾³ý Windows ×é¼þ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

:: Set Package Architecture
if "%ImageArchitecture%" equ "x86" set "PackageArchitecture=x86"
if "%ImageArchitecture%" equ "x64" set "PackageArchitecture=amd64"
if "%ImageArchitecture%" equ "arm64" set "PackageArchitecture=arm64"

for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_SnippingTool,C_SpeechRecognition,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WinSAT,C_AssignedAccess,C_CEIP_SQM,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_RemoteAssistance,C_DeviceLockdown,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_ManualSetup,C_Paint,C_SecurityCenter,C_StepsRecorder,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_Wordpad,C_AADBrokerPlugin,C_AssignedAccessLockApp,C_BioEnrollment,C_CallingShellApp,C_CBSPreview,C_ContentDeliveryManager,C_Cortana,C_ECApp,C_EdgeDevToolsClient,C_Edge,C_FileExplorer,C_LockApp,C_MapControl,C_NarratorQuickStart,C_OneDrive,C_ParentalControls,C_PeopleExperienceHost,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SecureAssessmentBrowser,C_SettingSync,C_SkypeORTC,C_SmartScreen,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_XboxGameCallableUI,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingWeather,C_Calculator,C_Camera,C_CommunicationsApps,C_DesktopAppInstaller,C_FeedbackHub,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_People,C_Photos,C_Print3D,C_ScreenSketch,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_VP9VideoExtensions,C_WalletService,C_WebMediaExtensions,C_WebpImageExtensions,C_WindowsStore,C_XboxApp,C_XboxIdentityProvider,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	if "!%%i!" equ "-" (
		for /f "tokens=2 delims=_" %%j in ("%%i") do (
			if "%%i" neq "C_ManualSetup" set Components=!Components!%%j;
		)
	)
)

if "%Components%" equ "" (
	echo.ÉÐÎ´Ñ¡ÔñÒªÉ¾³ýµÄ Windows ×é¼þ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####Starting Removing Windows Components#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================

		:: Removing Windows Components
		%ToolKitHelper% "%InstallMount%\%%i" "%Components%"
	)
)

if "%C_ManualSetup%" equ "Yes" call :RemoveWindowsManualSetup

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÉ¾³ý Windows ×é¼þ#######################################
echo.-------------------------------------------------------------------------------

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

set Components=

endlocal

:: Resetting Components status flags
for %%i in (C_AdobeFlashForWindows,C_EdgeChromium,C_InternetExplorer,C_FirstLogonAnimation,C_GameExplorer,C_SnippingTool,C_SpeechRecognition,C_WindowsMediaPlayer,C_WindowsPhotoViewer,C_WinSAT,C_AssignedAccess,C_CEIP_SQM,C_FaceRecognition,C_KernelDebugging,C_LocationService,C_PicturePassword,C_PinEnrollment,C_UnifiedTelemetryClient,C_WiFiNetworkManager,C_WindowsErrorReporting,C_WindowsInsiderHub,C_HomeGroup,C_MultiPointConnector,C_RemoteAssistance,C_DeviceLockdown,C_EaseOfAccessThemes,C_EasyTransfer,C_FileHistory,C_ManualSetup,C_Paint,C_SecurityCenter,C_StepsRecorder,C_SystemRestore,C_WindowsBackup,C_WindowsFirewall,C_WindowsSubsystemForLinux,C_WindowsToGo,C_Wordpad,C_AADBrokerPlugin,C_AssignedAccessLockApp,C_BioEnrollment,C_CallingShellApp,C_CBSPreview,C_ContentDeliveryManager,C_Cortana,C_ECApp,C_EdgeDevToolsClient,C_Edge,C_FileExplorer,C_LockApp,C_MapControl,C_NarratorQuickStart,C_OneDrive,C_ParentalControls,C_PeopleExperienceHost,C_PPIProjection,C_QuickAssist,C_RetailDemoContent,C_SecureAssessmentBrowser,C_SettingSync,C_SkypeORTC,C_SmartScreen,C_Win32WebViewHost,C_WindowsDefender,C_WindowsMixedReality,C_WindowsReaderPDF,C_XboxGameCallableUI,C_3DViewer,C_AdvertisingXaml,C_Alarms,C_BingWeather,C_Calculator,C_Camera,C_CommunicationsApps,C_DesktopAppInstaller,C_FeedbackHub,C_GetHelp,C_Getstarted,C_HEIFImageExtension,C_Maps,C_Messaging,C_MixedRealityPortal,C_OfficeHub,C_OfficeOneNote,C_OneConnect,C_Paint3D,C_People,C_Photos,C_Print3D,C_ScreenSketch,C_SkypeApp,C_SolitaireCollection,C_SoundRecorder,C_StickyNotes,C_VP9VideoExtensions,C_WalletService,C_WebMediaExtensions,C_WebpImageExtensions,C_WindowsStore,C_XboxApp,C_XboxIdentityProvider,C_YourPhone,C_ZuneMusic,C_ZuneVideo) do (
	set "%%i=+"
)

:: Returning to É¾³ý Windows ×é¼þ Menu.
goto :RemoveWindowsComponentsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Windows Manual Setup Feature
::-------------------------------------------------------------------------------------------
:RemoveWindowsManualSetup

echo.
echo.-------------------------------------------------------------------------------
echo.É¾³ý Windows ÊÖ¶¯°²×°¹¦ÄÜ...
echo.-------------------------------------------------------------------------------
echo.

:: Removing Windows Manual Setup Feature files and folders
echo.ÇëÉÔºò£¬ÕýÔÚÉ¾³ý Windows ÊÖ¶¯°²×°ÎÄ¼þ ^& ÎÄ¼þ¼Ð...

call :RemoveFile "%DVD%\autorun.inf"
call :RemoveFile "%DVD%\setup.exe"
call :RemoveFile "%DVD%\*.dll"
call :RemoveFolder "%DVD%\ca"
call :RemoveFolder "%DVD%\NanoServer"
call :RemoveFolder "%DVD%\support"
call :RemoveFolder "%DVD%\upgrade"
call :RemoveFolder "%DVD%\sources\dlmanifests"
call :RemoveFolder "%DVD%\sources\etwproviders"
call :RemoveFolder "%DVD%\sources\inf"
call :RemoveFolder "%DVD%\sources\hwcompat"
call :RemoveFolder "%DVD%\sources\migration"
call :RemoveFolder "%DVD%\sources\replacementmanifests"
call :RemoveFolder "%DVD%\sources\servicing"
call :RemoveFolder "%DVD%\sources\servicingstackmisc"
call :RemoveFolder "%DVD%\sources\sxs"
call :RemoveFolder "%DVD%\sources\uup"
call :RemoveFolder "%DVD%\sources\vista"
call :RemoveFolder "%DVD%\sources\xp"

if exist "%DVD%\sources\%ImageDefaultLanguage%\setup.exe.mui" move /y "%DVD%\sources\%ImageDefaultLanguage%\setup.exe.mui" "%DVD%" >nul
if exist "%DVD%\sources\EI.CFG" move /y "%DVD%\sources\EI.CFG" "%DVD%" >nul
if exist "%DVD%\sources\*.clg" move /y "%DVD%\sources\*.clg" "%DVD%" >nul
if exist "%DVD%\sources\gatherosstate.exe" move /y "%DVD%\sources\gatherosstate.exe" "%DVD%" >nul
if exist "%DVD%\sources\setup.exe" move /y "%DVD%\sources\setup.exe" "%DVD%" >nul
if exist "%DVD%\sources\lang.ini" move /y "%DVD%\sources\lang.ini" "%DVD%" >nul
if exist "%DVD%\sources\pid.txt" move /y "%DVD%\sources\pid.txt" "%DVD%" >nul

call :RemoveFile "%DVD%\sources\%ImageDefaultLanguage%\*.adml"
call :RemoveFile "%DVD%\sources\%ImageDefaultLanguage%\*.mui"
call :RemoveFile "%DVD%\sources\%ImageDefaultLanguage%\*.rtf"
call :RemoveFile "%DVD%\sources\%ImageDefaultLanguage%\*.txt"
call :RemoveFile "%DVD%\sources\*.dll"
call :RemoveFile "%DVD%\sources\*.gif"
call :RemoveFile "%DVD%\sources\*.xsl"
call :RemoveFile "%DVD%\sources\*.bmp"
call :RemoveFile "%DVD%\sources\*.hiv"
call :RemoveFile "%DVD%\sources\*.mof"
call :RemoveFile "%DVD%\sources\*.ini"
call :RemoveFile "%DVD%\sources\*.cer"
call :RemoveFile "%DVD%\sources\*.exe"
call :RemoveFile "%DVD%\sources\*.sdb"
call :RemoveFile "%DVD%\sources\*.txt"
call :RemoveFile "%DVD%\sources\*.nls"
call :RemoveFile "%DVD%\sources\*.xml"
call :RemoveFile "%DVD%\sources\*.cat"
call :RemoveFile "%DVD%\sources\*.inf"
call :RemoveFile "%DVD%\sources\*.sys"
call :RemoveFile "%DVD%\sources\*.bin"
call :RemoveFile "%DVD%\sources\*.ait"
call :RemoveFile "%DVD%\sources\*.admx"
call :RemoveFile "%DVD%\sources\*.dat"
call :RemoveFile "%DVD%\sources\*.ttf"
call :RemoveFile "%DVD%\sources\*.cfg"
call :RemoveFile "%DVD%\sources\*.xsd"
call :RemoveFile "%DVD%\sources\*.rtf"
call :RemoveFile "%DVD%\sources\*.xrm-ms"

if exist "%DVD%\setup.exe.mui" move /y "%DVD%\setup.exe.mui" "%DVD%\sources\%ImageDefaultLanguage%" >nul
if exist "%DVD%\EI.CFG" move /y "%DVD%\EI.CFG" "%DVD%\sources" >nul
if exist "%DVD%\*.clg" move /y "%DVD%\*.clg" "%DVD%\sources" >nul
if exist "%DVD%\gatherosstate.exe" move /y "%DVD%\gatherosstate.exe" "%DVD%\sources" >nul
if exist "%DVD%\setup.exe" move /y "%DVD%\setup.exe" "%DVD%\sources" >nul
if exist "%DVD%\lang.ini" move /y "%DVD%\lang.ini" "%DVD%\sources" >nul
if exist "%DVD%\pid.txt" move /y "%DVD%\pid.txt" "%DVD%\sources" >nul
echo.
echo.Íê³ÉÉ¾³ý£¬Windows ÊÖ¶¯°²×°ÎÄ¼þ ^& ÎÄ¼þ¼Ð...
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
::-------------------------------------------------------------------------------------------
:RemoveWindowsAppsList

setlocal

set "RemoveAppsList=%Lists%\RemoveAppsList.txt"

cls
echo.===============================================================================
echo.          MSMG ToolKit - Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####Starting Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÉ¾³ý Windows Ó¦ÓÃ³ÌÐò###############################
echo.-------------------------------------------------------------------------------
echo.
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		for /f %%z IN ('"type %RemoveAppsList%" 2^>nul') do (
			call :RemoveProvisionedAppxPackage "%InstallMount%\%%i", %%z, %%z

			if "%%z" equ "Microsoft.3DBuilder" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Print with 3D Builder option from right click context menu
				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" (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing Edit with Paint 3D Option from right click context menu
				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"  (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Objects Section from Windows Explorer Navigation Pane
				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"  (
				:: Mounting Image Registry
				call :MountImageRegistry "%InstallMount%\%%i"

				:: Removing 3D Objects Section from Windows Explorer Navigation Pane
				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.####Ê¹ÓÃÓ¦ÓÃ³ÌÐòÁÐ±íÍê³É Windows Ó¦ÓÃ³ÌÐòµÄÉ¾³ý#############################
echo.-------------------------------------------------------------------------------

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

set RemoveAppsList=

endlocal

:: Returning to Remove Menu.
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
::-------------------------------------------------------------------------------------------
:RemoveWindowsComponentsList

if "%IsDialogsEnabled%" equ "Yes" (
	cls
	echo.===============================================================================
	echo.          MSMG ToolKit - Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
	echo.===============================================================================
	echo.
	echo.
	echo.
	echo.                                W A R N I N G
	echo.                                =============
	echo.
	echo.   Removing the packages without proper testing can break the OS and or it's
	echo.   functionalities.
	echo.
	echo.   When adding packages to the RemovePkgsList.txt, only add the parent package
	echo.   names excluding it's language packages or sub-packages.
	echo.
	echo.
	if "%SelectedSourceOS%" neq "w10" echo.
	if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" lss "17763" echo.
	if "%SelectedSourceOS%" equ "w10"  if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" echo.   E.g: WindowsDefender ^(ToolKitHelper.exe Method^)
	echo.   E.g: Windows-Defender-Client-Package ^(DISM Method^)
	echo.
	echo.   Òª¹Ø±Õ¾¯¸æ¶Ô»°¿ò£¬ÇëÔÚ¡°¹¤¾ß¡±->¡°Ñ¡Ïî¡±²Ëµ¥ÖÐÑ¡Ôñ¡°½ûÓÃ¶Ô»°¿ò¡±¡£
	echo.
	echo.===============================================================================
	echo.
	choice /C:YN /N /M "ÄãÒª¼ÌÐøÂð? ['Y'es/'N'o] : "
	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%" equ "w10"  if "%ImageBuild%" geq "17763" if "%ImageBuild%" leq "19042" (
	cls
	echo.===============================================================================
	echo.      MSMG ToolKit - Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ²Ëµ¥
	echo.===============================================================================
	echo.
	echo.  [1]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ ^(DISM Method^)
	echo.
	echo.  [2]   Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ ^(ToolKitHelper Method^)
	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 ToolKit - Ê¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Ê¹ÓÃ³ÌÐò°üÁÐ±íÉ¾³ý Windows ×é¼þ####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		if "%RemovalMethod%" == "DISM" (
			for /f %%z IN ('"type %RemovePkgsList%" 2^>nul') do (
				call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z
			)
		)

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

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÊ¹ÓÃÈí¼þ°üÁÐ±íÉ¾³ý Windows ×é¼þ####################
echo.-------------------------------------------------------------------------------

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

set RemovePkgsList=
set RemovalMethod=

endlocal

:: Returning to Remove Menu.
goto :RemoveMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Enable Windows Features Using Features List
::-------------------------------------------------------------------------------------------
:EnableFeatures

setlocal

set "FeaturesList=%Lists%\EnableFeaturesList.txt"

cls
echo.===============================================================================
echo.        MSMG ToolKit - Ê¹ÓÃ¹¦ÄÜÁÐ±íÆôÓÃ Windows ¹¦ÄÜ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####Ê¹ÓÃ¹¦ÄÜÁÐ±í¿ªÊ¼ÆôÓÃ Windows ¹¦ÄÜ#####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.ÆôÓÃ Windows ¹¦ÄÜ - [%%z]...
			echo.-------------------------------------------------------------------------------
			call :EnableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÊ¹ÓÃ¹¦ÄÜÁÐ±íÆôÓÃ Windows ¹¦ÄÜ#####################
echo.-------------------------------------------------------------------------------

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

set FeaturesList=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Disable Windows Features Using Features List
::-------------------------------------------------------------------------------------------
:DisableFeatures

setlocal

set "FeaturesList=%Lists%\DisableFeaturesList.txt"

cls
echo.===============================================================================
echo.        MSMG ToolKit - Ê¹ÓÃ¹¦ÄÜÁÐ±í½ûÓÃ Windows ¹¦ÄÜ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Ê¹ÓÃ¹¦ÄÜÁÐ±í½ûÓÃ Windows ¹¦ÄÜ####################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.

		for /f %%z IN ('"type %FeaturesList%" 2^>nul') do (
			echo.-------------------------------------------------------------------------------
			echo.Disabling Windows Feature - [%%z]...
			echo.-------------------------------------------------------------------------------
			call :DisableFeature "%InstallMount%\%%i" %%z
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÊ¹ÓÃ¹¦ÄÜÁÐ±í½ûÓÃ Windows ¹¦ÄÜ####################
echo.-------------------------------------------------------------------------------

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

set FeaturesList=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Associations from XML File
::-------------------------------------------------------------------------------------------
:ImportMetroAppsAssociation

setlocal

set "CustomAppsAssociationXML=%XMLs%\%SelectedSourceOS%_CustomAppsAssociation.xml"

cls
echo.===============================================================================
echo.  MSMG ToolKit - ´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨ÒåÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨ÒåÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª####
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨ÒåÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª#############
echo.-------------------------------------------------------------------------------

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

		call :ImportDefaultAppAssociations "%InstallMount%\%%i", "%CustomAppsAssociationXML%"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨ÒåÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª####
echo.-------------------------------------------------------------------------------

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

set CustomAppsAssociationXML=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Export Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Associations to XML File
::-------------------------------------------------------------------------------------------
:ExportMetroAppsAssociation

setlocal

set "DefaultMetroAppsAssociationXML=%XMLs%\%SelectedSourceOS%_DefaultAppsAssociation.xml"

cls
echo.===============================================================================
echo.      MSMG ToolKit - µ¼ÈëÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªµ½ XML ÎÄ¼þ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼µ¼ÈëÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªµ½ XML ÎÄ¼þ#############
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####¼ì²éÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
		if errorlevel 1 (
			echo.²éÕÒÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª XML ÎÄ¼þ...
			echo.
			echo.-------------------------------------------------------------------------------
			echo.µ¼ÈëÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªµ½ XML ÎÄ¼þ...
			echo.-------------------------------------------------------------------------------
			echo.
			call :RemoveFile "%DefaultMetroAppsAssociationXML%"
			%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr "<" >> "%DefaultMetroAppsAssociationXML%"
			echo.
			echo.-------------------------------------------------------------------------------
			echo.####Íê³Éµ¼ÈëÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªµ½ XML ÎÄ¼þ#############
			echo.-------------------------------------------------------------------------------
			goto :Stop
		)
		if not errorlevel 1 (
			echo.Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò ¹ØÁªÎª¿Õ...
			echo.
			echo.-------------------------------------------------------------------------------
			echo.####Í£Ö¹µ¼ÈëÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªµ½ XML ÎÄ¼þ##############
			echo.-------------------------------------------------------------------------------
			goto :Stop
		)
	)
)

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

set DefaultMetroAppsAssociationXML=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Remove Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò Association
::-------------------------------------------------------------------------------------------
:RemoveMetroAppsAssociation

setlocal

cls
echo.===============================================================================
echo.            MSMG ToolKit - É¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼É¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª###########################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.-------------------------------------------------------------------------------
		echo.¼ì²éÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª...
		echo.-------------------------------------------------------------------------------
		echo.
		%DISM% /Image:"%InstallMount%\%%i" /Get-DefaultAppAssociations | findstr /c:"file could not be" >nul
		if errorlevel 1 (
			echo.²éÕÒÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª XML ÎÄ¼þ¡£
			echo.
			echo.-------------------------------------------------------------------------------
			echo.É¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª...
			echo.-------------------------------------------------------------------------------
			call :RemoveDefaultAppAssociations "%InstallMount%\%%i"
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####Íê³ÉÉ¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª###########################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		) else (
			echo.Ä¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁªÒÑ±»É¾³ý¡£
			echo.
			echo.Ìø¹ýÉ¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª¡£
			echo.
			if "%%i" equ "%ImageCount%" (
				echo.-------------------------------------------------------------------------------
				echo.####Í£Ö¹É¾³ýÄ¬ÈÏ Metro Ó¦ÓÃ³ÌÐò¹ØÁª############################
				echo.-------------------------------------------------------------------------------
				echo.
			)
		)
	)
)

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

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom StartMenu Layout from XML File
::-------------------------------------------------------------------------------------------
:ImportStartMenuLayout

setlocal

set "CustomStartMenuLayoutXML=%XMLs%\%SelectedSourceOS%_CustomStartMenuLayout.xml"

cls
echo.===============================================================================
echo.        MSMG ToolKit - ´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨Òå StartMenu ²¼¾Ö
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨Òå StartMenu ²¼¾Ö###################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨Òå StartMenu ²¼¾Ö############################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.¸´ÖÆ×Ô¶¨Òå StartMenu ²¼¾Ö...
		copy %CustomStartMenuLayoutXML% "%InstallMount%\%%i\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml" >nul
		call :RemoveFolder "%InstallMount%\%%i\Users\Default\AppData\Local\TileDataLayer"
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É´Ó XML ÎÄ¼þµ¼Èë×Ô¶¨Òå StartMenu ²¼¾Ö###################
echo.-------------------------------------------------------------------------------

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

set CustomStartMenuLayoutXML=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Import Custom Registry Settings from Registry File
::-------------------------------------------------------------------------------------------
:ImportCustomRegistry

setlocal

cls
echo.===============================================================================
echo.     MSMG ToolKit - ´Ó×¢²á±íÎÄ¼þµ¼Èë×Ô¶¨Òå×¢²á±íÉèÖÃ
echo.===============================================================================
echo.

:: Getting Install Image Index Architecture
for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" call :GetImageArchitecture "%InstallWim%", %%i >nul
)

set "CustomRegistry=%CustomRegistry%\%SelectedSourceOS%\%ImageArchitecture%"

:: Checking whether Custom Registry Settings Pack folder is empty
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.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
echo.####´¦Àí×Ô¶¨Òå×¢²á±íÉèÖÃÎÄ¼þ##################################
echo.-------------------------------------------------------------------------------
echo.
echo.Ê¹×Ô¶¨Òå×¢²á±íÓë ToolKit µÄÓ³Ïñ×¢²á±í¼æÈÝ...
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, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.

		for /f "tokens=*" %%z in ('"dir /b "%Temp%\CustomRegistry\*.reg"" 2^>nul') do (
			echo.Importing [%%z] to Image Registry...
			call :ImportRegistry2Image "%Temp%\CustomRegistry\%%z"
		)

		echo.
		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

call :RemoveFolder "%Temp%\CustomRegistry"
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É´Ó×¢²á±íÎÄ¼þµ¼Èë×Ô¶¨Òå×¢²á±íÉèÖÃ#############
echo.-------------------------------------------------------------------------------

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

set CustomRegistry=

endlocal

:: Returning to Customize Menu
goto :CustomizeMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply Tweaks Menu
::-------------------------------------------------------------------------------------------
:ApplyTweaksMenu

setlocal

set Tweak=

cls
echo.===============================================================================
echo.                      MSMG ToolKit - Ó¦ÓÃµ÷Õû²Ëµ¥
echo.===============================================================================
echo.

if "%SelectedSourceOS%" equ "w81" (
	echo.  [A]   Í¨¹ý Windows Update ½ûÓÃ×Ô¶¯Çý¶¯³ÌÐò¸üÐÂ
	echo.  [B]   ½ûÓÃ ×Ô¶¯ÏÂÔØºÍ°²×°µÚÈý·½Ó¦ÓÃ³ÌÐò
	echo.  [C]   ½ûÓÃ Windows Defender
	echo.  [D]   ½ûÓÃ Windows SmartScreen
	echo.  [E]   ½ûÓÃ Windows ×Ô¶¯Éý¼¶
	echo.  [F]   ½ûÓÃ Windows ¸üÐÂ
	echo.  [G]   Ç¿ÖÆ .NET ³ÌÐòÊ¹ÓÃ×îÐÂµÄ .NET Framework
	echo.  [H]   ÆôÓÃ Windows ÕÕÆ¬²é¿´Æ÷
	echo.  [I]   ÆôÓÃ Fraunhofer MP3 Professional ±à½âÂëÆ÷
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 10 goto :CustomizeMenu
	if errorlevel 9  set "Tweak=EnableFMP3ProCodec"
	if errorlevel 8  set "Tweak=EnablePhotoViewer"
	if errorlevel 7  set "Tweak=ForceLatestNetFramework"
	if errorlevel 6  set "Tweak=DisableWindowsUpdate"
	if errorlevel 5  set "Tweak=DisableWindowsUpgrade"
	if errorlevel 4  set "Tweak=DisableWindowsSmartScreen"
	if errorlevel 3  set "Tweak=DisableWindowsDefender"
	if errorlevel 2  set "Tweak=Disable3RDPartyApps"
	if errorlevel 1  set "Tweak=DisableDriversUpdates"
)

if "%SelectedSourceOS%" equ "w10" (
	echo.  [A]   ½ûÓÃ Cortana Ó¦ÓÃ
	echo.  [B]   Òþ²ØÈÎÎñÀ¸ TaskView Í¼±ê
	echo.  [C]   Í¨¹ý Windows Update ½ûÓÃ×Ô¶¯Çý¶¯³ÌÐò¸üÐÂ
	echo.  [D]   ½ûÓÃ ×Ô¶¯ÏÂÔØºÍ°²×°µÚÈý·½Ó¦ÓÃ³ÌÐò
	echo.  [E]   ½ûÓÃ Windows Defender
	echo.  [F]   ½ûÓÃ Windows SmartScreen
	echo.  [G]   ½ûÓÃ Windows ×Ô¶¯Éý¼¶
	echo.  [H]   ½ûÓÃ Windows ¸üÐÂ
	echo.  [I]   ½ûÓÃ Microsoft ±£ÁôµÄ Windows ¸üÐÂ´æ´¢¿Õ¼ä
	echo.  [J]   Ç¿ÖÆ .NET ³ÌÐòÊ¹ÓÃ×îÐÂµÄ .NET Framework
	echo.  [K]   ÆôÓÃ Windows ÕÕÆ¬²é¿´Æ÷
	echo.  [L]   ÆôÓÃ Fraunhofer MP3 Professional ±à½âÂëÆ÷
	echo.  [M]   Ê¹ÓÃÍêÕû ResetBase ÆôÓÃ DISM Ó³ÏñÇåÀí
	echo.
	echo.
	echo.  [X]   ·µ»Ø
	echo.
	echo.===============================================================================
	echo.
	choice /C:ABCDEFGHIJKLMX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
	if errorlevel 14 goto :CustomizeMenu
	if errorlevel 13 set "Tweak=EnableFullResetBase"
	if errorlevel 12 set "Tweak=EnableFMP3ProCodec"
	if errorlevel 11 set "Tweak=EnablePhotoViewer"
	if errorlevel 10 set "Tweak=ForceLatestNetFramework"
	if errorlevel 9  set "Tweak=DisableReservedStorage"
	if errorlevel 8  set "Tweak=DisableWindowsUpdate"
	if errorlevel 7  set "Tweak=DisableWindowsUpgrade"
	if errorlevel 6  set "Tweak=DisableWindowsSmartScreen"
	if errorlevel 5  set "Tweak=DisableWindowsDefender"
	if errorlevel 4  set "Tweak=Disable3RDPartyApps"
	if errorlevel 3  set "Tweak=DisableDriversUpdates"
	if errorlevel 2  set "Tweak=HideTaskViewIcon"
	if errorlevel 1  set "Tweak=DisableCortanaApp"
)

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Ó¦ÓÃµ÷Õû
echo.===============================================================================
echo.
:: Getting Install Image Index Architecture
if /i "%ImageIndexNo%" equ "A" call :GetImageArchitecture "%InstallWim%", 1 >nul
if /i "%ImageIndexNo%" neq "A" call :GetImageArchitecture "%InstallWim%", %ImageIndexNo% >nul

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Ó¦ÓÃµ÷Õû###################################################
echo.-------------------------------------------------------------------------------
echo.
echo.    Image                    : Install.wim
if /i "%ImageIndexNo%" equ "A" echo.    Image Indexes            : 1-%ImageCount%
if /i "%ImageIndexNo%" neq "A" echo.    Image Index              : %ImageIndexNo%
echo.    Image Architecture       : %ImageArchitecture%
echo.    Image Version            : %ImageVersion%.%ImageServicePackBuild%.%ImageServicePackLevel%
echo.
echo.-------------------------------------------------------------------------------
if "%Tweak%" equ "Disable3RDPartyApps" echo.####Ó¦ÓÃ½ûÓÃÏÂÔØºÍ°²×° 3rd Party Apps µÄµ÷Õû###########
if "%Tweak%" equ "DisableCortanaApp" echo.####Ó¦ÓÃ½ûÓÃ Cortana App µ÷Õû#########################################
if "%Tweak%" equ "DisableDriversUpdates" echo.####Í¨¹ý Windows Update µ÷ÕûÓ¦ÓÃ½ûÓÃ×Ô¶¯Çý¶¯³ÌÐò¸üÐÂ#####
if "%Tweak%" equ "DisableReservedStorage" echo.####½«½ûÓÃµÄ Microsoft ±£ÁôµÄ´æ´¢¿Õ¼äÓ¦ÓÃÓÚ Windows ¸üÐÂ######
if "%Tweak%" equ "DisableWindowsDefender" echo.####Ó¦ÓÃ½ûÓÃ Windows Defender µ÷Õû####################################
if "%Tweak%" equ "DisableWindowsUpdate" echo.####Ó¦ÓÃ½ûÓÃ Windows Update µ÷Õû######################################
if "%Tweak%" equ "DisableWindowsUpgrade" echo.####Ó¦ÓÃ½ûÓÃ×Ô¶¯ Windows OS Éý¼¶µ÷Õû########################
if "%Tweak%" equ "EnableFMP3ProCodec" echo.####Ó¦ÓÃÆôÓÃ Fraunhofer MP3 Professional ±à½âÂëÆ÷µ÷Õû####################
if "%Tweak%" equ "EnableFullResetBase" echo.####Í¨¹ýÍêÕû ResetBase µ÷ÕûÓ¦ÓÃÆôÓÃ DISM Ó³ÏñÇåÀí###############
if "%Tweak%" equ "EnablePhotoViewer" echo.####Ó¦ÓÃÆôÓÃ Windows Photo Viewer µ÷Õû#################################
if "%Tweak%" equ "ForceLatestNetFramework" echo.####Ó¦ÓÃÇ¿ÖÆ .NET ³ÌÐòÒÔÊ¹ÓÃ×îÐÂµÄ .NET Framework µ÷Õû############
if "%Tweak%" equ "HideTaskViewIcon" echo.####Ó¦ÓÃÒþ²ØÈÎÎñÀ¸ TaskView Í¼±êµ÷Õû##################################
echo.-------------------------------------------------------------------------------

for /l %%i in (1, 1, %ImageCount%) do (
	if exist "%InstallMount%\%%i" (
		echo.
		if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================
		if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================
		echo.
		echo.°²×°Ó³Ïñ×¢²á±í...
		call :MountImageRegistry "%InstallMount%\%%i"
		echo.µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í...

        if "%Tweak%" equ "DisableCortanaApp" (
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Policies\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" /v "EnableCortana" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitInkCollection" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization" /v "RestrictImplicitTextCollection" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" /v "HarvestContacts" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Personalization\Settings" /v "AcceptedPrivacyPolicy" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "DeviceHistoryEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "HistoryViewEnabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaConsent" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaceable" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "CortanaIsReplaced" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Windows Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\AboveLock" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\PolicyManager\current\device\Experience" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\InputPersonalization" /v "AllowInputPersonalization" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCloudSearch" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowSearchToUseLocation" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchPrivacy" /t REG_DWORD /d "3" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchSafeSearch" /t REG_DWORD /d "3" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWeb" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "ConnectedSearchUseWebOverMeteredConnections" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "DisableWebSearch" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Wow6432Node\Microsoft\Windows\Windows Search" /v "AllowCortanaAboveLock" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana ActionUriServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana Package" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana PlacesServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersServer.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana RemindersShareTargetApp.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" /v "Block Cortana SearchUI.exe" /t REG_SZ /d "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" /f >nul 2>&1
        )

        if "%Tweak%" equ "HideTaskViewIcon" Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d "0" /f >nul

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

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

        if "%Tweak%" equ "DisableWindowsDefender" (
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows Security Health\State" /v "AccountProtection_MicrosoftAccount_Disconnected" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_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 Security Center\Notifications" /v "DisableNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /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" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /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 "SubmitSamplesConsent" /t REG_DWORD /d "2" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f >nul 2>&1
        )

        if "%Tweak%" equ "DisableWindowsSmartScreen" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f >nul 2>&1

        if "%Tweak%" equ "DisableWindowsUpgrade" (
	        if "%SelectedSourceOS%" neq "w10" (
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\Gwx" /v "DisableGwx" /t REG_DWORD /d "1" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DisableOSUpgrade" /t REG_DWORD /d "1" /f >nul
	        )

    	    if "%SelectedSourceOS%" equ "w10" (
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferUpdatePeriod" /t REG_DWORD /d "0" /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" >nul 2>&1
		    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "TargetReleaseVersionInfo" /t REG_SZ /d "%ImageBuild%" >nul 2>&1
	        )
        )

        if "%Tweak%" equ "DisableWindowsUpdate" (
	    	Reg add "HKLM\TK_DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_NTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "SystemSettingsDownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Speech_OneCore\Preferences" /v "ModelDownloadAllowed" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /v "OptInOOBE" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "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\WindowsUpdate\UX\Settings" /v "HideMCTLink" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Speech" /v "AllowSpeechModelUpdate" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "0" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /t REG_DWORD /d "63" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "AUOptions" /t REG_DWORD /d "2" /f >nul 2>&1
	    	Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d "1" /f >nul 2>&1
	    	Reg add "HKLM\TK_SYSTEM\ControlSet001\Services\wuauserv" /v "Start" /t REG_DWORD /d "4" /f >nul 2>&1
        )

        if "%Tweak%" equ "DisableReservedStorage" Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "ShippedWithReserves" /t REG_DWORD /d "0" /f >nul
        if "%Tweak%" equ "ForceLatestNetFramework" Reg add "HKLM\TK_SOFTWARE\Microsoft\.NETFramework" /v "OnlyUseLatestCLR" /t REG_DWORD /d "1" /f >nul

        if "%Tweak%" equ "EnablePhotoViewer" (
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "emffile_.emf" /t REG_DWORD /d "0" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "rlefile_.rle" /t REG_DWORD /d "0" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" /v "wmffile_.wmf" /t REG_DWORD /d "0" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "GlobalAssocChangedCounter" /t REG_DWORD /d "13" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "TDU75KWAGi4=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "hAQpLYJfRYE=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "1in4hcmDrB4=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "Y5upkzp3g5E=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "ZIeqfdrNtFk=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "iVWM3EAePKw=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "Xq9gH4jXoFM=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ahz7f/Yl09M=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "Evm7jp++AWA=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "wEj9gLqtYH4=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "/r2V12Yryig=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "a" /t REG_SZ /d "PhotoViewer.dll" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\OpenWithList" /v "MRUList" /t REG_SZ /d "a" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "/qcrPB0bhuI=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "Hash" /t REG_SZ /d "rEigxhAPyos=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "Hash" /t REG_SZ /d "R60f5QZs3Hg=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.dib\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "Hash" /t REG_SZ /d "YcQO9pssSPU=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.gif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "Hash" /t REG_SZ /d "5yjvWKb+Jns=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jfif\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "Hash" /t REG_SZ /d "TujD2rCi+po=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpe\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "Hash" /t REG_SZ /d "wdZ9wQI4vW8=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "Hash" /t REG_SZ /d "3xY0V0JOiFc=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "Hash" /t REG_SZ /d "ENXEd5Uzg84=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jxr\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "Hash" /t REG_SZ /d "SPesrUKrIFE=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "Hash" /t REG_SZ /d "bCXQRSAHD/I=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "Hash" /t REG_SZ /d "7F/LfjhVnes=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" /v "ProgId" /t REG_SZ /d "TIFImage.Document" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "Hash" /t REG_SZ /d "tu0JqOen+Es=" /f >nul
	    	Reg add "HKLM\TK_NTUSER\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.wdp\UserChoice" /v "ProgId" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open" /v "MuiVerb" /t REG_SZ /d "@photoviewer.dll,-3043" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\Applications\photoviewer.dll\shell\print\DropTarget" /v "Clsid" /t REG_SZ /d "{60fd46de-f830-4894-a628-6fa81bc0190d}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3056" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-70" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-83" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Gif\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.JFIF\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3055" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-72" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3057" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-71" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Png\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll,-3058" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\imageres.dll,-122" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Tiff\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "EditFlags" /t REG_DWORD /d "65536" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp" /v "ImageOptionFlags" /t REG_DWORD /d "1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\DefaultIcon" /ve /t REG_SZ /d "%%SystemRoot%%\System32\wmphoto.dll,-400" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open" /v "MuiVerb" /t REG_EXPAND_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3043" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\rundll32.exe \"%%ProgramFiles%%\Windows Photo Viewer\PhotoViewer.dll\", ImageView_Fullscreen %%1" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Classes\PhotoViewer.FileAssoc.Wdp\shell\open\DropTarget" /v "Clsid" /t REG_SZ /d "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3069" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" /v "ApplicationName" /t REG_SZ /d "@%%ProgramFiles%%\Windows Photo Viewer\photoviewer.dll,-3009" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".bmp" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".dib" /t REG_SZ /d "PhotoViewer.FileAssoc.Bitmap" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".gif" /t REG_SZ /d "PhotoViewer.FileAssoc.Gif" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jfif" /t REG_SZ /d "PhotoViewer.FileAssoc.JFIF" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpe" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpeg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_SZ /d "PhotoViewer.FileAssoc.Jpeg" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jxr" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".png" /t REG_SZ /d "PhotoViewer.FileAssoc.Png" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tif" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".tiff" /t REG_SZ /d "PhotoViewer.FileAssoc.Tiff" /f >nul
	    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".wdp" /t REG_SZ /d "PhotoViewer.FileAssoc.Wdp" /f >nul
        )

        if "%Tweak%" equ "EnableFMP3ProCodec" (
	        if "%ImageArchitecture%" equ "x86" (
		    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
		    	Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
	        )

	        if "%ImageArchitecture%" equ "x64" (
		    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\System32\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\l3codecp.acm" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /v "%%SystemRoot%%\SysWOW64\l3codecp.acm" /t REG_SZ /d "Fraunhofer IIS MPEG Layer-3 Codec (Professional)" /f >nul
		    	Reg add "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Drivers32" /v "msacm.l3acm" /t REG_EXPAND_SZ /d "%%SystemRoot%%\SysWOW64\l3codecp.acm" /f >nul
		    	Reg delete "HKLM\TK_SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc" /f >nul 2>&1
		    	Reg delete "HKLM\TK_SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc" /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

		echo.½â³ý°²×°Ó³Ïñ×¢²á±í...
		call :UnMountImageRegistry
	)
)

echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÓ¦ÓÃµ÷Õû###################################################
echo.-------------------------------------------------------------------------------

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

set Tweaks=

endlocal

:: Returning to Apply Tweaks Menu
goto :ApplyTweaksMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Cleanup Source Images
::-------------------------------------------------------------------------------------------
:CleanupSource

cls
echo.===============================================================================
echo.   MSMG ToolKit - Ê¹ÓÃ×é¼þÇåÀí ^& ResetBase ÇåÀíÀ´Ô´Ó³Ïñ
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Ê¹ÓÃ×é¼þÇåÀí ^& ResetBase ÇåÀíÀ´Ô´Ó³Ïñ######
echo.-------------------------------------------------------------------------------
echo.
if "%IsBootImageSelected%" equ "Yes" (
	:: Performing [Boot.wim, Index : 1 and 2] Image Component Cleanup with ResetBase Option
	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" (
		:: Performing [Install.wim] Image Component Clean-Up with ResetBase Option
		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" (
			:: Performing [WinRE.wim] Image Component Cleanup with ResetBase Option
			echo.-------------------------------------------------------------------------------
			echo.Ö´ÐÐ [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³Ïñ×é¼þÇåÀí...
			echo.-------------------------------------------------------------------------------
			call :CleanupImage "%WinReMount%\%%i", "ComponentCleanupResetBase"
		)
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÊ¹ÓÃ×é¼þÇåÀí ^& ResetBase ÇåÀíÀ´Ô´Ó³Ïñ######
echo.-------------------------------------------------------------------------------
echo.

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

:: Returning to Apply Menu
goto :ApplyMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply, Save and Optimize Changes to the Source Images
::-------------------------------------------------------------------------------------------
:SaveSource

setlocal

set TrimEditions=No

cls
echo.===============================================================================
echo.         MSMG ToolKit - Ó¦ÓÃ ^& ±£´æ¸ü¸Äµ½À´Ô´Ó³Ïñ
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Ó¦ÓÃ ^& ±£´æ¸ü¸Äµ½À´Ô´Ó³Ïñ########################
echo.-------------------------------------------------------------------------------
echo.
if /i "%ImageIndexNo%" neq "A" if %ImageCount% neq 1 (
	choice /C:YN /N /M "ÊÇ·ñÒªÐÞ¼ôÎ´Ñ¡ÔñµÄÓ³Ïñ°æ±¾? ['Y'es/'N'o] : "
	if errorlevel 1 set "TrimEditions=Yes"
	echo.
)

choice /C:YN /N /M "ÄúÊÇ·ñÒªÇåÀíÓ³Ïñ Windows ÎÄ¼þ¼Ð? ['Y'es/'N'o] : "
echo.
if %errorlevel% equ 1 (
	echo.-------------------------------------------------------------------------------
	echo.ÇåÀíÓ³Ïñ Windows ÎÄ¼þ¼Ð...
	echo.-------------------------------------------------------------------------------
	echo.
	echo.ÇåÀíÓ³Ïñ Windows ÁÙÊ±ÎÄ¼þºÍÈÕÖ¾ÎÄ¼þ»òÎÄ¼þ¼Ð¡£
	:: Performing [Boot.wim, Index : 1 and 2] Image Windows folder cleanup
	if "%IsBootImageSelected%" equ "Yes" (
		for /l %%i in (1, 1, 2) do (
			if exist "%BootMount%\%%i\Windows\inf\*.log" del /f /q "%BootMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%BootMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%BootMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%i >nul 2>&1)
				del /s /f /q "%BootMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%BootMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%BootMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%BootMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Backup\*.*" del /f /q "%BootMount%\Windows\WinSxS\Backup\*.*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%BootMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
			if exist "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%BootMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
		)
	)

	for /l %%i in (1, 1, %ImageCount%) do (
		:: Performing [Install.wim] Image Windows folder cleanup
		if exist "%InstallMount%\%%i" (
			if exist "%InstallMount%\%%i\$Recycle.Bin" rd /q /s "%InstallMount%\%%i\$Recycle.Bin" >nul 2>&1
			if exist "%InstallMount%\%%i\PerfLogs" rd /q /s "%InstallMount%\%%i\PerfLogs" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\inf\*.log" del /f /q "%InstallMount%\%%i\Windows\inf\*.log" >nul 2>&1

			if exist "%InstallMount%\%%i\Windows\CbsTemp\*" (
				for /f %%i in ('"dir /s /b /ad "%InstallMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%i >nul 2>&1)
				del /s /f /q "%InstallMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
			)

			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%InstallMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
			if exist "%InstallMount%\%%i\Windows\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

			:: Performing [WinRE.wim, Index : 1] Image Windows folder cleanup
			if "%IsRecoveryImageSelected%" equ "Yes" (
				if exist "%WinReMount%\%%i\Windows\inf\*.log" del /f /q "%WinReMount%\%%i\Windows\inf\*.log" >nul 2>&1

				if exist "%WinReMount%\%%i\Windows\CbsTemp\*" (
					for /f %%j in ('"dir /s /b /ad "%WinReMount%\%%i\Windows\CbsTemp\*"" 2^>nul') do (rd /q /s %%j >nul 2>&1)
					del /s /f /q "%WinReMount%\%%i\Windows\CbsTemp\*" >nul 2>&1
				)

				if exist "%WinReMount%\%%i\Windows\System32\config\*.LOG1" del /f /q "%WinReMount%\%%i\Windows\System32\config\*.LOG1" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\System32\config\*.LOG2" del /f /q "%WinReMount%\%%i\Windows\System32\config\*.LOG2" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\System32\config\*.TM.blf" del /f /q "%WinReMount%\%%i\Windows\System32\config\*.TM.blf" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\System32\config\*.regtrans-ms" del /f /q "%WinReMount%\%%i\Windows\System32\config\*.regtrans-ms" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\WinSxS\Backup\*.*" del /f /q "%WinReMount%\%%i\Windows\WinSxS\Backup\*.*" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" del /f /q "%WinReMount%\%%i\Windows\WinSxS\ManifestCache\*.bin" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" del /f /q "%WinReMount%\%%i\Windows\WinSxS\Temp\PendingDeletes\*" >nul 2>&1
				if exist "%WinReMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" del /s /f /q "%WinReMount%\%%i\Windows\WinSxS\Temp\TransformerRollbackData\*" >nul 2>&1
			)
		)
	)
	echo.
)

:: Saving & Un-Mounting Source Boot Images
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.Ó¦ÓÃ¸ü¸Ä ^& È¡Ïû¹ÒÔØ [Boot.wim, Index : %%i] Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Commit"
		call :RemoveFolder "%BootMount%\%%i"
	)
)

:: Re-Building Source Boot Image with Maximum Compression.
echo.-------------------------------------------------------------------------------
echo.Ê¹ÓÃ×î´óÑ¹ËõÓÅ»¯À´Ô´ [Boot.wim] Ó³Ïñ...
echo.-------------------------------------------------------------------------------
call :ExportImage "%BootWim%", "%Temp%\rebuild.wim", "WIM", "No"
move /y "%Temp%\rebuild.wim" "%BootWim%" >nul

:: Saving & Un-Mounting Source Install & Recovery Images
for /l %%i in (1, 1, %ImageCount%) do (
   if exist "%InstallMount%\%%i" (
		if "%IsRecoveryImageSelected%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			echo.Ó¦ÓÃ¸ü¸Ä ^& È¡Ïû¹ÒÔØ [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :UnMountImage "%WinReMount%\%%i", "Commit"
			call :RemoveFolder "%WinReMount%\%%i"

			:: Re-Building Source Recovery Image with Maximum Compression.
			echo.-------------------------------------------------------------------------------
			echo.Optimizing Source [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :ExportImage "%InstallMount%\%%i\%WinReWim%", "%Temp%\rebuild.wim", "WIM", "No"
			move /y "%Temp%\rebuild.wim" "%InstallMount%\%%i\%WinReWim%" >nul
		)

		echo.-------------------------------------------------------------------------------
		echo.Ó¦ÓÃ¸ü¸Ä ^& È¡Ïû¹ÒÔØ [Install.wim, Ë÷Òý : %%i] Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Commit"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)

:: Re-Building Source Install Image with Maximum Compression.
echo.-------------------------------------------------------------------------------
echo.Ê¹ÓÃ×î´óÑ¹ËõÓÅ»¯À´Ô´ [Install.wim] Ó³Ïñ...
echo.-------------------------------------------------------------------------------

if "%TrimEditions%" equ "Yes" (
	for %%i in (%ImageIndexNo%) do (
		call :ExportImageIndex "%InstallWim%", %%i, "%Temp%\rebuild.wim", "WIM", "No"
	)
)

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

move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÓ¦ÓÃ ^& ±£´æ¸ü¸Äµ½À´Ô´Ó³Ïñ########################
echo.-------------------------------------------------------------------------------
echo.

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

set TrimEditions=

endlocal

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

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

::-------------------------------------------------------------------------------------------
:: Function to Discard Changes & Unmount Source Images
::-------------------------------------------------------------------------------------------
:DiscardSource

cls
echo.===============================================================================
echo.            MSMG ToolKit - ·ÅÆú¸ü¸Ä ^& Ð¶ÔØÀ´Ô´Ó³Ïñ
echo.===============================================================================
echo.
:: Unmount Image Registry if Mounted
call :UnMountImageRegistry
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼·ÅÆú¸ü¸Ä ^& Ð¶ÔØÀ´Ô´Ó³Ïñ####################
echo.-------------------------------------------------------------------------------
echo.
:: Discarding ^& Un-Mounting Source Boot Images
if "%IsBootImageSelected%" equ "Yes" (
	for /l %%i in (1, 1, 2) do (
		echo.-------------------------------------------------------------------------------
		echo.È¡Ïû¹ÒÔØ [Boot.wim, Index : %%i] Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%BootMount%\%%i", "Discard"
		call :RemoveFolder "%BootMount%\%%i"
	)
)

:: Discarding ^& Un-Mounting Source Install & Recovery Images
for /l %%i in (1, 1, %ImageCount%) do (
   if exist "%InstallMount%\%%i" (
		if "%IsRecoveryImageSelected%" equ "Yes" (
			echo.-------------------------------------------------------------------------------
			echo.È¡Ïû¹ÒÔØ [Install.wim, Ë÷Òý : %%i -^> WinRE.wim] Ó³Ïñ...
			echo.-------------------------------------------------------------------------------
			call :UnMountImage "%WinReMount%\%%i", "Discard"
			call :RemoveFolder "%WinReMount%\%%i"
		)

		echo.-------------------------------------------------------------------------------
		echo.È¡Ïû¹ÒÔØ [Install.wim, Ë÷Òý : %%i] Ó³Ïñ...
		echo.-------------------------------------------------------------------------------
		call :UnMountImage "%InstallMount%\%%i", "Discard"
		call :RemoveFolder "%InstallMount%\%%i"
	)
)
echo.-------------------------------------------------------------------------------
echo.####Íê³É·ÅÆú¸ü¸Ä ^& Ð¶ÔØÀ´Ô´Ó³Ïñ####################
echo.-------------------------------------------------------------------------------
echo.

set IsSourceSelected=No
set IsBootImageSelected=No
set IsRecoveryImageSelected=No
set SelectedSourceOS=

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

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

::-------------------------------------------------------------------------------------------
:: Function to ÖÆ×÷ DVD ISO Ó³Ïñ for Burning to DVD Disc
::-------------------------------------------------------------------------------------------
:MakeISO

setlocal

set "BIOSBoot=%DVD%\boot\etfsboot.com"
set "UEFIBoot=%DVD%\efi\microsoft\boot\efisys.bin"
set ISOLabel=
set ISOFileName=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - ÖÆ×÷ DVD ISO Ó³Ïñ
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Ñ¡ÔñÔ´²Ù×÷ÏµÍ³Ê±ÎÞ·¨Ê¹ÓÃ´Ë¹¦ÄÜ...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BIOSBoot%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" if not exist "%DVD%\sources\*.swm" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

call :CreateFolder "%ISO%"

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¹¹½¨Ò»¸ö DVD ISO Ó³Ïñ##########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ DVD ISO Ó³ÏñÏêÏ¸ÐÅÏ¢##############################################
echo.-------------------------------------------------------------------------------
echo.
:: Getting ISO Label Name
set /p ISOLabel=ÊäÈë ISO ¾í±ê : 
echo.

:: Getting ISO File Name
set /p ISOFileName=ÊäÈë ISO ÎÄ¼þÃû : 
echo.

:: Building a DVD ISO Image for Booting with BIOS/UEFI Systems.
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 -l"%ISOLabel%" "%DVD%" "%ISO%\%ISOFileName%.iso"
)
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¹¹½¨Ò»¸ö DVD ISO Ó³Ïñ##########################################
echo.-------------------------------------------------------------------------------

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

set BIOSBoot=
set UEFIBoot=
set ISOLabel=
set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Burn a DVD ISO Image to DVD Disc
::-------------------------------------------------------------------------------------------
:BurnISO

setlocal

set DvdDrive=
set ISOFileName=

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¿ÌÂ¼ DVD ISO Ó³Ïñµ½ DVD ¹âÅÌ
echo.===============================================================================
echo.

:: Checking whether ISO folder is empty
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.
:: Getting ISO File Name
set /p ISOFileName=ÊäÈë ISO ÎÄ¼þÃû : 
echo.
:: Getting DVD Drive Letter
set /p DvdDrive=ÊäÈë DVD Çý¶¯Æ÷ºÅ : 
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ÌÂ¼ DVD ISO Ó³Ïñµ½ DVD ¹âÅÌ########################################
echo.-------------------------------------------------------------------------------
echo.
echo.¿ÌÂ¼ ISO Ó³ÏñÎÄ¼þ [%ISOFileName%.iso] µ½ DVD Çý¶¯Æ÷ [%DvdDrive%:]...
echo.
%DvdBurn% "%DvdDrive%:" "%ISO%\%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É¿ÌÂ¼ DVD ISO Ó³Ïñµ½ DVD ¹âÅÌ#############################
echo.-------------------------------------------------------------------------------

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

set DvdDrive=
set ISOFileName=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Copy Source Folder to USB Flash Drive
::-------------------------------------------------------------------------------------------
:CopyUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.             MSMG ToolKit - ¸´ÖÆÀ´Ô´ÎÄ¼þ¼Ðµ½ USB ÉÁ´æÇý¶¯Æ÷
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³Ê±ÎÞ·¨Ê¹ÓÃ´Ë¹¦ÄÜ...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë¸´ÖÆ°²×°Ô´ÎÄ¼þo ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¸´ÖÆÀ´Ô´ÎÄ¼þ¼Ðµ½ USB ÉÁ´æÇý¶¯Æ÷##########################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ USB ÉÁ´æÇý¶¯Æ÷Ñ¡Ïî############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.ÁÐ³ö¿ÉÓÃµÄ USB ÉÁ´æÇý¶¯Æ÷...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=ÊäÈë USB ÉÁ´æÇý¶¯Æ÷ÅÌ·û : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####¸´ÖÆÔ´ÎÄ¼þ¼Ðµ½ USB ÉÁ´æÇý¶¯Æ÷###################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.ÕýÔÚ¸´ÖÆÔ´ÎÄ¼þºÍÎÄ¼þ¼Ð£¬ÇëÉÔºò...
echo.-------------------------------------------------------------------------------
echo.
echo.À´Ô´Çý¶¯Æ÷ : "%DVD%"
echo.Ä¿±êÇý¶¯Æ÷ : %USBDriveLetter%
echo.
%XCopy% "%DVD%" %USBDriveLetter% >nul
echo.-------------------------------------------------------------------------------
echo.####Íê³É¸´ÖÆÀ´Ô´ÎÄ¼þ¼Ðµ½ USB ÉÁ´æÇý¶¯Æ÷##########################
echo.-------------------------------------------------------------------------------

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

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Sync Source Boot and °²×°Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷
::-------------------------------------------------------------------------------------------
:SyncUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.     MSMG ToolKit - Í¬²½À´Ô´Òýµ¼ ^& °²×°Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷
echo.===============================================================================
echo.

:: Checking whether Source is Applied
if "%IsSourceSelected%" equ "Yes" (
	echo.Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³Ê±ÎÞ·¨Ê¹ÓÃ´Ë¹¦ÄÜ...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%BootWim%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

:: Checking whether Windows Source DVD folder is empty
if not exist "%InstallWim%" if not exist "%InstallEsd%" (
	echo.Windows °²×°Ô´ÎÄ¼þ¼Ð ^<DVD^> Îª¿Õ...
	echo.
	echo.Çë½«°²×°Ô´ÎÄ¼þ¸´ÖÆµ½ ^<DVD^> ÎÄ¼þ¼Ð...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼Í¬²½´¦ÀíÀ´Ô´Òýµ¼ ^& °²×°Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷###########
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ USB ÉÁ´æÇý¶¯Æ÷Ñ¡Ïî############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.ÁÐ³ö¿ÉÓÃµÄ USB ÉÁ´æÇý¶¯Æ÷...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=ÊäÈë USB ÉÁ´æÇý¶¯Æ÷ÅÌ·û : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"
echo.
echo.-------------------------------------------------------------------------------
echo.####Í¬²½À´Ô´Òýµ¼ ^& °²×°Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷####################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.¸´ÖÆÀ´Ô´Òýµ¼ ^& °²×°Ó³ÏñÎÄ¼þ£¬ÇëÉÔºò...
echo.-------------------------------------------------------------------------------
echo.
echo.Source : ^<\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.Target : ^<%USBDriveLetter%\Sources^>
echo.
call :RemoveFile %USBDriveLetter%\Sources\Boot.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.wim
call :RemoveFile %USBDriveLetter%\Sources\Install.esd

%XCopy% "%DVD%\Sources\boot.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.wim" %XCopy% "%DVD%\Sources\install.wim" %USBDriveLetter%\Sources
if exist "%DVD%\Sources\install.esd" %XCopy% "%DVD%\Sources\install.esd" %USBDriveLetter%\Sources
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÍ¬²½À´Ô´Òýµ¼^& °²×°Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷###########
echo.-------------------------------------------------------------------------------

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

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Burn a ISO Image to USB Flash Drive
::-------------------------------------------------------------------------------------------
:BurnUSB

setlocal

set ISOFileName=
set USBDriveLetter=

cls
echo.===============================================================================
echo.                MSMG ToolKit - ¿ÌÂ¼ ISO Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷
echo.===============================================================================
echo.

:: Checking whether ISO folder is empty
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.
:: Getting ISO File Name
set /p ISOFileName=ÊäÈë ISO ÎÄ¼þÃû : 

:: Setting ISO File Name
set "ISOFileName=%ISOFileName%.iso"
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ USB ÉÁ´æÇý¶¯Æ÷Ñ¡Ïî############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.ÁÐ³ö¿ÉÓÃµÄ USB ÉÁ´æÇý¶¯Æ÷...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=ÊäÈë USB ÉÁ´æÇý¶¯Æ÷ÅÌ·û : 

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"

echo.
echo.-------------------------------------------------------------------------------
echo.####¿ÌÂ¼ ISO Ó³Ïñµ½ USB ÉÁ´æÇý¶¯Æ÷#######################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.½« ISO Ó³ÏñÎÄ¼þÄÚÈÝ¸´ÖÆµ½ USB ÉÁ´æÇý¶¯Æ÷£¬ÇëÉÔºò...
echo.-------------------------------------------------------------------------------
echo.
echo.À´Ô´ ISO        : %ISOFileName%
echo.Ä¿±êÇý¶¯Æ÷      : %USBDriveLetter%
echo.
%Zip% x -y "%ISO%\%ISOFileName%" -o"%USBDriveLetter%"
echo.
echo.-------------------------------------------------------------------------------
echo.####½« ISO Ó³Ïñ¿ÌÂ¼µ½ USB ÉÁ´æÇý¶¯Æ÷Íê³É############################
echo.-------------------------------------------------------------------------------

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

set ISOFileName=
set USBDriveLetter=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to ¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷
::-------------------------------------------------------------------------------------------
:FormatUSB

setlocal

set USBDriveLetter=
set USBDriveLabel=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - ¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷########################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.####»ñÈ¡ USB ÉÁ´æÇý¶¯Æ÷Ñ¡Ïî############################################
echo.-------------------------------------------------------------------------------
echo.
:: Show Available USB Flash Drivers.
echo.ÁÐ³ö¿ÉÓÃµÄ USB ÉÁ´æÇý¶¯Æ÷...
call :ListDisks

:: Getting USB Flash Drive Letter
set /p USBDriveLetter=ÊäÈë USB ÉÁ´æÇý¶¯Æ÷ÅÌ·û : 
echo.

:: Setting USB Flash Drive Letter
set "USBDriveLetter=%USBDriveLetter%:"

:: Checking whether the Specified USB Flash Drive exist
cd /d %USBDriveLetter% 2>nul
if errorlevel 1 (
	echo.Ö¸¶¨µÄ USB ÉÁ´æÇý¶¯Æ÷ÎÞÐ§£¬ÇëÖØÊÔ...
	goto :Stop
)

:: Getting USB Flash Drive Volume Label.
set /p USBDriveLabel=ÊäÈë USB ÉÁ´æÇý¶¯Æ÷¾í±ê : 
echo.

:: Getting USB Boot Type (UEFI/BIOS/ALL).
choice /C:12 /N /M "ÊäÈë USB ÉÁ´æÇý¶¯Æ÷Æô¶¯ÀàÐÍ [1=BIOS,2=BIOS/UEFI] : "
if errorlevel 2 goto :BIOS_UEFI
if errorlevel 1 goto :BIOS

:: Formatting USB Flash Drive in NTFS Format for BIOS Booting Systems.
:BIOS
	echo.
	choice /C:YN /N /M "ÄúÈ·¶¨Òª¸ñÊ½»¯ [%USBDriveLetter%] Âð? ['Y'es/'N'o] : "
	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
	)

:: Formatting USB Flash Drive in FAT32 Format for BIOS and or UEFI Booting Systems.
:BIOS_UEFI
	echo.
	choice /C:YN /N /M "ÄúÈ·¶¨Òª¸ñÊ½»¯ [%USBDriveLetter%] Âð? ['Y'es/'N'o] : "
	if errorlevel 2 (
		echo.
		echo.¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷ [%USBDriveLetter%] ÒÑÈ¡Ïû...
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Stopped Formatting USB Flash Drive########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)
	if errorlevel 1 (
		call :FormatDisk %USBDriveLetter%, FAT32, %USBDriveLabel%
		echo.
		echo.-------------------------------------------------------------------------------
		echo.####Íê³É¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷########################################
		echo.-------------------------------------------------------------------------------
		goto :Stop
	)

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

set USBDriveLetter=
set USBDriveLabel=

endlocal

:: Returning to Main Menu
goto :MainMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to List All the Disks and Volumes
::-------------------------------------------------------------------------------------------
:ListDisks

call :RemoveFile "%Temp%\DiskList.txt"
call :RemoveFile "%Temp%\DiskList1.txt"

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

echo.===============================================================================>> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "en-US" echo.  Volume #  Letter Label      file Sys Type         Size    Status     Info>> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "fr-FR" echo.  N# volume   Ltr  Nom          Fs     Type        Taille   Statut     Info>> "%Temp%\DiskList.txt"
echo.------------------------------------------------------------------------------->> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "en-US" findstr "Removable" "%Temp%\DiskList1.txt" >> "%Temp%\DiskList.txt"
if "%HostLanguage%" equ "fr-FR" findstr "Amovible" "%Temp%\DiskList1.txt" >> "%Temp%\DiskList.txt"
echo.===============================================================================>> "%Temp%\DiskList.txt"

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

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

::-------------------------------------------------------------------------------------------
:: Function to Format a Disk/Volume
:: Input Parameters [ %~1 : USB Drive Letter, %~2 : Format Type, %~3 : Drive Label]
::-------------------------------------------------------------------------------------------
:FormatDisk

:: Writing DiskPart.txt Script File.
call :RemoveFile "%Temp%\DiskPart.txt"
echo.select volume ^%~1>> "%Temp%\DiskPart.txt"
echo.clean>> "%Temp%\DiskPart.txt"
echo.create partition primary>> "%Temp%\DiskPart.txt"
echo.select partition ^1>> "%Temp%\DiskPart.txt"
echo.active>> "%Temp%\DiskPart.txt"
echo.format fs=%~2 quick label=%~3>> "%Temp%\DiskPart.txt"
echo.exit>> "%Temp%\DiskPart.txt"
echo.exit>> "%Temp%\DiskPart.txt"
echo.
echo.-------------------------------------------------------------------------------
echo.####Formatting USB Flash Drive#################################################
echo.-------------------------------------------------------------------------------
echo.
:: Executing DiskPart.txt Script file With Diskpart.
echo.¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷ [%~1] ÔÚ %~2 ¸ñÊ½»¯, ÇëÉÔºò...
start /B /wait diskpart /s "%Temp%\DiskPart.txt" >nul
echo.
echo.¸ñÊ½»¯ USB ÉÁ´æÇý¶¯Æ÷ [%~1] ÔÚ %~2 ¸ñÊ½»¯, Íê³É...
call :RemoveFile "%Temp%\DiskPart.txt"

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

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - WIM Manager
::-------------------------------------------------------------------------------------------
:WIMManager

cls
echo.===============================================================================
echo.                          MSMG ToolKit - WIM ¹ÜÀíÆ÷
echo.===============================================================================
echo.

:: Checking whether Source is Applied.
if "%IsSourceSelected%" equ "Yes" (
	echo.Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³Ê±ÎÞ·¨Ê¹ÓÃ´Ë¹¦ÄÜ...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :ToolsMenu
)

echo.  [A]   ÏÔÊ¾
echo.  [B]   ÖØÃüÃû
echo.  [C]   É¾³ý
echo.  [D]   µ¼³ö
echo.  [E]   ×ª»»
echo.  [F]   ·Ö¸î
echo.  [G]   ºÏ²¢
echo.  [H]   ¸üÐÂ
echo.  [I]   ²¶»ñ
echo.  [J]   Ó¦ÓÃ
echo.  [K]   ÇåÀí
echo.
echo.
echo.
echo.
echo.  [X]   ·µ»Ø
echo.
echo.===============================================================================
echo.
choice /C:ABCDEFGHIJKX /N /M "ÊäÈëÄúµÄÑ¡Ôñ : "
if errorlevel 12 goto :ToolsMenu
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

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Display WIM Image Information
::-------------------------------------------------------------------------------------------
:WIMDisplay

cls
echo.===============================================================================
echo.               MSMG ToolKit - ÏÔÊ¾ WIM Ó³ÏñÐÅÏ¢
echo.===============================================================================

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò¡° Install.wim¡±Ó³Ïñ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼Ð...
	echo.
	echo.===============================================================================
	echo.
	goto :Stop
)

:: Display Image Index Information
call :ShowImageInfo

:Stop

pause

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Rename WIM Index
::-------------------------------------------------------------------------------------------
:WIMRename

setlocal

set NewImageName=
set NewImageDescription=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - ÖØÃüÃû WIM Ó³ÏñË÷Òý
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼ÖØÃüÃûÀ´Ô´ WIM Ó³ÏñË÷Òý###################################
echo.-------------------------------------------------------------------------------

:: Display Image Index Information
call :ShowImageInfo

:: Getting Image Index No to Rename
set /p ImageIndexNo=ÊäÈë WIM Ó³ÏñË÷Òý # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëµÄ # Ë÷ÒýÎÞÐ§...
	echo.
	pause
	goto :WIMRename
)

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

echo.
set /p NewImageName=ÊäÈë WIM Ë÷ÒýÃû³Æ : 
echo.
set /p NewImageDescription=ÊäÈë WIM Ë÷ÒýÃèÊö : 

echo.
echo.-------------------------------------------------------------------------------
echo.ÖØÃüÃûÀ´Ô´ WIM Ó³Ïñ [Install.wim, Ë÷Òý : %ImageIndexNo%] ÐÅÏ¢...
echo.-------------------------------------------------------------------------------
echo.
%WimLibImagex% info "%InstallWim%" %ImageIndexNo% "%NewImageName%" "%NewImageDescription%" --image-property DISPLAYNAME="%NewImageName%" --image-property DISPLAYDESCRIPTION="%NewImageDescription%"
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÖØÃüÃûÀ´Ô´ WIM Ó³ÏñË÷Òý###################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set NewImageName=
set NewImageDescription=
set ImageIndexNo=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Delete WIM Index
::-------------------------------------------------------------------------------------------
:WIMDelete

cls
echo.===============================================================================
echo.                       MSMG ToolKit - Delete WIM Index
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

:: Finding total no of indexes present inside the Image
call :GetImageCount "%InstallWim%"

if %ImageCount% equ 1 (
	echo.ÎÞ·¨É¾³ýµ¥¶ÀÓ³ÏñË÷Òý...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼É¾³ýÀ´Ô´ WIM Ó³ÏñË÷Òý###################################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
set /p ImageIndexNo=ÊäÈë WIM Ó³ÏñË÷Òý # ['Q'uit] : 
echo.

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.ÊäÈëµÄ # Ë÷ÒýºÅÎÞÐ§, ÓÐÐ§·¶Î§Îª [1,...%ImageCount%, 'Q'uit]
	echo.
	pause
	goto :WIMDelete
)

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

echo.-------------------------------------------------------------------------------
echo.É¾³ýÀ´Ô´ WIM Ó³Ïñ [Install.wim, Ë÷Òý : %ImageIndexNo%]...
echo.-------------------------------------------------------------------------------
call :DeleteImage "%InstallWim%", %ImageIndexNo%
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÉ¾³ýÀ´Ô´ WIM Ó³ÏñË÷Òý###################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Export WIM Index to Source WIM Image or New WIM Image
::-------------------------------------------------------------------------------------------
:WIMExport

setlocal

set WimImageFileName=
set Export2NewImage=

cls
echo.===============================================================================
echo.                       MSMG ToolKit - µ¼³ö WIM Ë÷Òý
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼µ¼³öÀ´Ô´ WIM Ó³ÏñË÷Òý##################################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=ÊäÈë WIM Ó³ÏñË÷Òý # ['Q'uit] : 
) else set /p ImageIndexNo=ÊäÈë WIM Ó³ÏñË÷Òý # [·¶Î§ : 1,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëµÄ # Ë÷ÒýºÅÎÞÐ§, ÓÐÐ§·¶Î§Îª [1,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
	echo.
	pause
	goto :WIMExport
)

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

echo.
choice /C:YN /N /M "ÊÇ·ñÒªµ¼³öµ½ÐÂµÄ WIM Ó³Ïñ? ['Y'es/'N'o] : "
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.

if /i "%ImageIndexNo%" equ "A" (
	for /l %%i in (1, 1, %ImageCount%) do (
		echo.-------------------------------------------------------------------------------
		if "!Export2NewImage!" equ "Yes" echo.µ¼³öÀ´Ô´ WIM Ó³Ïñ [Install.wim, Index : %%i] µ½ [%WimImageFileName%]... 
		if "!Export2NewImage!" equ "No" echo.µ¼³öÀ´Ô´ WIM Ó³Ïñ [Install.wim, Index : %%i] µ½ [Install.wim]...
		echo.-------------------------------------------------------------------------------
		if "!Export2NewImage!" equ "Yes" call :ExportImageIndex "%InstallWim%", %%i, "%DVD%\sources\%WimImageFileName%", "WIM", "No"
		if "!Export2NewImage!" equ "No" call :ExportImageIndex "%InstallWim%", %%i, "%InstallWim%", "WIM", "No"
	)
) else (
	for %%i in (%ImageIndexNo%) do (
		echo.-------------------------------------------------------------------------------
		if "!Export2NewImage!" equ "Yes" echo.µ¼³öÀ´Ô´ WIM Ó³Ïñ [Install.wim, Ë÷Òý : %%i] µ½ [%WimImageFileName%]... 
		if "!Export2NewImage!" equ "No" echo.µ¼³öÀ´Ô´ WIM Ó³Ïñ [Install.wim, Ë÷Òý : %%i] µ½ [Install.wim]...
		echo.-------------------------------------------------------------------------------
		if "!Export2NewImage!" equ "Yes" call :ExportImageIndex "%InstallWim%", %%i, "%DVD%\sources\%WimImageFileName%", "WIM", "No"
		if "!Export2NewImage!" equ "No" call :ExportImageIndex "%InstallWim%", %%i, "%InstallWim%", "WIM", "No"
	)
)

echo.-------------------------------------------------------------------------------
echo.####Íê³Éµ¼³öÀ´Ô´ WIM Ó³ÏñË÷Òý##################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set WimImageFileName=
set Export2NewImage=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG Toolkit - Convert WIM Image to ESD Image
::-------------------------------------------------------------------------------------------
:WIMConvert

cls
echo.===============================================================================
echo.               MSMG ToolKit - ×ª»» WIM Ó³Ïñµ½ ESD Ó³Ïñ
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼×ª»» WIM Ó³Ïñµ½ ESD Ó³Ïñ#################################
echo.-------------------------------------------------------------------------------

:: Getting Image Index Number to Service
call :GetImageIndexNo "%InstallWim%"

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÎÞÐ§Ë÷Òý # ÊäÈë, ÓÐÐ§·¶Î§Îª [1,...%ImageCount%, 'A'È«²¿, 'Q'ÍË³ö]
	echo.
	pause
	goto :WIMConvert
)

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

echo.
echo.-------------------------------------------------------------------------------
echo.####×ª»» WIM Ó³Ïñµ½ ESD Ó³Ïñ##########################################
echo.-------------------------------------------------------------------------------

:: Exporting Source Image to ESD Image
if /i "%ImageIndexNo%" equ "A" (
	call :ExportImage "%InstallWim%", "%InstallEsd%", "ESD", "No"
) else (
	for %%i in (%ImageIndexNo%) do (
		call :ExportImageIndex "%InstallWim%", %%i, "%InstallEsd%", "ESD", "No"
	)
)

:: Deleting Source Image File
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####Íê³É×ª»» WIM Ó³Ïñµ½ ESD Ó³Ïñ#################################
echo.-------------------------------------------------------------------------------

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

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Split WIM Image
::-------------------------------------------------------------------------------------------
:WIMSplit

setlocal

set WimImageSplitFileSize=

cls
echo.===============================================================================
echo.                      MSMG ToolKit - ·Ö¸î WIM Ó³Ïñ
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼·Ö¸îÀ´Ô´ WIM Ó³Ïñ#########################################
echo.-------------------------------------------------------------------------------
echo.
set /p WimImageSplitFileSize=ÊäÈëÒÔ MB Îªµ¥Î»µÄ WIM Ó³ÏñÏñ·Ö¸îÎÄ¼þ´óÐ¡ : 
echo.
echo.-------------------------------------------------------------------------------
echo.·Ö¸îÀ´Ô´ WIM Ó³Ïñ [Install.wim]...
echo.-------------------------------------------------------------------------------

call :SplitImage "%InstallWim%", "%DVD%\sources\install.swm", %WimImageSplitFileSize%
call :RemoveFile "%InstallWim%"

echo.-------------------------------------------------------------------------------
echo.####Íê³É·Ö¸îÀ´Ô´ WIM Í¼Ïñ#########################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set WimImageSplitFileSize=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Merge Splitted WIM Image
::-------------------------------------------------------------------------------------------
:WIMMerge

cls
echo.===============================================================================
echo.                   MSMG ToolKit - ºÏ²¢·Ö¸î WIM Ó³Ïñ
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼ºÏ²¢·Ö¸îÀ´Ô´ WIM Ó³Ïñ#################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.ºÏ²¢·Ö¸îÀ´Ô´ WIM Í¼Ïñ [Install.swm] µ½ [Install.wim]...
echo.-------------------------------------------------------------------------------

call :MergeImage "%DVD%\sources\install", "%InstallWim%"
call :RemoveFile "%DVD%\sources\*.swm"

echo.-------------------------------------------------------------------------------
echo.####Íê³ÉºÏ²¢·Ö¸îµÄÀ´Ô´ WIM Ó³Ïñ#################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Upgrade WIM Index Edition
::-------------------------------------------------------------------------------------------
:WIMUpgrade

setlocal

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

cls
echo.===============================================================================
echo.                     MSMG ToolKit - ¸üÐÂ WIM °æ±¾
echo.===============================================================================

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Upgrade
set /p ImageIndexNo=ÊäÈë WIM Ó³ÏñË÷Òý # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÎÞÐ§Ë÷Òý # ÊäÈë...
	echo.
	pause
	goto :WIMUpgrade
)

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

:: Getting selected Image Index Information
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: Setting selected Source OS version
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" set "SelectedSourceOS=w10"
echo.

:: Checking whether the selected Source OS is a Windows 7 Enterprise Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 7 Enterprise Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise N Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 7 Enterprise N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise K Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseK" (
	echo.Windows 7 Enterprise K Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Enterprise KN Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "EnterpriseKN" (
	echo.Windows 7 Enterprise KN Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "Ultimate" (
	echo.Windows 7 Ultimate Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate N Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateN" (
	echo.Windows 7 Ultimate N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate K Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateK" (
	echo.Windows 7 Ultimate K Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 7 Ultimate KN Edition
if "%SelectedSourceOS%" equ "w7" if "%ImageFlag%" equ "UltimateKN" (
	echo.Windows 7 Ultimate KN Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Pro with Media Center Edition
if "%ImageFlag%" equ "ProfessionalWMC" (
	echo.Windows 8.1 Pro with Media Center Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Pro N Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 8.1 Pro N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 8.1 Enterprise Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Enterprise N Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 8.1 Enterprise N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 8.1 Embedded Industry Enterprise Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageFlag%" equ "EmbeddedIndustryE" (
	echo.Windows Embedded 8.1 Industry Enterprise Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "Enterprise" (
	echo.Windows 10 Enterprise Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "10240" if "%ImageFlag%" equ "EnterpriseN" (
	echo.Windows 10 Enterprise N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 S Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "Cloud" (
	echo.Windows 10 S Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 S N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageEdition%" equ "CloudN" (
	echo.Windows 10 S N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Professional Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "Professional" (
	echo.Windows 10 Professional Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Professional N Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageFlag%" equ "ProfessionalN" (
	echo.Windows 10 Professional N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise G Edition
if "%ImageFlag%" equ "EnterpriseG" (
	echo.Windows 10 Enterprise G Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise GN Edition
if "%ImageFlag%" equ "EnterpriseGN" (
	echo.Windows 10 Enterprise GN Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise LTSB Edition
if "%ImageFlag%" equ "EnterpriseS" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 Enterprise 2015 LTSB Edition ÎÞ·¨Éý¼¶...
	if "%ImageBuild%" equ "14393" echo.Windows 10 Enterprise 2016 LTSB Edition ÎÞ·¨Éý¼¶...
	if "%ImageBuild%" equ "17763" echo.Windows 10 Enterprise 2019 LTSC Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Enterprise N LTSB Edition
if "%ImageFlag%" equ "EnterpriseSN" (
	if "%ImageBuild%" equ "10240" echo.Windows 10 Enterprise N 2015 LTSB Edition ÎÞ·¨Éý¼¶...
	if "%ImageBuild%" equ "14393" echo.Windows 10 Enterprise N 2016 LTSB Edition ÎÞ·¨Éý¼¶...
	if "%ImageBuild%" equ "17763" echo.Windows 10 Enterprise N 2019 LTSC Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Education Edition
if "%ImageFlag%" equ "Education" (
	echo.Windows 10 Education Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows 10 Education N Edition
if "%ImageFlag%" equ "EducationN" (
	echo.Windows 10 Education N Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Hyper Server 2016 Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerHyper" (
	echo.Windows Hyper-V Server 2016 Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a Windows Server 2016 Datacenter Edition
if "%SelectedSourceOS%" equ "w10" if "%ImageFlag%" equ "ServerDatacenter" (
	echo.Windows Server 2016 Datacenter Edition ÎÞ·¨Éý¼¶...
	echo.
	echo.===============================================================================
	echo.
	pause
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	goto :WIMManager
)

:: Checking whether the selected Source OS is a 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
	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.
:: Get Target Edition
set /p TargetEdition=ÊäÈëÄ¿±ê°æ±¾ : 
echo.

:: Checking whether the Selected Source OS is a Windows 8.1 Pro Retail Edition
if "%SelectedSourceOS%" equ "w81" if "%ImageEdition%" equ "Professional" if "%TargetEdition%" equ "ProfessionalWMC" (
	echo.¼ì²éÔ´Ó³ÏñÊÇ·ñÎª Windows 8.1 Pro °æ±¾...
	echo.
	%DISM% /Format:Table /Image:"%InstallMount%" /Get-Packages | findstr /c:"GVLK-Package" >nul
	if not errorlevel 1 (
		echo.ËùÑ¡À´Ô´²»ÊÇ Windows 8.1 Pro ÁãÊÛ°æ±¾..
		echo.
		echo.ÇëÊ¹ÓÃ Windows 8.1 Pro ÁãÊÛ°æ²Ù×÷ÏµÍ³×÷ÎªÀ´Ô´...
		goto :Stop
	)
)
echo.-------------------------------------------------------------------------------
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 7 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w7" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2008 R2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 8.1 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType%" equ "Embedded" echo.Upgrading Windows 8.1 Embedded %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w81" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2012 R2 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageInstallationType%" equ "Client" echo.Upgrading Windows 10 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "14393" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2016 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "15063" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1709 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "16299" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1803 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17134" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1809 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server 2019 %SourceEdition% to %TargetEdition%...
if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "18362" if "%ImageInstallationType:~,6%" equ "Server" echo.Upgrading Windows Server v1903/v1909 %SourceEdition% to %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 Home Basic"
	set "DisplayDescription=Windows 7 Home Basic"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomePremium" (
	set "Flag=HomePremium"
	set "Edition=HomePremium"
	set "Name=Windows 7 HOMEPREMIUM"
	set "Description=Windows 7 HOMEPREMIUM"
	set "DisplayName=Windows 7 Home Premium"
	set "DisplayDescription=Windows 7 Home Premium"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "Professional" (
	set "Flag=Professional"
	set "Edition=Professional"
	set "Name=Windows 7 PROFESSIONAL"
	set "Description=Windows 7 PROFESSIONAL"
	set "DisplayName=Windows 7 Professional"
	set "DisplayDescription=Windows 7 Professional"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "Ultimate" (
	set "Flag=Ultimate"
	set "Edition=Ultimate"
	set "Name=Windows 7 ULTIMATE"
	set "Description=Windows 7 ULTIMATE"
	set "DisplayName=Windows 7 Ultimate"
	set "DisplayDescription=Windows 7 Ultimate"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomeBasicN" (
	set "Flag=HomeBasicN"
	set "Edition=HomeBasicN"
	set "Name=Windows 7 HOMEBASICN"
	set "Description=Windows 7 HOMEBASICN"
	set "DisplayName=Windows 7 Home Basic N"
	set "DisplayDescription=Windows 7 Home Basic N"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomePremiumN" (
	set "Flag=HomePremiumN"
	set "Edition=HomePremiumN"
	set "Name=Windows 7 HOMEPREMIUMN"
	set "Description=Windows 7 HOMEPREMIUMN"
	set "DisplayName=Windows 7 Home Premium N"
	set "DisplayDescription=Windows 7 Home Premium N"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "ProfessionalN" (
	set "Flag=ProfessionalN"
	set "Edition=ProfessionalN"
	set "Name=Windows 7 PROFESSIONALN"
	set "Description=Windows 7 PROFESSIONALN"
	set "DisplayName=Windows 7 Professional N"
	set "DisplayDescription=Windows 7 Professional N"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "UltimateN" (
	set "Flag=UltimateN"
	set "Edition=UltimateN"
	set "Name=Windows 7 ULTIMATEN"
	set "Description=Windows 7 ULTIMATEN"
	set "DisplayName=Windows 7 Ultimate N"
	set "DisplayDescription=Windows 7 Ultimate N"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomeBasicK" (
	set "Flag=HomeBasicK"
	set "Edition=HomeBasicK"
	set "Name=Windows 7 HOMEBASICK"
	set "Description=Windows 7 HOMEBASICK"
	set "DisplayName=Windows 7 Home Basic K"
	set "DisplayDescription=Windows 7 Home Basic K"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomePremiumK" (
	set "Flag=HomePremiumK"
	set "Edition=HomePremiumK"
	set "Name=Windows 7 HOMEPREMIUMK"
	set "Description=Windows 7 HOMEPREMIUMK"
	set "DisplayName=Windows 7 Home Premium K"
	set "DisplayDescription=Windows 7 Home Premium K"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "ProfessionalK" (
	set "Flag=ProfessionalK"
	set "Edition=ProfessionalK"
	set "Name=Windows 7 PROFESSIONALK"
	set "Description=Windows 7 PROFESSIONALK"
	set "DisplayName=Windows 7 Professional K"
	set "DisplayDescription=Windows 7 Professional K"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "UltimateK" (
	set "Flag=UltimateK"
	set "Edition=UltimateK"
	set "Name=Windows 7 ULTIMATEK"
	set "Description=Windows 7 ULTIMATEK"
	set "DisplayName=Windows 7 Ultimate K"
	set "DisplayDescription=Windows 7 Ultimate K"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomeBasicKN" (
	set "Flag=HomeBasicKN"
	set "Edition=HomeBasicKN"
	set "Name=Windows 7 HOMEBASICKN"
	set "Description=Windows 7 HOMEBASICKN"
	set "DisplayName=Windows 7 Home Basic KN"
	set "DisplayDescription=Windows 7 Home Basic KN"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "HomePremiumKN" (
	set "Flag=HomePremiumKN"
	set "Edition=HomePremiumKN"
	set "Name=Windows 7 HOMEPREMIUMKN"
	set "Description=Windows 7 HOMEPREMIUMKN"
	set "DisplayName=Windows 7 Home Premium KN"
	set "DisplayDescription=Windows 7 Home Premium KN"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "ProfessionalKN" (
	set "Flag=ProfessionalKN"
	set "Edition=ProfessionalKN"
	set "Name=Windows 7 PROFESSIONALKN"
	set "Description=Windows 7 PROFESSIONALKN"
	set "DisplayName=Windows 7 Professional KN"
	set "DisplayDescription=Windows 7 Professional KN"
)

if "%SelectedSourceOS%" equ "w7"  if "%TargetEdition%" equ "UltimateKN" (
	set "Flag=UltimateKN"
	set "Edition=UltimateKN"
	set "Name=Windows 7 ULTIMATEKN"
	set "Description=Windows 7 ULTIMATEKN"
	set "DisplayName=Windows 7 Ultimate KN"
	set "DisplayDescription=Windows 7 Ultimate KN"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Server Core Installation^)"
	set "DisplayDescription=´ËÑ¡Ïî°²×°µÄ Windows Server µÄ×îÐ¡°²×°°æ±¾²»´ø±ê×¼WindowsÓÃ»§½çÃæ£¬²¢ÇÒ¾ßÓÐ¿ÉÒÔ´ÓÃüÁîÌáÊ¾·û½øÐÐ¹ÜÀíµÄ·þÎñÆ÷½ÇÉ«µÄ×Ó¼¯£¬´Ó¶ø¼õÉÙÁË¹ÜÀíÒªÇóºÍ¹¥»÷Ãæ¡£"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Server Core Installation^)"
	set "DisplayDescription=´ËÑ¡Ïî°²×°µÄ Windows Server µÄ×îÐ¡°²×°°æ±¾²»´ø±ê×¼WindowsÓÃ»§½çÃæ£¬²¢ÇÒ¾ßÓÐ¿ÉÒÔ´ÓÃüÁîÌáÊ¾·û½øÐÐ¹ÜÀíµÄ·þÎñÆ÷½ÇÉ«µÄ×Ó¼¯£¬´Ó¶ø¼õÉÙÁË¹ÜÀíÒªÇóºÍ¹¥»÷Ãæ¡£"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Server Core Installation^)"
	set "DisplayDescription=´ËÑ¡Ïî°²×°µÄ Windows Server µÄ×îÐ¡°²×°°æ±¾²»´ø±ê×¼WindowsÓÃ»§½çÃæ£¬²¢ÇÒ¾ßÓÐ¿ÉÒÔ´ÓÃüÁîÌáÊ¾·û½øÐÐ¹ÜÀíµÄ·þÎñÆ÷½ÇÉ«µÄ×Ó¼¯£¬´Ó¶ø¼õÉÙÁË¹ÜÀíÒªÇóºÍ¹¥»÷Ãæ¡£"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Full Installation^)"
	set "DisplayDescription=´ËÑ¡Ïî½«°²×° Windows Server µÄÍêÕû°²×°¡£ ´Ë°²×°°üÀ¨Õû¸öÓÃ»§½çÃæ£¬²¢ÇÒÖ§³ÖËùÓÐ·þÎñÆ÷½ÇÉ«¡£"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Full Installation^)"
	set "DisplayDescription=´ËÑ¡Ïî½«°²×° Windows Server µÄÍêÕû°²×°¡£ ´Ë°²×°°üÀ¨Õû¸öÓÃ»§½çÃæ£¬²¢ÇÒÖ§³ÖËùÓÐ·þÎñÆ÷½ÇÉ«¡£"
)

if "%SelectedSourceOS%" equ "w7" 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 ^(Full Installation^)"
	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 "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "Professional" (
	set "Flag=Professional"
	set "Edition=Professional"
	set "Name=Windows 8.1 Pro"
	set "Description=Windows 8.1 Pro"
	set "DisplayName=Windows 8.1 Pro"
	set "DisplayDescription=Windows 8.1 Pro"
)

if "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "ProfessionalWMC" (
	set "Flag=ProfessionalWMC"
	set "Edition=ProfessionalWMC"
	set "Name=Windows 8.1 Pro WMC"
	set "Description=Windows 8.1 Pro WMC"
	set "DisplayName=Windows 8.1 Pro with Media Center"
	set "DisplayDescription=Windows 8.1 Pro with Media Center"
)

if "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "ProfessionalN" (
	set "Flag=ProfessionalN"
	set "Edition=ProfessionalN"
	set "Name=Windows 8.1 Pro N"
	set "Description=Windows 8.1 Pro N"
	set "DisplayName=Windows 8.1 Pro N"
	set "DisplayDescription=Windows 8.1 Pro N"
)

if "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "ServerDatacenterCore" (
	set "Flag=ServerDatacenterCore"
	set "Edition=ServerDatacenterCore"
	set "Name=Windows Server 2012 R2 Datacenter ^(Server Core Installation^)"
	set "Description=This option ^(recommended^) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	set "DisplayName=Windows Server 2012 R2 Datacenter ^(Server Core Installation^)"
	set "DisplayDescription=This option ^(recommended^) reduces management and servicing by installing only what is needed to run most server roles and applications. It does not include a GUI, but you can fully manage the server locally or remotely with Windows PowerShell or other tools. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
)

if "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "ServerStandard" (
	set "Flag=ServerStandard"
	set "Edition=ServerStandard"
	set "Name=Windows Server 2012 R2 Standard ^(Server with a GUI^)"
	set "Description=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	set "DisplayName=Windows Server 2012 R2 Standard ^(Server with a GUI^)"
	set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
)

if "%SelectedSourceOS%" equ "w81" if "%TargetEdition%" equ "ServerDatacenter" (
	set "Flag=ServerDatacenter"
	set "Edition=ServerDatacenter"
	set "Name=Windows Server 2012 R2 Datacenter ^(Server with a GUI^)"
	set "Description=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
	set "DisplayName=Windows Server 2012 R2 Datacenter ^(Server with a GUI^)"
	set "DisplayDescription=This option is useful when a GUI is required-for example, to provide backward compatibility for an application that cannot be run on a Server Core installation. All server roles and features are supported. You can switch to a different installation option later. See \"Windows Server Installation Options.\""
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "Core" (
	set "Flag=Core"
	set "Edition=Core"
	set "Name=Windows 10 Home"
	set "Description=Windows 10 Home"
	set "DisplayName=Windows 10 Home"
	set "DisplayDescription=Windows 10 Home"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "CoreN" (
	set "Flag=CoreN"
	set "Edition=CoreN"
	set "Name=Windows 10 Home N"
	set "Description=Windows 10 Home N"
	set "DisplayName=Windows 10 Home N"
	set "DisplayDescription=Windows 10 Home N"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "Professional" (
	set "Flag=Professional"
	set "Edition=Professional"
	set "Name=Windows 10 Pro"
	set "Description=Windows 10 Pro"
	set "DisplayName=Windows 10 Pro"
	set "DisplayDescription=Windows 10 Pro"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalN" (
	set "Flag=ProfessionalN"
	set "Edition=ProfessionalN"
	set "Name=Windows 10 Pro N"
	set "Description=Windows 10 Pro N"
	set "DisplayName=Windows 10 Pro N"
	set "DisplayDescription=Windows 10 Pro N"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalCountrySpecific" (
	set "Flag=ProfessionalCountrySpecific"
	set "Edition=ProfessionalCountrySpecific"
	set "Name=Windows 10 Pro CountrySpecific"
	set "Description=Windows 10 Pro CountrySpecific"
	set "DisplayName=Windows 10 Pro CountrySpecific"
	set "DisplayDescription=Windows 10 Pro CountrySpecific"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalSingleLanguage" (
	set "Flag=ProfessionalSingleLanguage"
	set "Edition=ProfessionalSingleLanguage"
	set "Name=Windows 10 Pro Single Language"
	set "Description=Windows 10 Pro Single Language"
	set "DisplayName=Windows 10 Pro Single Language""
	set "DisplayDescription=Windows 10 Pro Single Language"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "Education" (
	set "Flag=Education"
	set "Edition=Education"
	set "Name=Windows 10 Education"
	set "Description=Windows 10 Education"
	set "DisplayName=Windows 10 Education"
	set "DisplayDescription=Windows 10 Education"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "EducationN" (
	set "Flag=EducationN"
	set "Edition=EducationN"
	set "Name=Windows 10 Education N"
	set "Description=Windows 10 Education N"
	set "DisplayName=Windows 10 Education N"
	set "DisplayDescription=Windows 10 Education N"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "Enterprise" (
	set "Flag=Enterprise"
	set "Edition=Enterprise"
	set "Name=Windows 10 Enterprise"
	set "Description=Windows 10 Enterprise"
	set "DisplayName=Windows 10 Enterprise"
	set "DisplayDescription=Windows 10 Enterprise"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "EnterpriseN" (
	set "Flag=EnterpriseN"
	set "Edition=EnterpriseN"
	set "Name=Windows 10 Enterprise N"
	set "Description=Windows 10 Enterprise N"
	set "DisplayName=Windows 10 Enterprise N"
	set "DisplayDescription=Windows 10 Enterprise N"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "EnterpriseG" (
	set "Flag=EnterpriseG"
	set "Edition=EnterpriseG"
	set "Name=Windows 10 Enterprise G"
	set "Description=Windows 10 Enterprise G"
	set "DisplayName=Windows 10 Enterprise G"
	set "DisplayDescription=Windows 10 Enterprise G"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "EnterpriseGN" (
	set "Flag=EnterpriseGN"
	set "Edition=EnterpriseGN"
	set "Name=Windows 10 Enterprise GN"
	set "Description=Windows 10 Enterprise GN"
	set "DisplayName=Windows 10 Enterprise GN"
	set "DisplayDescription=Windows 10 Enterprise GN"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalEducation" (
	set "Flag=ProfessionalEducation"
	set "Edition=ProfessionalEducation"
	set "Name=Windows 10 Pro Education"
	set "Description=Windows 10 Pro Education"
	set "DisplayName=Windows 10 Pro Education"
	set "DisplayDescription=Windows 10 Pro Education"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalEducationN" (
	set "Flag=ProfessionalEducationN"
	set "Edition=ProfessionalEducationN"
	set "Name=Windows 10 Pro EducationN"
	set "Description=Windows 10 Pro Education N"
	set "DisplayName=Windows 10 Pro Education N"
	set "DisplayDescription=Windows 10 Pro Education N"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalWorkstation" (
	set "Flag=ProfessionalWorkstation"
	set "Edition=ProfessionalWorkstation"
	set "Name=Windows 10 Pro for Workstations"
	set "Description=Windows 10 Pro for Workstations"
	set "DisplayName=Windows 10 Pro for Workstations"
	set "DisplayDescription=Windows 10 Pro for Workstations"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ProfessionalWorkstationN" (
	set "Flag=ProfessionalWorkstationN"
	set "Edition=ProfessionalWorkstationN"
	set "Name=Windows 10 Pro N for Workstations"
	set "Description=Windows 10 Pro N for Workstations"
	set "DisplayName=Windows 10 Pro N for Workstations"
	set "DisplayDescription=Windows 10 Pro N for Workstations"
)

if "%SelectedSourceOS%" equ "w10" if "%TargetEdition%" equ "ServerRdsh" (
	set "Flag=ServerRdsh"
	set "Edition=ServerRdsh"
	set "Name=Windows 10 Enterprise for Remote Sessions"
	set "Description=Windows 10 Enterprise for Remote Sessions"
	set "DisplayName=Windows 10 Enterprise for Remote Sessions"
	set "DisplayDescription=Windows 10 Enterprise for Remote Sessions"
)

if "%SelectedSourceOS%" equ "w10" 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 "%SelectedSourceOS%" equ "w10" 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 "%SelectedSourceOS%" equ "w10" 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 ^(Desktop Experience^)"
	set "DisplayDescription=µ±ÐèÒª GUI Ê±£¬´ËÑ¡ÏîºÜÓÐÓÃ-ÀýÈç£¬ÎªÎÞ·¨ÔÚ Server Core °²×°ÉÏÔËÐÐµÄÓ¦ÓÃ³ÌÐòÌá¹©Ïòºó¼æÈÝÐÔ¡£ Ö§³ÖËùÓÐ·þÎñÆ÷½ÇÉ«ºÍ¹¦ÄÜ¡£ ÓÐ¹Ø¸ü¶àÏêÏ¸ÐÅÏ¢£¬Çë²Î¼û\"Windows Server °²×°Ñ¡Ïî¡£\""
)

if "%SelectedSourceOS%" equ "w10" 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 ^(Desktop Experience^)"
	set "DisplayDescription=µ±ÐèÒª GUI Ê±£¬´ËÑ¡ÏîºÜÓÐÓÃ-ÀýÈç£¬ÎªÎÞ·¨ÔÚ Server Core °²×°ÉÏÔËÐÐµÄÓ¦ÓÃ³ÌÐòÌá¹©Ïòºó¼æÈÝÐÔ¡£ Ö§³ÖËùÓÐ·þÎñÆ÷½ÇÉ«ºÍ¹¦ÄÜ¡£ ÓÐ¹Ø¸ü¶àÏêÏ¸ÐÅÏ¢£¬Çë²Î¼û\"Windows Server °²×°Ñ¡Ïî¡£\""
)

if "%SelectedSourceOS%" equ "w10" if "%ImageBuild%" equ "17763" if "%ImageInstallationType%" equ "Server" if "%SourceEdition%" equ "ServerSolution" if "%TargetEdition%" equ "ServerStandard" (
	set "Flag=ServerStandard"
	set "Edition=ServerStandard"
	set "Name=Windows Server 2019 SERVERSTANDARD"
	set "Description=Windows Server 2019 SERVERSTANDARD"
	set "DisplayName=Windows Server 2019 Standard ^(Desktop Experience^)"
	set "DisplayDescription=´ËÑ¡Ïî½«°²×°ÍêÕûµÄ Windows Ó³Ïñ»·¾³£¬´Ó¶øÕ¼ÓÃ¶îÍâµÄÇý¶¯Æ÷¿Õ¼ä¡£ Èç¹ûÄúÏëÊ¹ÓÃ Windows ×ÀÃæ»òÓÐÐèÒªËüµÄÓ¦ÓÃ³ÌÐò£¬Ëü¿ÉÄÜ»áºÜÓÐÓÃ¡£"
)

if "%SelectedSourceOS%" equ "w10" 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 ^(Desktop Experience^)"
	set "DisplayDescription=´ËÑ¡Ïî½«°²×°ÍêÕûµÄ Windows Ó³Ïñ»·¾³£¬´Ó¶øÕ¼ÓÃ¶îÍâµÄÇý¶¯Æ÷¿Õ¼ä¡£Èç¹ûÄúÏëÊ¹ÓÃ Windows ×ÀÃæ»òÓÐÐèÒªËüµÄÓ¦ÓÃ³ÌÐò£¬Ëü¿ÉÄÜ»áºÜÓÐÓÃ¡£"
)
:: Setting Image Flag, Name and Description to reflect Target Edition
echo.ÉèÖÃÓ³Ïñ [Display Name] µ½ "%DisplayName%"...
echo.ÉèÖÃÓ³Ïñ [Display Description] µ½ "%DisplayDescription%"...
echo.ÉèÖÃÓ³Ïñ [Flag] µ½ "%Flag%"...
echo.ÉèÖÃÓ³Ïñ [Edition] µ½ "%Edition%"...
echo.
%WimLibImagex% info "%InstallWim%" %ImageIndexNo% "%Name%" "%Description%" --image-property DISPLAYNAME="%DisplayName%" --image-property DISPLAYDESCRIPTION="%DisplayDescription%" --image-property FLAGS="%Flag%" >nul
echo.-------------------------------------------------------------------------------
echo.####ÕýÔÚ¸´ÖÆ EI.CFG ÅäÖÃÎÄ¼þµ½ ^<DVD\sources^> ÎÄ¼þ¼Ð#########################
echo.-------------------------------------------------------------------------------
echo.
echo.ÕýÔÚ¸´ÖÆ "%TargetEdition%" °æ±¾ EI.CFG ÎÄ¼þµ½ ^<DVD\sources^> ÎÄ¼þ¼Ð¡£
if exist "%DVD%\sources\EI.CFG" del /f /q "%DVD%\sources\EI.CFG" >nul
(
	echo.[EditionID]
	echo.%TargetEdition%
	echo.
	echo.[Channel]
	echo.Retail
	echo.
	echo.[VL]
	echo.0
)>"%DVD%\sources\EI.CFG"
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³ÉÉý¼¶À´Ô´ WIM Ó³Ïñ°æ±¾################################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set SourceEdition=
set TargetEdition=
set Flag=
set Edition=
set Name=
set Description=
set DisplayName=
set DisplayDescription=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Capture a Drive or Folder to a WIM Image
::-------------------------------------------------------------------------------------------
:WIMCapture

setlocal

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

cls
echo.===============================================================================
echo.            MSMG ToolKit - ²¶»ñÇý¶¯Æ÷»òÎÄ¼þ¼Ðµ½ WIM Ó³Ïñ
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼½«Çý¶¯Æ÷»òÎÄ¼þ¼Ð²¶»ñµ½ WIM Ó³Ïñ############################
echo.-------------------------------------------------------------------------------
echo.
:: Get Source Drive or folder path to be Captuerd to WIM Image
set /p SourceDriveFolder=ÊäÈëÓÐÐ§µÄÔ´Çý¶¯Æ÷»òÎÄ¼þ¼ÐÂ·¾¶: 
echo.
:: Get Target WIM Image File Name
set /p TargetWimImageFileName=ÊäÈëÄ¿±ê WIM Ó³ÏñÎÄ¼þÃû : 
echo.
:: Get Target WIM Image Name
set /p TargetWimImageName=ÊäÈëÄ¿±ê WIM Ó³ÏñÃû³Æ : 
echo.
:: Get Target WIM Image Description
set /p TargetWimImageDescription=ÊäÈëÄ¿±ê WIM Ó³ÏñÃèÊö : 
echo.
:: Get Target WIM Image Editon Flag
set /p TargetWimImageEditionFlag=ÊäÈëÄ¿±ê WIM Ó³Ïñ°æ±¾ : 
echo.
:: Get Bootable Flag Status
choice /C:YN /N /M "Ê¹Ä¿±ê WIM Ó³Ïñ¿ÉÒýµ¼? ['Y'es/'N'o] : "
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.
:: Setting WIM Image Flag, Name and Description to reflect Target Edition
echo.ÉèÖÃ WIM Ó³Ïñ [Name] µ½ "%TargetWimImageName%"...
echo.
echo.ÉèÖÃ WIM Ó³Ïñ [Description] µ½ "%TargetWimImageDescription%"...
echo.
echo.ÉèÖÃ WIM Ó³Ïñ [Flag] µ½ "%TargetWimImageEditionFlag%"...
%Imagex% /Flags "%TargetWimImageEditionFlag%" /Info "%DVD%\sources\%TargetWimImageFileName%" 1 %TargetWimImageName% %TargetWimImageDescription% >nul
echo.
echo.-------------------------------------------------------------------------------
echo.####Íê³É½«Çý¶¯Æ÷»òÎÄ¼þ¼Ð²¶»ñµ½ WIM Ó³Ïñ############################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set SourceDriveFolder=
set TargetWimImageFileName=
set TargetWimImageName=
set TargetWimImageDescription=
set TargetWimImageEditionFlag=
set BootFlag=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Apply a WIM Image Index to a Drive or Folder
::-------------------------------------------------------------------------------------------
:WIMApply

setlocal

set TargetDriveFolder=

cls
echo.===============================================================================
echo.        MSMG ToolKit - Ó¦ÓÃ WIM Ó³ÏñË÷Òýµ½Çý¶¯Æ÷»òÎÄ¼þ¼Ð
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
if not exist "%InstallWim%" (
	echo.ÕÒ²»µ½ Windows °²×°³ÌÐò°²×°Ó³Ïñ ^<DVD\Sources\install.wim^> ÎÄ¼þ...
	echo.
	echo.Çë½« Windows °²×°³ÌÐò°²×°Ó³ÏñÎÄ¼þ¸´ÖÆµ½ÏàÓ¦µÄÎÄ¼þ¼ÐÖÐ...
	goto :Stop
)

echo.-------------------------------------------------------------------------------
echo.####¿ªÊ¼½« WIM Í¼ÏñË÷ÒýÓ¦ÓÃµ½Çý¶¯Æ÷»òÎÄ¼þ¼Ð###################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Export
set /p ImageIndexNo=ÊäÈë WIM Í¼ÏñË÷Òý # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÎÞÐ§Ë÷Òý # ½øÈë...
	echo.
	pause
	goto :WIMApply
)

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

:: Get Target Drive or folder path to Apply the WIM Image Index
echo.
set /p TargetDriveFolder=ÊäÈëÄ¿±êÇý¶¯Æ÷»òÎÄ¼þ¼ÐÂ·¾¶ : 
echo.
echo.-------------------------------------------------------------------------------
echo.####Ó¦ÓÃ WIM Ó³ÏñË÷Òýµ½Çý¶¯Æ÷»òÎÄ¼þ¼Ð############################
echo.-------------------------------------------------------------------------------
echo.
call :ApplyImage "%InstallWim%", %ImageIndexNo%, %TargetDriveFolder%
echo.-------------------------------------------------------------------------------
echo.####Ó¦ÓÃ WIM Ó³ÏñË÷Òýµ½Çý¶¯Æ÷»òÎÄ¼þ¼Ð²Ù×÷Íê³É###################
echo.-------------------------------------------------------------------------------
:Stop
echo.
echo.===============================================================================
echo.
pause

set TargetDriveFolder=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Cleanup a WIM Image Index
::-------------------------------------------------------------------------------------------
:WIMCleanUp

setlocal

set CleanupOption=

cls
echo.===============================================================================
echo.                  MSMG ToolKit - ÇåÀí WIM Ó³ÏñË÷Òý
echo.===============================================================================
echo.

:: Checking whether Windows Source Install Image file exist
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 ToolKit - ÇåÀí WIM Ó³ÏñË÷Òý
echo.===============================================================================
echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####¿ªÊ¼À´Ô´ WIM Ó³ÏñÇåÀí##########################################
if "%CleanupOption%" equ "CheckHealth" echo.####Ê¹ÓÃ¼ì²é½¡¿µ¿ªÊ¼À´Ô´ WIM Ó³ÏñÇåÀí########################
if "%CleanupOption%" equ "ScanHealth" echo.####Ê¹ÓÃÉ¨ÃèÔËÐÐ×´¿öÆô¶¯À´Ô´ WIM Ó³ÏñÇåÀí#########################
echo.-------------------------------------------------------------------------------

:: Display Image Information
call :ShowImageInfo

:: Get Image Index No to Clean
set /p ImageIndexNo=Enter the WIM Image Index # ['Q'uit] : 

:: Checking for Image Index Validation
if not defined ImageIndexNo (
	echo.
	echo.ÊäÈëµÄ # Ë÷ÒýÎÞÐ§...
	echo.
	pause
	goto :WIMCleanUp
)

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

:: Getting Selected Image Index Information
call :GetImageIndexInfo "%InstallWim%", %ImageIndexNo% >nul

:: Setting Selected Source OS
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" set "SelectedSourceOS=w10"

echo.
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####Source WIM Image Cleanup###################################################
if "%CleanupOption%" equ "CheckHealth" echo.####Source WIM Image Cleanup with Check Health#################################
if "%CleanupOption%" equ "ScanHealth" echo.####Source WIM Image Cleanup with Scan Health##################################
echo.-------------------------------------------------------------------------------
echo.
echo.-------------------------------------------------------------------------------
echo.¹ÒÔØ [Install.wim, Ë÷Òý : %ImageIndexNo%] WIM Ó³ÏñÔÚ ^<\Mount\Install^>...
echo.-------------------------------------------------------------------------------
call :MountImage "%InstallWim%", %ImageIndexNo%, "%InstallMount%"
echo.-------------------------------------------------------------------------------
echo.Ö´ÐÐ [Install.wim, Ë÷Òý : %ImageIndexNo%] WIM Ó³ÏñÇåÀí...
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" (
	if "%SelectedSourceOS%" equ "w7" call :CleanupImage "%InstallMount%", "SPSupersededHideSP"
	if "%SelectedSourceOS%" neq "w7" call :CleanupImage "%InstallMount%", "ComponentCleanupResetBase"
) else (
	call :CleanupImage "%InstallMount%", "ComponentCleanup", "%CleanupOption%"
)
echo.-------------------------------------------------------------------------------
echo.Ó¦ÓÃ¸ü¸Ä ^& È¡Ïû¹ÒÔØ [Install.wim, Ë÷Òý : %ImageIndexNo%] WIM Ó³Ïñ...
echo.-------------------------------------------------------------------------------
call :UnMountImage "%InstallMount%", "Commit"
echo.-------------------------------------------------------------------------------
if "%CleanupOption%" equ "CleanupImage" echo.####Finished Source WIM Image Cleanup##########################################
if "%CleanupOption%" equ "CheckHealth" echo.####Finished Source WIM Image Cleanup with Check Health########################
if "%CleanupOption%" equ "ScanHealth" echo.####Finished Source WIM Image Cleanup with Scan Health#########################
echo.-------------------------------------------------------------------------------

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

set CleanupOption=

endlocal

:: Returning to WIM Manager Menu
goto :WIMManager
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Show MSMG ToolKit Debug Information
::-------------------------------------------------------------------------------------------
:Debug

cls
echo.===============================================================================
echo.                       MSMG ToolKit - µ÷ÊÔÐÅÏ¢
echo.===============================================================================
echo.
echo. HostArchitecture=%HostArchitecture%
echo. SelectedSourceOS=%SelectedSourceOS%
echo. IsSourceSelected=%IsSourceSelected%
echo. IsDialogsEnabled=%IsDialogsEnabled%
echo. IsLogsEnabled=%IsLogsEnabled%
echo.
echo.
echo.
echo. ImageIndexNo=%ImageIndexNo%
echo. ImageArchitecture=%ImageArchitecture%
echo. ImageBuild=%ImageBuild%
echo. ImageVersion=%ImageVersion%
echo. ImageServicePackBuild=%ImageServicePackBuild%
echo. ImageServicePackLevel=%ImageServicePackLevel%
echo. ImageDefaultLanguage=%ImageDefaultLanguage%
echo. ImageCount=%ImageCount%
echo.
echo.===============================================================================
echo.
pause

:: Returning to Tools Menu
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: MSMG ToolKit - Options Menu
::-------------------------------------------------------------------------------------------
:Options

cls
echo.===============================================================================
echo.                          MSMG ToolKit - Ñ¡Ïî²Ëµ¥
echo.===============================================================================
echo.
echo.  [1]   ÉèÖÃ ToolKit ÑÕÉ«
echo.
if "%IsDialogsEnabled%" equ "No" echo.  [2]   ÆôÓÃ ToolKit ÐÅÏ¢/¾¯¸æ¶Ô»°¿ò
if "%IsDialogsEnabled%" equ "Yes" echo.  [2]   ½ûÓÃ ToolKit ÐÅÏ¢/¾¯¸æ¶Ô»°¿ò
echo.
if "%IsLogsEnabled%" equ "No" echo.  [3]   ÆôÓÃ ToolKit ÈÕÖ¾Éú³É
if "%IsLogsEnabled%" equ "Yes" echo.  [3]   ½ûÓÃ ToolKit ÈÕÖ¾Éú³É
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 ToolKit - Ó³Ïñ×¢²á±í
		echo.===============================================================================
		echo.
		:: Checking whether Source OS is Selected
		if "%IsSourceSelected%" equ "No" (
			echo.Î´Ñ¡ÔñÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°À´Ô´¡±²Ëµ¥ÖÐÑ¡Ôñ¡£
			echo.
			echo.===============================================================================
			echo.
			pause
			goto :MainMenu
		)
		
		for /l %%i in (1, 1, %ImageCount%) do (
			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.Loading Image Registry Complete...
		echo.
		echo.===============================================================================
		echo.
		pause
	)
	if "%IsImageRegistryLoaded%" equ "Yes" (
		cls
		echo.===============================================================================
		echo.                          MSMG ToolKit - Ó³Ïñ×¢²á±í
		echo.===============================================================================
		echo.
		echo.ÕýÔÚÐ¶ÔØÓ³Ïñ×¢²á±í...
		call :UnMountImageRegistry
		set "IsImageRegistryLoaded=No"
		echo.
		echo.ÕýÔÚÐ¶ÔØÓ³Ïñ×¢²á±íÍê³É...
		echo.
		echo.===============================================================================
		echo.
		pause
	)
	goto :Toolsmenu
)
if errorlevel 3 (
	if "%IsLogsEnabled%" equ "No" set "IsLogsEnabled=Yes"
	if "%IsLogsEnabled%" equ "Yes" set "IsLogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 2 (
	if "%IsDialogsEnabled%" equ "No" set "IsDialogsEnabled=Yes"
	if "%IsDialogsEnabled%" equ "Yes" set "IsDialogsEnabled=No"
	goto :Toolsmenu
)
if errorlevel 1 goto :SetTkColor

::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to Set ToolKit Color Settings
::-------------------------------------------------------------------------------------------
:SetTkColor

cls
echo.===============================================================================
echo.                   MSMG ToolKit - ÉèÖÃ ToolKit ÑÕÉ«
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

:: Returning to Tools Menu
goto :ToolsMenu
::-------------------------------------------------------------------------------------------

:: ############################################################################################
:: MSMG ToolKit DISM Functions
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Count
:: Input Parameters [ %~1 : Image Filename ]
::-------------------------------------------------------------------------------------------
:GetImageCount

:: Finding total no of Indexes present in the Image.
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-ImageInfo /ImageFile:%~1 ^| findstr /i Index') do (set ImageCount=%%a)

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

::-------------------------------------------------------------------------------------------
:: Function to display Image Information
::-------------------------------------------------------------------------------------------
:ShowImageInfo

set "ImageInfo=%Temp%\ImageInfo.txt"

call :RemoveFile %ImageInfo%

:: Get total no of Indexes present in the Image.
call :GetImageCount "%InstallWim%"

echo.
echo.¶ÁÈ¡Ó³ÏñÐÅÏ¢...
echo.
:: List all the Indexes in the Image.
echo.===============================================================================>>%ImageInfo%
echo.^| Ë÷Òý ^| ¼Ü¹¹ ^| Ãû³Æ>>%ImageInfo%
echo.===============================================================================>>%ImageInfo%
for /f "tokens=2 delims=: " %%a in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% ^| findstr /i Index') do (
	for /f "tokens=2 delims=: " %%b in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Architecture') do (
		for /f "tokens=2 delims=:" %%c in ('%DISM% /Get-WimInfo /WimFile:%InstallWim% /Index:%%a ^| findstr /i Name') do (
			if "%%b" neq "arm64" (
				if %%a leq 9 echo.^|   %%a   ^| %%b  ^|%%c>>%ImageInfo%
				if %%a gtr 9 if %%a lss 99 echo.^|   %%a  ^| %%b  ^|%%c>>%ImageInfo%
				if %%a gtr 99 echo.^|   %%a ^| %%b  ^|%%c>>%ImageInfo%
			)
			if "%%b" equ "arm64" (
				if %%a leq 9 echo.^|   %%a   ^| %%b^|%%c>>%ImageInfo%
				if %%a gtr 9 if %%a lss 99 echo.^|   %%a  ^| %%b^|%%c>>%ImageInfo%
				if %%a gtr 99 echo.^|   %%a ^| %%b^|%%c>>%ImageInfo%
			)
		)
	)
)

type %ImageInfo%
call :RemoveFile %ImageInfo%

echo.===============================================================================
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to get Image Index number to service
:: Input Parameters [ %~1 : Image Filename ]
::-------------------------------------------------------------------------------------------
:GetImageIndexNo

:: Display the list of avaialble Image Indexes.
call :ShowImageInfo

if "%ImageCount%" equ "1" (
	set /p ImageIndexNo=ÊäÈëÓ³ÏñË÷Òý # ['Q'ÍË³ö] : 
) else set /p ImageIndexNo=ÊäÈëÓ³ÏñË÷Òý # [·¶Î§ : 1,...%ImageCount% »ò 'A'È«²¿ 'Q'ÍË³ö] : 

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

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Architecture
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:GetImageArchitecture

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

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

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Edition
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:GetImageEdition

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

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

::-------------------------------------------------------------------------------------------
:: Function to get Image Index Information
:: Input Parameters [%~1 : Image Filename, %~2 : Image Index No]
::-------------------------------------------------------------------------------------------
:GetImageIndexInfo

for /f "tokens=2 delims=:" %%a in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Name') do (set ImageName=%%a)
for /f "tokens=2 delims=:" %%b in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Description') do (set ImageDescription=%%b)
for /f "tokens=2 delims=: " %%c in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Architecture') do (set ImageArchitecture=%%c)
for /f "tokens=2 delims=: " %%d in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Version') do (set ImageVersion=%%d)
for /f "tokens=2 delims=:" %%e in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Build"') do ( set ImageServicePackBuild=%%e)
for /f "tokens=2 delims=:" %%f in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| find "ServicePack Level"') do ( set ImageServicePackLevel=%%f)
for /f "tokens=2 delims=: " %%g in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Edition') do (set ImageEdition=%%g)
for /f "tokens=2 delims=:<> " %%h in ('%Imagex% /info "%~1" %~2 ^| findstr /i Flag') do (set ImageFlag=%%h)
for /f "tokens=2 delims=:" %%i in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Installation') do (set ImageInstallationType=%%i)
for /f "tokens=* delims=" %%j in ('%DISM% /Get-ImageInfo /ImageFile:"%~1" /Index:%~2 ^| findstr /i Default') do ( set ImageDefaultLanguage=%%j)

set "ImageName=%ImageName:~1%"
set "ImageDescription=%ImageDescription:~1%"
if "%ImageVersion:~0,-6%" neq "10.0" set "ImageBuild=%ImageVersion:~4,4%"
if "%ImageVersion:~0,-6%" equ "10.0" set "ImageBuild=%ImageVersion:~5,5%"
set "ImageServicePackBuild=%ImageServicePackBuild:~1%"
set "ImageServicePackLevel=%ImageServicePackLevel:~1%"
set "ImageInstallationType=%ImageInstallationType:~1%"
set "ImageDefaultLanguage=%ImageDefaultLanguage:~1,-10%"

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

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

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

::-------------------------------------------------------------------------------------------
:: Function to Mount a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Mount folder ]
::-------------------------------------------------------------------------------------------
:MountImage

%DISM% /Mount-Image /ImageFile:%~1 /Index:%~2 /MountDir:%~3
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to Un-Mount the Mounted Image
:: Input Parameters [ %~1 : Image Mount Folder, %~2 : Image Commit / Discard Option ]
::-------------------------------------------------------------------------------------------
:UnMountImage

%DISM% /Unmount-Image /MountDir:%~1 /%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to delete a selected Image Index from a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No ]
::-------------------------------------------------------------------------------------------
:DeleteImage

%DISM% /Delete-Image /ImageFile:%~1 /Index:%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to rename a selected Image Index Information
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Name, %~4 : Image Description ]
::-------------------------------------------------------------------------------------------
:RenameImage

%Imagex% /Info %~1 %~2 "%~3" "%~4"

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

::-------------------------------------------------------------------------------------------
:: Function to split a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Split Filename, %~3 : Image Split Size in MB ]
::-------------------------------------------------------------------------------------------
:SplitImage

%DISM% /Split-Image /ImageFile:%~1 /SWMFile:%~2 /FileSize:%~3
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to merge a splitted Image
:: Input Parameters [ %~1 : Image Splitted Filename without Extension, %~2 : Image Filename ]
::-------------------------------------------------------------------------------------------
:MergeImage

%Imagex% /ref %~1*.swm /Check /Export %~1.swm * %~2

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

::-------------------------------------------------------------------------------------------
:: Function to apply a Image to a drive or a folder
:: Input Parameters [ %~1 : Image Filename, %~2 : Image Index No, %~3 : Image Apply Drive or folder Name ]
::-------------------------------------------------------------------------------------------
:ApplyImage

%DISM% /Apply-Image /ImageFile:%~1 /Index:%~2 /ApplyDir:%~3\ /CheckIntegrity /Verify
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to capture a drive or a folder to a Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Capture Drive or Folder Name,
::                    %~3 : Index Name,  %~4 : Index Description, %~5 : Bootable or Not Options ]
::-------------------------------------------------------------------------------------------
: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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to append another Image to Image
:: Input Parameters [ %~1 : Image Filename, %~2 : Capture Drive or Folder Name,
::                    %~3 : Index Name,  %~4 : Index Description, %~5 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
: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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export a select Image Index with Maximum/Recovery compression
:: Input Parameters [ %~1 : Source Image Filename, %~2 : Source Image Index No,
::                    %~3 : Target Image Filename, %~4 : Image Format, %~5 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
: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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to export all Image Indexes with Maximum/Recovery compression
:: Input Parameters [ %~1 : Source Image Filename, %~2 : Target Image Filename, %~3 : Image Format, %~4 : Bootable or Not Option ]
::-------------------------------------------------------------------------------------------
: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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to cleanup a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Option  ]
::-------------------------------------------------------------------------------------------
: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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to add driver packages to Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Drivers Packages Path ]
::-------------------------------------------------------------------------------------------
:AddDriver

%DISM% /Image:%~1 /Add-Driver /Driver:%~2 /ForceUnsigned /Recurse
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to enable a feature inside a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Feature Name ]
::-------------------------------------------------------------------------------------------
:EnableFeature

%DISM% /Image:%~1 /Enable-Feature /FeatureName:%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to disable a feature inside a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Feature Name ]
::-------------------------------------------------------------------------------------------
:DisableFeature

%DISM% /Image:%~1 /Disable-Feature /FeatureName:%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to export a list of packages present inside a Image to a file
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Filename ]
::-------------------------------------------------------------------------------------------
:GetPackages

%DISM% /Get-Packages /Image:%~1 > %Logs%\%~2

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

::-------------------------------------------------------------------------------------------
:: Function to export the list of features present inside a Image to a file
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Filename ]
::-------------------------------------------------------------------------------------------
:GetFeatures

%DISM% /Get-Features /Format:Table /Image:%~1 > %Logs%\%~2

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

::-------------------------------------------------------------------------------------------
:: Function to add a Package to Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Packages Path / Package Name ]
::-------------------------------------------------------------------------------------------
:AddPackage

%DISM% /Image:%~1 /Add-Package /PackagePath:%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to remove a Package from a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Packages Path / Package Name ]
::-------------------------------------------------------------------------------------------
:RemovePackage

%DISM% /Image:%~1 /Remove-Package /PackageName:%~2
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to add a provisioned appx package to a Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Name, %~3 : App Package Path, %~4 : App License Path, %~5 : App Dependency Packages Path ]
::-------------------------------------------------------------------------------------------
:AddProvisionedAppxPackage

echo.-------------------------------------------------------------------------------
echo.ÕýÔÚ¼¯³É %~2 Ô¤ÅäµÄ Appx Èí¼þ°ü...
echo.-------------------------------------------------------------------------------
%DISM% /Image:%~1 /Add-ProvisionedAppxPackage /PackagePath:%~3 /LicensePath:%~4 %~5
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to remove provisioned appx package from the Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Name, %~3 : Package Name ]
::-------------------------------------------------------------------------------------------
:RemoveProvisionedAppxPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.ÕýÔÚÒÆ³ý %~2 Ô¤Åä Appx Èí¼þ°ü...
echo.-------------------------------------------------------------------------------

:: Getting Provisioned Appx Package list
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 (
	:: Removing Provisioned Appx Package from the Image
	%DISM% /Image:%~1 /Remove-ProvisionedAppxPackage /PackageName:%PackageName%
)

echo.

set PackageName=

endlocal

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

::-------------------------------------------------------------------------------------------
:: Function to remove the default application associations from the Windows image
:: Input Parameters [ %~1 : Image Mount Path ]
::-------------------------------------------------------------------------------------------
:RemoveDefaultAppAssociations

%DISM% /Image:%~1 /Remove-DefaultAppAssociations

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

::-------------------------------------------------------------------------------------------
:: Function to import a set of default application associations to a Windows image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : App Association XML Filename ]
::-------------------------------------------------------------------------------------------
:ImportDefaultAppAssociations

%DISM% /Image:%~1 /Import-DefaultAppAssociations:%~2

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

:: ############################################################################################
:: MSMG ToolKit Misc Functions
:: ############################################################################################

::-------------------------------------------------------------------------------------------
:: Function to remove a Locked/Hidden Windows Package from the Image
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Package Description, %~3 : Package Name ]
::-------------------------------------------------------------------------------------------
:RemoveLockedPackage

setlocal

set PackageName=

echo.-------------------------------------------------------------------------------
echo.ÕýÔÚÒÆ³ý %~2 Èí¼þ°ü...
echo.-------------------------------------------------------------------------------

:: Making Locked/Hidden Windows Package visible
call :UnHidePackage "%~1", %~3

:: Getting Windows Package List
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 (
	:: Removing Windows Package from the Image
	%DISM% /Image:%~1 /Remove-Package /PackageName:%PackageName%
	echo.
)

set PackageName=

endlocal

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

::-------------------------------------------------------------------------------------------
:: Function to mount Image Registry
:: Input Parameters [ %~1 : Image Mount Path ]
::-------------------------------------------------------------------------------------------
:MountImageRegistry

:: Mounting Image Registry for Offline Editing
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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Function to unmount Image Registry
:: Input Parameters [ None ]
::-------------------------------------------------------------------------------------------
:UnMountImageRegistry

:: ½â³ý°²×°Ó³Ïñ×¢²á±í
reg unload HKLM\TK_COMPONENTS >nul 2>&1
reg unload HKLM\TK_DRIVERS >nul 2>&1
reg unload HKLM\TK_DEFAULT >nul 2>&1
reg unload HKLM\TK_NTUSER >nul 2>&1
reg unload HKLM\TK_SCHEMA >nul 2>&1
reg unload HKLM\TK_SOFTWARE >nul 2>&1
reg unload HKLM\TK_SYSTEM >nul 2>&1

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

::-------------------------------------------------------------------------------------------
:: Function to import registry settings to Image Registry
:: Input Parameters [ %~1 : Import Registry file Name ]
::-------------------------------------------------------------------------------------------
:ImportRegistry2Image

:: µ¼Èë×¢²á±íÉèÖÃÓ³Ïñ×¢²á±í
reg import "%~1"

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

::-------------------------------------------------------------------------------------------
:: Function to Create a Folder
:: Input Parameters [ %~1 : Foldername ]
::-------------------------------------------------------------------------------------------
:CreateFolder

if not exist "%~1" md "%~1" >nul

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

::-------------------------------------------------------------------------------------------
:: Function to delete a file(s)
:: Input Parameters [ %~1 : Filename ]
::-------------------------------------------------------------------------------------------
:RemoveFile

if exist "%~1" del /f /q "%~1" >nul

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

::-------------------------------------------------------------------------------------------
:: Function to delete a folder(s)
:: Input Parameters [ %~1 : Foldername ]
::-------------------------------------------------------------------------------------------
:RemoveFolder

if exist "%~1" rd /q /s "%~1" >nul

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

::-------------------------------------------------------------------------------------------
:: Function to unhide a Windows Component Package
:: Input Parameters [ %~1 : Image Mount Path, %~2 : Package Name ]
::-------------------------------------------------------------------------------------------
:UnHidePackage

setlocal

set RegistryKey=

:: Mounting Image Registry
call :MountImageRegistry "%~1" >nul

:: Retriving Package Registry Key Path
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" )

:: Making Windows Components Package visible
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
::-------------------------------------------------------------------------------------------

::-------------------------------------------------------------------------------------------
:: Cleanup MSMG Toolkit's temporary files and folders
::-------------------------------------------------------------------------------------------
: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

for /l %%i in (1, 1, 50) do (
	if exist "%WinReMount%\%%i\Windows" Dism.exe /English /Unmount-Wim /MountDir:"%WinReMount%\%%i" /Discard >nul
	if exist "%InstallMount%\%%i\Windows" Dism.exe /English /Unmount-Wim /MountDir:"%InstallMount%\%%i" /Discard >nul
)

Dism.exe /English /Cleanup-Mountpoints >nul
Dism.exe /English /Cleanup-Wim >nul

:: Cleaning Up Images Mount Points Folders
call :RemoveFolder "%BootMount%"
call :CreateFolder "%BootMount%\1"
call :CreateFolder "%BootMount%\2"
call :RemoveFolder "%InstallMount%"
call :CreateFolder "%InstallMount%"
call :RemoveFolder "%WinReMount%"
call :CreateFolder "%WinReMount%"
echo.

:: Cleaning Up Logs Folders
echo.ÇåÀíÈÕÖ¾ÎÄ¼þ...
call :RemoveFolder "%Logs%"
call :CreateFolder "%Logs%"
echo.

:: Cleaning Up Temporary files Folders
echo.ÇåÀíÁÙÊ±ÎÄ¼þ...
call :RemoveFolder "%Temp%"
call :CreateFolder "%Temp%"

echo.
echo.Íê³ÉÇåÀí...
echo.

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

::-------------------------------------------------------------------------------------------
:: Function to quit MSMG Toolkit
::-------------------------------------------------------------------------------------------
:Quit

cls
echo.===============================================================================
echo. 	                    MSMG ToolKit - ÍË³ö
echo.===============================================================================
echo.
if "%IsSourceSelected%" equ "Yes" (
	echo.Ñ¡ÔñÁËÀ´Ô´²Ù×÷ÏµÍ³£¬Çë´Ó¡°Ó¦ÓÃ¡±Ö÷²Ëµ¥ÖÐÑ¡Ôñ¡°±£´æ/·ÅÆú¡±¡£
	echo.
	echo.===============================================================================
	echo.
	pause

	goto :Mainmenu
)
echo.ÕýÔÚÖ´ÐÐºóÆÚÇåÀí²Ù×÷£¬ÇëÉÔºò...
echo.
call :CleanUp
echo.¸ÐÐ» ^& ÖÂÐ» MDL µÄËùÓÐÈË...
echo.
echo.ÕýÔÚÍË³ö MSMG ToolKit...
echo.
echo.===============================================================================
echo.
pause

:: Restoring DOS Window Size
reg delete "HKCU\Console\%%SystemRoot%%_system32_cmd.exe" /f >nul

color 00
endlocal EnableExtensions EnableDelayedExpansion

exit