add multilingual support to windows 8_1 setup dvd - automated batch script

33
ADD MULTILINGUAL SUPPORT TO WINDOWS 8.1 SETUP DVD - AUTOMATED BATCH SCRIPT A mostly automated way to add one or more language packs to Windows 8.1 DVD, with the end result being a fully multilingual ISO, including: - Choice of language at setup - Language packs preinstalled so that you can switch between them in Windows 8.1 - Multilingual Windows 8.1 Recovery Environment (with a choice of language at boot) Requirements: - Working Windows 8.1 or 8 or 7 system (x86 or x64) with at least 15GB of free space. - Windows 8.1 x86 or x64 installation DVD / USB or ISO mounted as a virtual drive. - Windows Assessment and Deployment Kit (Windows ADK ) for Windows 8.1 installed. - Language pack (CAB) files for the languages you want to add. you can get them from the Repository , or see the Bonus in 2nd post. How To: Step 1 Create a directory on a partition with enough space on it - at least 15GB of free space required, depending on the number of LPs you are adding! (e.g. C:\MUIDVD) To spare yourself absolutely pointless trouble, keep the path short, do not use stupid paths with spaces and do not use non- ASCII chars anywhere in the path. Step 2 Get the script and save the script to the directory your created, (E.g. save as C:\MUIDVD\MUI.cmd) Step 3 Copy the language pack(s) CAB(s) to the above directory as well. Suggest to use a subdirectory for each language (e.g. C:\ MUIDVD\langpacks\de-de\lp.cab).

Upload: yselimk

Post on 25-Oct-2015

731 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

ADD MULTILINGUAL SUPPORT TO WINDOWS 8.1 SETUP DVD - AUTOMATED BATCH SCRIPT

A mostly automated way to add one or more language packs to Windows 8.1 DVD, with the end result being a fully multilingual ISO, including:- Choice of language at setup- Language packs preinstalled so that you can switch between them in Windows 8.1- Multilingual Windows 8.1 Recovery Environment (with a choice of language at boot)

Requirements:- Working Windows 8.1 or 8 or 7 system (x86 or x64) with at least 15GB of free space.- Windows 8.1 x86 or x64 installation DVD / USB or ISO mounted as a virtual drive.- Windows Assessment and Deployment Kit (Windows ADK) for Windows 8.1 installed.- Language pack (CAB) files for the languages you want to add.you can get them from the Repository, or see the Bonus in 2nd post.

How To:

Step 1Create a directory on a partition with enough space on it - at least 15GB of free space required, depending on the number of LPs you are adding! (e.g. C:\MUIDVD)To spare yourself absolutely pointless trouble, keep the path short, do not use stupid paths with spaces and do not use non-ASCII chars anywhere in the path.

Step 2Get the script and save the script to the directory your created, (E.g. save as C:\MUIDVD\MUI.cmd)

Step 3Copy the language pack(s) CAB(s) to the above directory as well. Suggest to use a subdirectory for each language (e.g. C:\MUIDVD\langpacks\de-de\lp.cab).Note: Do not forget to adjust LPFILEn path(s) accordingly in the script!

Step 4You will need to adjust the following variables as required at the top of the script:Mandatory to set:ARCH - the iso image architecture, "x86" for 32 bit or "amd64" for 64 bitLANGUAGES - Number of language packs to add (it's not recommended to exceed 10 languages!).LPFILEn - Path and file names of the language packs without quotation marks (e.g. C:\MUIDVD\langpacks\de-de\lp.cab)LANGUAGEn - code of the language packs (e.g. de-de, fr-fr), see the list here (culture name)DEFAULTLANGUAGE - Default system UI language, the language for non-Unicode programs, the "standards and formats" language, the input locales, the keyboard layouts and time zone values to the specified languageDEFAULTTIMEZONE - Default time zone in the Windows image, see the list hereSETUPLANGUAGE - Default language that will be used by setupOptional: (do not mess with this unless you know what you are doing)DVDDIR - Temporary directory to store the DVD contentsDVDISO - Path and filename for the ISO output file

Page 2: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

DVDLABEL - The ISO labelDVDBOOT - The ISO support for BIOS only or both BIOS and UEFI, set "bios" or "uefi"TEMPDIR - Root directory for other temporary working directories

Note: Do NOT mess with anything after the following lines!

Code:

rem ##################################################################

rem # NORMALY THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS COMMENT #

rem ##################################################################

Step 5Mount Windows 8.1 iso as virtual drive, or insert its DVD, USB (make sure you mounted/inserted only one dvd).

Step 6Double/triple-check that all your settings are correct and that the LPs CAB file(s) are in the proper location.After that, execute the script as Administrator

Step 7This process will take quite some time to finish, depending on number of LPs to add. Get some beer/coffee/joint and WAIT.

If all went OK:You will get the following message after all is finished:

Code:

============================================================

Done

The new multilingual ISO can be found in the same directory where you stored the script - e.g. C:\MUIDVD\mu_windows_8_1_x86_dvd.iso or C:\MUIDVD\mu_windows_8_1_x64_dvd.iso.

If you customized DVDISO variable, you need to look there instead.

Important Note:

The script is ment for localizing the Untouched original Windows 8.1 ISO's.

Page 3: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

but it's still supports the custom-made ISO's (such as Core/Pro/WMC/Enterprise AIO), with one condition: all the images in install.wim must be for one same architecture (x86 or x64).

and if you already enabled .NET 3.5, don't forget to remark/remove its lines from the script accordingly.

MUI.cmd

@echo off

pushd "%~dp0"

set WORKDIR=%~dp0

set ARCH=amd64

set LANGUAGES=2

set LPFILE1=%WORKDIR%langpacks\de-de\lp.cab

set LPFILE2=%WORKDIR%langpacks\fr-fr\lp.cab

set LPFILE3=

set LPFILE4=

set LPFILE5=

set LPFILE6=

set LPFILE7=

set LPFILE8=

set LPFILE9=

set LANGUAGE1=de-de

set LANGUAGE2=fr-fr

set LANGUAGE3=

set LANGUAGE4=

set LANGUAGE5=

set LANGUAGE6=

Page 4: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

set LANGUAGE7=

set LANGUAGE8=

set LANGUAGE9=

set DEFAULTLANGUAGE=de-de

set DEFAULTTIMEZONE="Central Europe Standard Time"

set SETUPLANGUAGE=de-de

set DVDDIR=%WORKDIR%DVD

set DVDISO=%WORKDIR%mu_windows_8_1_x86_dvd.iso

if "%ARCH%"=="amd64" set DVDISO=%WORKDIR%mu_windows_8_1_x64_dvd.iso

set DVDLABEL=IRM_CCSA_X86FRE_MUI_DV5

if "%ARCH%"=="amd64" set DVDLABEL=IRM_CCSA_X64FRE_MUI_DV5

set DVDBOOT=uefi

set TEMPDIR=%WORKDIR%TEMP

set EXTRACTDIR=%TEMPDIR%\extract

set LPEXTRACTDIR=%EXTRACTDIR%\langpack

set PEEXTRACTDIR=%EXTRACTDIR%\winpe

set MOUNTDIR=%WORKDIR%MOUNT

set INSTALLMOUNTDIR=%MOUNTDIR%\install

set WINREMOUNTDIR=%MOUNTDIR%\winre

set BOOTMOUNTDIR=%MOUNTDIR%\boot

rem ##################################################################

Page 5: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

rem # NORMALY THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS COMMENT #

rem ##################################################################

for %%A in (D E F G H I J K L M N O P Q R S T U V W X) do (if exist %%A:\sources\install.wim set DVDDRIVE=%%A:)

IF /I %PROCESSOR_ARCHITECTURE%==x86 (

IF NOT "%PROCESSOR_ARCHITEW6432%"=="" (

SET PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITEW6432%

)

) ELSE IF /I NOT %PROCESSOR_ARCHITECTURE%==amd64 (

@echo Not implemented for PROCESSOR_ARCHITECTURE of %PROCESSOR_ARCHITECTURE%.

goto :EOF

)

SET regKeyPathFound=1

SET wowRegKeyPathFound=1

REG QUERY "HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots" /v KitsRoot81 1>NUL 2>NUL || SET wowRegKeyPathFound=0

REG QUERY "HKLM\Software\Microsoft\Windows Kits\Installed Roots" /v KitsRoot81 1>NUL 2>NUL || SET regKeyPathFound=0

if %wowRegKeyPathFound% EQU 0 (

if %regKeyPathFound% EQU 0 (

goto :E_KITPATH

) else (

SET regKeyPath=HKLM\Software\Microsoft\Windows Kits\Installed Roots

Page 6: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

)

) else (

SET regKeyPath=HKLM\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots

)

FOR /F "skip=2 tokens=2*" %%i IN ('REG QUERY "%regKeyPath%" /v KitsRoot81') DO (SET KitsRoot=%%j)

SET DandIRoot=%KitsRoot%Assessment and Deployment Kit\Deployment Tools

SET WinPERoot=%KitsRoot%Assessment and Deployment Kit\Windows Preinstallation Environment

SET DISMRoot=%DandIRoot%\%PROCESSOR_ARCHITECTURE%\DISM

SET OSCDImgRoot=%DandIRoot%\%PROCESSOR_ARCHITECTURE%\Oscdimg

SET NewPath=%DISMRoot%;%OSCDImgRoot%;%WinPERoot%;

SET PATH=%NewPath:"=%;%PATH%

rem set count of available Windows images in install.wim

FOR /F "tokens=3 delims=:, " %%i IN ('IMAGEX /INFO %DVDDRIVE%\sources\install.wim ^| findstr "Count"') DO (SET VERSIONS=%%i)

setlocal EnableDelayedExpansion

echo.

echo ============================================================

echo Remove temporary directories if they already exist

echo ============================================================

echo.

if exist "%DVDDIR%" rmdir /s /q "%DVDDIR%"

if errorlevel 1 goto :E_DELDIR

if exist "%TEMPDIR%" rmdir /s /q "%TEMPDIR%"

Page 7: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

if errorlevel 1 goto :E_DELDIR

if exist "%MOUNTDIR%" rmdir /s /q "%MOUNTDIR%"

if errorlevel 1 goto :E_DELDIR

echo.

echo ============================================================

echo Create directories

echo ============================================================

echo.

mkdir "%DVDDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%TEMPDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%LPEXTRACTDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%PEEXTRACTDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%MOUNTDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%INSTALLMOUNTDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%WINREMOUNTDIR%"

if errorlevel 1 goto :E_MKDIR

mkdir "%BOOTMOUNTDIR%"

if errorlevel 1 goto :E_MKDIR

Page 8: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo.

echo ============================================================

echo Copy DVD contents to %DVDDIR%

echo ============================================================

echo.

echo DVD drive %DVDDRIVE%

echo.

xcopy "%DVDDRIVE%\*.*" "%DVDDIR%" /ef

echo.

echo ============================================================

echo Copy language packs to %TEMPDIR%

echo ============================================================

echo.

set /A COUNTER=1

:LOOP

if not exist "!LPFILE%COUNTER%!" goto :E_LPFILE

copy "!LPFILE%COUNTER%!" "%TEMPDIR%\!LANGUAGE%COUNTER%!.cab" /y

set /A COUNTER+=1

if %COUNTER% LEQ %LANGUAGES% goto :LOOP

echo.

echo ============================================================

echo Add language packs to the installation image

echo ============================================================

echo.

Page 9: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

for /L %%i in (1, 1, %VERSIONS%) do (

echo.

echo ============================================================

echo Mount install.wim - index %%i of %VERSIONS%

echo ============================================================

echo.

dism.exe /Mount-Wim /Wimfile:"%DVDDIR%\sources\install.wim" /Index:%%i /MountDir:"%INSTALLMOUNTDIR%"

if errorlevel 1 goto :E_MOUNT

echo.

echo ============================================================

echo Enabling .NET Framework 3.5 to avoid complications

echo ============================================================

echo.

dism.exe /Image:"%INSTALLMOUNTDIR%" /Enable-Feature /Featurename:NetFx3 /All /LimitAccess /Source:"%DVDDIR%\sources\sxs"

echo.

echo ============================================================

echo Add language packs to install.wim - index %%i of %VERSIONS%

echo ============================================================

echo.

for /L %%j in (1, 1, %LANGUAGES%) do (

dism.exe /Image:"%INSTALLMOUNTDIR%" /Add-Package /PackagePath:"%TEMPDIR%\!LANGUAGE%%j!.cab"

)

echo.

Page 10: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo ============================================================

echo Update image default settings - index %%i of %VERSIONS%

echo ============================================================

echo.

dism.exe /Image:"%INSTALLMOUNTDIR%" /Gen-LangIni /Distribution:"%DVDDIR%"

dism.exe /Image:"%INSTALLMOUNTDIR%" /Set-AllIntl:%DEFAULTLANGUAGE%

dism.exe /Image:"%INSTALLMOUNTDIR%" /Set-SKUIntlDefaults:%DEFAULTLANGUAGE%

dism.exe /Image:"%INSTALLMOUNTDIR%" /Set-TimeZone:%DEFAULTTIMEZONE%

dism.exe /Image:"%INSTALLMOUNTDIR%" /Set-SetupUILang:%SETUPLANGUAGE% /Distribution:"%DVDDIR%"

echo.

if not exist "%TEMPDIR%\winre.wim" copy "%INSTALLMOUNTDIR%\Windows\System32\Recovery\winre.wim" "%TEMPDIR%\" /y >nul

echo.

echo ============================================================

echo Unmount install.wim - index %%i of %VERSIONS%

echo ============================================================

echo.

dism.exe /Unmount-Wim /MountDir:"%INSTALLMOUNTDIR%" /Commit

if errorlevel 1 goto :E_UNMOUNT

)

echo.

echo ============================================================

echo Add language packs to the WinRE image

echo ============================================================

Page 11: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo.

echo.

echo ============================================================

echo Mount winre.wim

echo ============================================================

echo.

dism.exe /Mount-Wim /Wimfile:"%TEMPDIR%\winre.wim" /Index:1 /MountDir:"%WINREMOUNTDIR%"

if errorlevel 1 goto :E_MOUNT

echo.

echo ============================================================

echo Add language packs to winre.wim

echo ============================================================

echo.

for /L %%j in (1, 1, %LANGUAGES%) do (

dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\lp.cab"

dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-EnhancedStorage_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Scripting_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SecureStartup_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SRT_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WDS-Tools_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WMI_!LANGUAGE%%j!.cab"

if "!LANGUAGE%%j!"=="ja-jp" dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-JA-JP.cab"

Page 12: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

if "!LANGUAGE%%j!"=="ko-kr" dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-KO-KR.cab"

if "!LANGUAGE%%j!"=="zh-cn" dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-CN.cab"

if "!LANGUAGE%%j!"=="zh-hk" dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-HK.cab"

if "!LANGUAGE%%j!"=="zh-tw" dism.exe /Image:"%WINREMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-TW.cab"

)

echo.

echo ============================================================

echo Update default settings of winre.wim

echo ============================================================

echo.

dism.exe /Image:"%WINREMOUNTDIR%" /Gen-LangIni /Distribution:"%WINREMOUNTDIR%"

dism.exe /Image:"%WINREMOUNTDIR%" /Set-AllIntl:%DEFAULTLANGUAGE%

dism.exe /Image:"%WINREMOUNTDIR%" /Set-SKUIntlDefaults:%DEFAULTLANGUAGE%

dism.exe /Image:"%WINREMOUNTDIR%" /Set-TimeZone:%DEFAULTTIMEZONE%

dism.exe /Image:"%WINREMOUNTDIR%" /Set-SetupUILang:%SETUPLANGUAGE% /Distribution:"%WINREMOUNTDIR%"

echo.

echo ============================================================

echo Unmount winre.wim

echo ============================================================

Page 13: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo.

dism.exe /Unmount-Wim /MountDir:"%WINREMOUNTDIR%" /Commit

if errorlevel 1 goto :E_UNMOUNT

echo.

echo ============================================================

echo Rebuild winre.wim

echo ============================================================

echo.

IMAGEX /BOOT /EXPORT "%TEMPDIR%\winre.wim" 1 "%TEMPDIR%\winre2.wim"

DEL /S /F /Q "%TEMPDIR%\winre.wim" >nul

REN "%TEMPDIR%\winre2.wim" winre.wim

echo.

echo ============================================================

echo Add updated winre.wim to the installation image

echo ============================================================

echo.

for /L %%i in (1, 1, %VERSIONS%) do (

echo.

echo ============================================================

echo Mount install.wim - index %%i of %VERSIONS%

echo ============================================================

echo.

dism.exe /Mount-Wim /Wimfile:"%DVDDIR%\sources\install.wim" /Index:%%i /MountDir:"%INSTALLMOUNTDIR%"

if errorlevel 1 goto :E_MOUNT

Page 14: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo.

echo ============================================================

echo Update winre.wim - %%i of %VERSIONS%

echo ============================================================

echo.

copy "%TEMPDIR%\winre.wim" "%INSTALLMOUNTDIR%\Windows\System32\Recovery\" /y

echo.

echo ============================================================

echo Unmount install.wim - index %%i of %VERSIONS%

echo ============================================================

echo.

dism.exe /Unmount-Wim /MountDir:"%INSTALLMOUNTDIR%" /Commit

if errorlevel 1 goto :E_UNMOUNT

)

echo.

echo ============================================================

echo Rebuild install.wim

echo ============================================================

echo.

IMAGEX /EXPORT "%DVDDIR%\sources\install.wim" * "%DVDDIR%\sources\install2.wim"

DEL /S /F /Q "%DVDDIR%\sources\install.wim" >nul

REN "%DVDDIR%\sources\install2.wim" install.wim

echo.

Page 15: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo ============================================================

echo Add language packs to the boot images

echo ============================================================

echo.

echo.

echo ============================================================

echo Mount boot.wim - index 1 of 2

echo ============================================================

echo.

dism.exe /Mount-Wim /WimFile:"%DVDDIR%\sources\boot.wim" /Index:1 /MountDir:"%BOOTMOUNTDIR%"

if errorlevel 1 goto :E_MOUNT

echo.

echo ============================================================

echo Add language packs to boot.wim - index 1 of 2

echo ============================================================

echo.

for /L %%j in (1, 1, %LANGUAGES%) do (

dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\lp.cab"

dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-EnhancedStorage_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Scripting_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SecureStartup_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SRT_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WDS-Tools_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WMI_!LANGUAGE%%j!.cab"

Page 16: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

if "!LANGUAGE%%j!"=="ja-jp" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-JA-JP.cab"

if "!LANGUAGE%%j!"=="ko-kr" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-KO-KR.cab"

if "!LANGUAGE%%j!"=="zh-cn" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-CN.cab"

if "!LANGUAGE%%j!"=="zh-hk" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-HK.cab"

if "!LANGUAGE%%j!"=="zh-tw" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-TW.cab"

)

echo.

echo ============================================================

echo Update default settings of boot.wim - index 1 of 2

echo ============================================================

echo.

dism.exe /Image:"%BOOTMOUNTDIR%" /Gen-LangIni /Distribution:"%BOOTMOUNTDIR%"

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-AllIntl:%DEFAULTLANGUAGE%

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-SKUIntlDefaults:%DEFAULTLANGUAGE%

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-TimeZone:%DEFAULTTIMEZONE%

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-SetupUILang:%SETUPLANGUAGE% /Distribution:"%BOOTMOUNTDIR%"

echo.

echo ============================================================

Page 17: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo Unmount boot.wim - index 1 of 2

echo ============================================================

echo.

dism.exe /Unmount-Wim /MountDir:"%BOOTMOUNTDIR%" /Commit

if errorlevel 1 goto :E_UNMOUNT

echo.

echo ============================================================

echo Mount boot.wim - index 2 of 2

echo ============================================================

echo.

dism.exe /Mount-Wim /WimFile:"%DVDDIR%\sources\boot.wim" /Index:2 /MountDir:"%BOOTMOUNTDIR%"

if errorlevel 1 goto :E_MOUNT

echo.

echo ============================================================

echo Add language packs to boot.wim - index 2 of 2

echo ============================================================

echo.

for /L %%j in (1, 1, %LANGUAGES%) do (

dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\lp.cab"

dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-EnhancedStorage_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Scripting_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SecureStartup_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Setup_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Setup-Client_!LANGUAGE%%j!.cab"

Page 18: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

/PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-SRT_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WDS-Tools_!LANGUAGE%%j!.cab" /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-WMI_!LANGUAGE%%j!.cab"

if "!LANGUAGE%%j!"=="ja-jp" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-JA-JP.cab"

if "!LANGUAGE%%j!"=="ko-kr" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-KO-KR.cab"

if "!LANGUAGE%%j!"=="zh-cn" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-CN.cab"

if "!LANGUAGE%%j!"=="zh-hk" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-HK.cab"

if "!LANGUAGE%%j!"=="zh-tw" dism.exe /Image:"%BOOTMOUNTDIR%" /Add-Package /PackagePath:"%WinPERoot%\%ARCH%\WinPE_OCs\WinPE-FontSupport-ZH-TW.cab"

)

echo.

echo ============================================================

echo Update default settings of boot.wim - index 2 of 2

echo ============================================================

echo.

dism.exe /Image:"%BOOTMOUNTDIR%" /Gen-LangIni /Distribution:"%BOOTMOUNTDIR%"

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-AllIntl:%DEFAULTLANGUAGE%

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-SKUIntlDefaults:%DEFAULTLANGUAGE%

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-TimeZone:%DEFAULTTIMEZONE%

Page 19: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

dism.exe /Image:"%BOOTMOUNTDIR%" /Set-SetupUILang:%SETUPLANGUAGE% /Distribution:"%BOOTMOUNTDIR%"

echo.

echo ============================================================

echo Unmount boot.wim - index 2 of 2

echo ============================================================

echo.

dism.exe /Unmount-Wim /MountDir:"%BOOTMOUNTDIR%" /Commit

if errorlevel 1 goto :E_UNMOUNT

echo.

echo ============================================================

echo Rebuild boot.wim

echo ============================================================

echo.

IMAGEX /BOOT /EXPORT "%DVDDIR%\sources\boot.wim" * "%DVDDIR%\sources\boot2.wim"

DEL /S /F /Q "%DVDDIR%\sources\boot.wim" >nul

REN "%DVDDIR%\sources\boot2.wim" boot.wim

echo.

echo ============================================================

echo Add language pack files to the DVD folders

echo ============================================================

echo.

for /L %%j in (1, 1, %LANGUAGES%) do (

echo.

Page 20: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

echo ============================================================

echo Extract language pack !LANGUAGE%%j!

echo ============================================================

echo.

mkdir "%LPEXTRACTDIR%\!LANGUAGE%%j!"

expand.exe "%TEMPDIR%\!LANGUAGE%%j!.cab" -f:* "%LPEXTRACTDIR%\!LANGUAGE%%j!" >nul

echo.

echo ============================================================

echo Extract WinPE language pack !LANGUAGE%%j!

echo ============================================================

echo.

mkdir "%PEEXTRACTDIR%\!LANGUAGE%%j!"

expand.exe "%WinPERoot%\%ARCH%\WinPE_OCs\!LANGUAGE%%j!\WinPE-Setup_!LANGUAGE%%j!.cab" -f:* "%PEEXTRACTDIR%\!LANGUAGE%%j!" >nul

echo.

echo ============================================================

echo Copy language pack files to the DVD folder - !LANGUAGE%%j!

echo ============================================================

echo.

dir /b /s "%LPEXTRACTDIR%\!LANGUAGE%%j!\bootsect.exe.mui" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\boot\!LANGUAGE%%j!\" /chrkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\*" "%DVDDIR%\sources\!LANGUAGE%%j!" /cherkyi >nul

rmdir /s /q "%DVDDIR%\sources\sxs"

Page 21: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

rmdir /s /q "%DVDDIR%\sources\!LANGUAGE%%j!\cli"

rmdir /s /q "%DVDDIR%\sources\!LANGUAGE%%j!\dlmanifests"

rmdir /s /q "%DVDDIR%\sources\!LANGUAGE%%j!\etwproviders"

rmdir /s /q "%DVDDIR%\sources\!LANGUAGE%%j!\replacementmanifests"

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\cli\*" "%DVDDIR%\sources\!LANGUAGE%%j!" /cherkyi >nul

dir /b /s "%LPEXTRACTDIR%\!LANGUAGE%%j!\credits.rtf" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

dir /b /s "%LPEXTRACTDIR%\!LANGUAGE%%j!\erofflps.txt" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

dir /b /s "%LPEXTRACTDIR%\!LANGUAGE%%j!\oobe_help_opt_in_details.rtf" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

dir /b /s "%LPEXTRACTDIR%\!LANGUAGE%%j!\privacy.rtf" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

dir /b /s "%PEEXTRACTDIR%\!LANGUAGE%%j!\setup_help_upgrade_or_custom.rtf" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

dir /b /s "%PEEXTRACTDIR%\!LANGUAGE%%j!\vofflps.rtf" > "%TEMPDIR%\search.txt"

for /f "delims=" %%a in (%TEMPDIR%\search.txt) do xcopy "%%a" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

Page 22: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

if "!LANGUAGE%%j!"=="ar-sa" if "%ARCH%"=="x86" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\x86_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_ar-sa_a15b161a718b1963\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

if "!LANGUAGE%%j!"=="bg-bg" if "%ARCH%"=="x86" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\x86_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_bg-bg_479af7a3620b6aba\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

if "!LANGUAGE%%j!"=="el-gr" if "%ARCH%"=="x86" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\x86_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_el-gr_35a0113436c5000c\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

if "!LANGUAGE%%j!"=="ar-sa" if "%ARCH%"=="amd64" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\amd64_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_ar-sa_fd79b19e29e88a99\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

if "!LANGUAGE%%j!"=="bg-bg" if "%ARCH%"=="amd64" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\amd64_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_bg-bg_a3b993271a68dbf0\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

if "!LANGUAGE%%j!"=="el-gr" if "%ARCH%"=="amd64" xcopy "%PEEXTRACTDIR%\!LANGUAGE%%j!\amd64_microsoft-windows-i..edia-base.resources_31bf3856ad364e35_6.3.9600.16384_el-gr_91beacb7ef227142\*.rtf" "%DVDDIR%\sources\!LANGUAGE%%j!\" /chrkyi >nul

mkdir "%DVDDIR%\sources\dlmanifests\!LANGUAGE%%j!"

if "%ARCH%"=="x86" xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\dlmanifests\microsoft-windows-iasserver-migplugin\*" "%DVDDIR%\sources\dlmanifests\microsoft-windows-iasserver-migplugin\!LANGUAGE%%j!\" /cherkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\dlmanifests\microsoft-windows-storagemigration\*" "%DVDDIR%\sources\dlmanifests\microsoft-windows-storagemigration\!LANGUAGE%%j!\" /cherkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\dlmanifests\microsoft-windows-sxs\*" "%DVDDIR%\sources\dlmanifests\microsoft-windows-sxs\!LANGUAGE%%j!\" /cherkyi >nul

Page 23: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\etwproviders\*" "%DVDDIR%\sources\etwproviders\!LANGUAGE%%j!\" /cherkyi >nul

mkdir "%DVDDIR%\sources\replacementmanifests\!LANGUAGE%%j!"

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\replacementmanifests\microsoft-windows-offlinefiles-core\*" "%DVDDIR%\sources\replacementmanifests\microsoft-windows-offlinefiles-core\!LANGUAGE%%j!\" /cherkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\replacementmanifests\microsoft-windows-storagemigration\*" "%DVDDIR%\sources\replacementmanifests\microsoft-windows-storagemigration\!LANGUAGE%%j!\" /cherkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\replacementmanifests\microsoft-windows-sxs\*" "%DVDDIR%\sources\replacementmanifests\microsoft-windows-sxs\!LANGUAGE%%j!\" /cherkyi >nul

xcopy "%LPEXTRACTDIR%\!LANGUAGE%%j!\setup\sources\!LANGUAGE%%j!\etwproviders\*" "%DVDDIR%\support\logging\!LANGUAGE%%j!\" /cherkyi >nul

del /f /q "%TEMPDIR%\search.txt" >nul

)

echo.

echo ============================================================

echo Create Windows 8.1 MUI ISO

echo ============================================================

echo.

if "%DVDBOOT%"=="uefi" (

oscdimg.exe -bootdata:2#p0,e,b"%DVDDIR%\boot\etfsboot.com"#pEF,e,b"%DVDDIR%\efi\Microsoft\boot\efisys.bin" -o -h -u2 -m -udfver102 -l"%DVDLABEL%" "%DVDDIR%" "%DVDISO%"

Page 24: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

) else (

oscdimg.exe -u1 -b"%DVDDIR%\boot\etfsboot.com" -l"%DVDLABEL%" "%DVDDIR%" "%DVDISO%"

)

if errorlevel 1 goto :E_CREATEISO

echo.

echo ============================================================

echo Remove temporary directories

echo ============================================================

echo.

if exist "%DVDDIR%" rmdir /s /q "%DVDDIR%"

if errorlevel 1 goto :E_DELDIR

if exist "%TEMPDIR%" rmdir /s /q "%TEMPDIR%"

if errorlevel 1 goto :E_DELDIR

if exist "%MOUNTDIR%" rmdir /s /q "%MOUNTDIR%"

if errorlevel 1 goto :E_DELDIR

goto :DONE

:E_KITPATH

cls

set MESSAGE=ERROR: Could not find the ADK directory!

goto :END

:E_DELDIR

Page 25: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

cls

set MESSAGE=ERROR: Could not delete temporary directory!

goto :END

:E_MKDIR

cls

set MESSAGE=ERROR: Could not create temporary directory!

goto :END

:E_LPFILE

cls

set MESSAGE=ERROR: Could not find language pack!

goto :END

:E_MOUNT

cls

set MESSAGE=ERROR: Could not mount WIM image!

goto :END

:E_UNMOUNT

cls

set MESSAGE=ERROR: Could not unmount WIM image!

goto :END

Page 26: Add Multilingual Support to Windows 8_1 Setup DVD - Automated Batch Script

:E_CREATEISO

cls

set MESSAGE=ERROR: Could not create "%DVDISO%"!

goto :END

:DONE

set MESSAGE=Done

goto :END

:END

echo.

echo ============================================================

echo %MESSAGE%

echo ============================================================

echo.

echo Press any Key to Exit.

pause >nul

exit