Guide: Add Laguange to a win 7 installation and AIO Maker

Discussion in 'Windows 7' started by tjxd96, Aug 22, 2013.

  1. tjxd96

    tjxd96 MDL Novice

    Aug 2, 2013
    4
    0
    0
    #1 tjxd96, Aug 22, 2013
    Last edited by a moderator: Apr 20, 2017
    I have create this script because any of other things that we have doesn't work like a wanted, I have created this for my personal use and all should be working fine...
    I create this base on others scripts and in my knowledge, so: Thanks for: BubuXP, shadow_shd, ttmax, Tito, john1230 and Sabresite(this script didn't use his method to make a AIO DVD but I will probably make an update to add his method)


    To use all of it you have to have installed Waik from Microsoft, i cant post links but if you search you can download and install it without any troubles.


    This script will add a language to win 7 installation and for recovery and make a AIO installation with the new language
    There's nothing special or a big difference with the others methods. It is a semi-automated process.
    This script doesn't work with Enterprise and doesn't work to add Oriental languages, with some little modifications can do.
    You should have to customize your vars and make folders.

    First of all you have to copy the script to a batch file in your computer, if you don't know how do it the theory is the same of this video: (i cant post links, search in google: "how to create a batch file")

    To get all files that i used i downloaded:
    7601.17514.101119-1850_x86fre_client_localpacks-GRMCLPCKFRE_DVD.iso
    7601.17514.101119-1850_x64fre_client_localpacks-GRMCLPCKXFRE_DVD.iso
    Win 7 RTM 32BIT 64 BIT MultiLang Lcl Pk
    waik_supplement_pt-br
    Waik(from microsoft)("KB3AIK_EN")
    X17-59463.iso(Win 7 x86 SP1 Digital River direct links)
    X17-59465.iso(Win 7 x64 SP1 Digital River direct links)

    Making folders and extracting things.
    Our work directory has to have:
    ╠═══ [Extra] > OPTIONAL - contains extra files or folders that you want to add(ex: Drivers, Loaders, etc.)
    ╠═══ [DVD-x86] > with all folders and files from the Win7-x86 install DVD
    ╠═══ [DVD-x64] > with all folders and files from the Win7-x64 install DVD
    ╠═══ [LP-x86] > with your lp.cab and eventually Windows-LocalPack-XX-Package.cab
    ║. . . . ╠═══ [setup] > from lp.cab of your language
    ║. . . . ║. . . . ╠═══ [sources] > inside this are other folders, isn't the same folder "sources" below
    ║. . . . ╠═══ [sources] > from lp.cab of your language
    ║. . . . ║. . . . ╠═══ [licenses] > inside this are other folders
    ║. . . . ╠═══ [Language]
    ║. . . . ║. . . . ╠═══ ["your language"] ex: pt-BR, inside this should be the lp.cab
    ║. . . . ╠═══ [Local] > with local pack - OPTIONAL if your country isn't included
    ║. . . . ║. . . . ╠═══ [Windows-LocalPack-BR-Package.cab] > "BR" is just an example, should be changed to your country local pack.
    ║. . . . ╚═══ [WinPE] > with a dozen of .cab files - OPTIONAL if your language isn't included
    ╠═══ [LP-x64] > with your lp.cab and eventually Windows-LocalPack-XX-Package.cab
    ║. . . . ╠═══ [setup] > from lp.cab of your language
    ║. . . . ║. . . . ╠═══ [sources] > inside this are other folders, isn't the same folder "sources" below
    ║. . . . ╠═══ [sources] > from lp.cab of your language
    ║. . . . ║. . . . ╠═══ [licenses] > inside this are other folders
    ║. . . . ╠═══ [Language]
    ║. . . . ║. . . . ╠═══ ["your language"] ex: pt-BR, inside this should be the lp.cab
    ║. . . . ╠═══ [Local] > with local pack - OPTIONAL if your country isn't included
    ║. . . . ║. . . . ╠═══ [Windows-LocalPack-BR-Package.cab] > "BR" is just an example, should be changed to your country local pack.
    ║. . . . ╚═══ [WinPE] > with a dozen of .cab files - OPTIONAL if your language isn't included
    ╚═══ [mnt] > shoud been empty

    Customize the patches(they are kind of self explicate, but...):
    Set "WorkDirectory=D:\windows7" > This is our work directory where should have all folders above

    Set "OemLocation=C:\Users\Tjota\Desktop\custom win 7\Oem" > $oem$ location

    Set "ExtraLocation=D:\windows7\Extra" > Location of your Extra files

    Set "Lang=pt-BR" > Language code, have to be the language you are going to add, ex: en-US, fr-FR.(only 1 language can be add each time)
    Set "Country=BR" > This is your country code, this is only for the local pack

    Now you should customized the batch(you font need to do this).
    I will explain each one and you do what you think is better

    Call:CleanUp > This will clean any other mounted or corrupted mounted wim and clean our temp folder(should not uncomment this, but you can if you want to keep the temps files will not modify anything in your wim, but you can fast customize a win installation in the future with you keep this temp files)
    call:WimREMaker "x86" > This will create your x86 winRE
    call:BootWim "x86" > this will create your x86 BootWim
    call:InstallMaker "x86", "Starter", 1 > This will add a language to your X86 Starter install.wim
    call:InstallMaker "x86", "Home Basic", 2 > This will add a language to your X86 Home Basic install.wim
    call:InstallMaker "x86", "Home Premium", 3 > to customize this you can: "Change x86 to x64 to do a x64 version", "Change what type windows 7 installation you are going to create", "index of installation"
    call:MakeFinalInstall "x86" > This will create a install wim with all x86 versions on temp folder
    call:AddOem "x86" > This will add the folder %oem% for your dvd-x86, I recommend comment this with you want to create a AIO using my script(use This command with "AIO")
    call:Additional "x86" > This will add the extra folder for your dvd-x86, I recommend comment this with you want to create a AIO using my script(use This command with "AIO")
    call:MakeIso "x86" > This will create a x86 version win7 dvd installation with all changes
    call:MakeAIO "x86", "x64" > This will create a folder called DVD-AIO with a aio dvd
    call:AddOem "AIO" > Will add OEM folder to win 7 aio
    call:Additional "AIO" > Will copy extra folder to win 7 aio
    call:MakeISO "AIO" > win create a win 7 aio iso

    If you don't change anything in this commands you will get 3 iso(AIO,x86,x64) but only AIO with OEM and Extra folder(you can change this uncommenting the line call:addOem and call Additional)

    To run the script you should open a deployment tools command prompt(with administrator rights) and locate and run the script that you should copy from the post like a batch file.

    Finishing, this is my first guide ever and my English isn't fluent, so I hope this gets understandable and you guys can use my script without problems.
    Any doubt you can post here and i will help you if I can and if I see that you posted...
    If anyone uses this in your programs please contact me(just for my knowledge) and I possible put my credits.
    Any tips and tricks, post it :)

    And like always in my posts: Sorry for my bad English!



    Script:
    Code:
    @echo off
    
    Set "WorkDirectory=D:\windows7"
    Rem $oem$ location ex:
    Set "OemLocation=C:\Users\Tjota\Desktop\custom win 7\Oem"
    Rem Additional files location ex:
    Set "ExtraLocation=D:\windows7\Extra"
    
    Set "Lang=pt-BR"
    Set "Country=BR"
    
    
    
    Rem     ====================================
    Rem     =           x86 Process           ==
    Rem     ====================================
    Call:CleanUp
    call:WimREMaker "x86"
    call:BootWim "x86"
    call:InstallMaker  "x86", "Starter", 1 
    call:InstallMaker  "x86", "Home Basic", 2 
    call:InstallMaker  "x86", "Home Premium", 3
    call:InstallMaker  "x86", "Professional", 4
    call:InstallMaker  "x86", "Ultimate", 5
    call:MakeFinalInstall "x86"
    REM call:AddOem "x86"
    REM call:Additional "x86"
    call:MakeIso "x86"
    Call:CleanUp
    Rem     ====================================
    Rem     =           x64 Process           ==
    Rem     ====================================
    Call:CleanUp
    call:WimREMaker "x64"
    call:BootWim "x64"
    call:InstallMaker  "x64", "Home Basic", 1
    call:InstallMaker  "x64", "Home Premium", 2 
    call:InstallMaker  "x64", "Professional", 3
    call:InstallMaker  "x64", "Ultimate", 4
    call:MakeFinalInstall "x64"
    REM call:AddOem "x64"
    REM call:Additional "x64"
    call:MakeIso "x64"
    Call:CleanUp
    Rem     ====================================
    Rem     =          AIO MAKING             ==
    Rem     ====================================
    call:MakeAIO "x86", "x64"
    call:AddOem "AIO"
    call:Additional "AIO"
    call:MakeISO "AIO"
    
    
    
    
    
    
    REM ============================================================================================================
    REM
    REM                            Don´t touch bellow this, unless you know what you are doing!
    REM
    REM ============================================================================================================
    
    goto:eof
    :InstallMaker
    set bit=32 Bits
    IF /i %~1 NEQ x86 set bit=64 Bits
    imagex /export "%WorkDirectory%\DVD-%~1\sources\install.wim" %~3 "%WorkDirectory%\temp\install.wim"
    Dism /Mount-Wim /WimFile:"%WorkDirectory%\temp\install.wim" /index:1 /MountDir:"%WorkDirectory%\mnt" 
    Dism /image:"%WorkDirectory%\mnt" /add-package /packagepath:"%WorkDirectory%\LP-%~1\language\%Lang%\lp.cab"
    Dism /image:"%WorkDirectory%\mnt" /add-package  /packagepath:"%WorkDirectory%\LP-%~1\local\Windows-LocalPack-%Country%-Package.cab"
    copy /Y "%WorkDirectory%\Temp\winre%~1.wim" "%WorkDirectory%\mnt\windows\system32\recovery\winre.wim"
    Dism /image:"%WorkDirectory%\mnt" /Set-SKUIntlDefaults:%Lang%  /Gen-LangINI /Set-SetupUILang:%Lang%  /distribution:"%WorkDirectory%\DVD-%~1"
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    del "%WorkDirectory%\Temp\%~2-%~1.wim"
    imagex /export "%WorkDirectory%\temp\install.wim" 1 "%WorkDirectory%\Temp\%~2-%~1.wim"
    imagex /info "%WorkDirectory%\Temp\%~2-%~1.wim" 1 "Windows 7 %~2 Edition %bit%" "Install Windows 7 %~2 %~1 SP1"
    del "%WorkDirectory%\temp\install.wim"
    goto:eof
    
    
    :WimREMAker
    dism /Mount-Wim /WimFile:"%WorkDirectory%\DVD-%~1\sources\install.wim" /index:1 /MountDir:"%WorkDirectory%\mnt"
    Rem Making WimPE
    move /Y "%WorkDirectory%\mnt\windows\system32\recovery\winre.wim" "%WorkDirectory%\Temp"
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /discard 
    Rem Mounting WimPRE
    Dism /Mount-Wim /WimFile:"%WorkDirectory%\Temp\winre.wim" /index:1 /MountDir:"%WorkDirectory%\mnt"
    Dism /image:"%WorkDirectory%\mnt" /add-package /packagepath:"%WorkDirectory%\LP-%~1\WinPE\%Lang%"
    Rem Unmounting WimPE
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    Rem Compressing WIMPE
    del "%WorkDirectory%\Temp\winre%~1.wim"
    imagex /export /compress maximum "%WorkDirectory%\Temp\winre.wim" 1 "%WorkDirectory%\Temp\winre%~1.wim"
    del "%WorkDirectory%\Temp\winre.wim"
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    Rem Finished making WimPE
    echo DONE!
    goto:eof
    
    
    :BootWim
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    del "%WorkDirectory%\temp\boot.wim"
    imagex /export "%WorkDirectory%\DVD-%~1\sources\boot.wim" * "%WorkDirectory%\temp\boot.wim" 
    Dism /Mount-Wim /WimFile:"%WorkDirectory%\temp\boot.wim" /index:2 /MountDir:"%WorkDirectory%\mnt" 
    Dism /image:"%WorkDirectory%\mnt" /Add-Package /PackagePath:"%WorkDirectory%\LP-%~1\WinPE\%Lang%"
    Dism /image:"%WorkDirectory%\mnt" /Gen-LangINI /distribution:"%WorkDirectory%\mnt"
    dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    
    Dism /Mount-Wim /WimFile:"%WorkDirectory%\temp\boot.wim" /index:1 /MountDir:"%WorkDirectory%\mnt"
    Dism /image:"%WorkDirectory%\mnt" /Add-Package /PackagePath:"%WorkDirectory%\LP-%~1\WinPE\%Lang%"
    xcopy "%WorkDirectory%\mnt\Windows\Boot\DVD\PCAT\%Lang%\bootfix.bin" "%WorkDirectory%\DVD-%~1\boot\" /cheriky
    xcopy "%WorkDirectory%\mnt\Windows\boot\PCAT\memtest.exe" "%WorkDirectory%\DVD-%~1\boot\" /cheriky
    xcopy "%WorkDirectory%\mnt\Windows\boot\PCAT\%Lang%\*" "%WorkDirectory%\DVD-%~1\boot\%Lang%\" /cheriky
    xcopy "%WorkDirectory%\DVD-%~1\boot\%Lang%\*" "%WorkDirectory%\DVD-%~1\boot\en-US\" /cheriky
    Dism /Unmount-Wim /MountDir:"%WorkDirectory%\mnt" /commit
    
    del "%WorkDirectory%\temp\newboot.wim"
    imagex /export /boot /compress maximum "%WorkDirectory%\temp\boot.wim" * "%WorkDirectory%\temp\newboot.wim"
    del "%WorkDirectory%\temp\boot.wim"
    copy /Y "%WorkDirectory%\temp\newboot.wim" "%WorkDirectory%\DVD-%~1\sources\boot.wim"
    del "%WorkDirectory%\temp\newboot.wim"
    bcdedit /store "%WorkDirectory%\DVD-%~1\boot\bcd" /set {default} locale %Lang%
    bcdedit /store "%WorkDirectory%\DVD-%~1\efi\microsoft\boot\bcd" /set {default} locale %Lang%
    erase /F /Q /A:SH "%WorkDirectory%\DVD-%~1\boot\*.log*"
    erase /F /Q /A:SH "%WorkDirectory%\DVD-%~1\efi\microsoft\boot\*.log*"
    goto:eof
    
    :MakeFinalInstall
    Del "%WorkDirectory%\temp\install_final_%~1.wim"
    imagex /export /compress maximum  "%WorkDirectory%\temp\Starter-%~1.wim"       1 "%WorkDirectory%\temp\install-%~1.wim"
    imagex /export /compress maximum  "%WorkDirectory%\temp\Home Basic-%~1.wim"     1 "%WorkDirectory%\temp\install-%~1.wim"
    imagex /export /compress maximum  "%WorkDirectory%\temp\Home Premium-%~1.wim"   1 "%WorkDirectory%\temp\install-%~1.wim"
    imagex /export /compress maximum  "%WorkDirectory%\temp\Professional-%~1.wim"  1 "%WorkDirectory%\temp\install-%~1.wim"
    imagex /export /compress maximum  "%WorkDirectory%\temp\Ultimate-%~1.wim"      1 "%WorkDirectory%\temp\install-%~1.wim"
    xcopy "%WorkDirectory%\LP-%~1\setup\sources\*" "%WorkDirectory%\DVD-%~1\sources\" /cheriky
    xcopy "%WorkDirectory%\LP-%~1\sources\license\*" "%WorkDirectory%\DVD-%~1\sources\license\" /cheriky
    del /Y "%WorkDirectory%\Temp\winre%~1.wim"
    copy /Y "%WorkDirectory%\temp\install-%~1.wim" "%WorkDirectory%\DVD-%~1\sources\install.wim"
    del "%WorkDirectory%\DVD-%~1\sources\ei.cfg"
    del "%WorkDirectory%\DVD-%~1\sources\*.clg"
    set /a number=(%random% %% 325-0)*(%random% %% 327-0)*(%random% %% 326-0)+14387
    move /Y "%WorkDirectory%\Windows7-%~1.iso" "%WorkDirectory%\Windows7-%~1-backup-%number%.iso"
    set /a number=(%random% %% 325-0)*(%random% %% 327-0)*(%random% %% 326-0)+14387
    move /Y "%WorkDirectory%\Windows7-%~1.iso" "%WorkDirectory%\Windows7-%~1-backup-%number%.iso"
    goto:eof
    
    REM :MakeIso
    REM oscdimg -h -u2 -m -oc -b"%WorkDirectory%\DVD-%~1\boot\etfsboot.com"  -lWindows7 "%WorkDirectory%\DVD-%~1" "%WorkDirectory%\Windows7-%~1.iso"
    REM goto:eof
    
    :MakeAIO
    mkdir "%WorkDirectory%\DVD-AIO"
    xcopy "%WorkDirectory%\DVD-%~1\*" "%WorkDirectory%\DVD-AIO\" /cheriky 
    imagex /export /compress maximum  "%WorkDirectory%\DVD-%~2\sources\install.wim" * "%WorkDirectory%\DVD-AIO\sources\install.wim"
    copy "%WorkDirectory%\DVD-%~2\sources\boot.wim" "%WorkDirectory%\DVD-AIO\sources\boot%~2.wim"
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /set {default} device  ramdisk=[boot]\sources\boot%~2.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /set {default}  osdevice  ramdisk=[boot]\sources\boot%~2.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /copy {default} /d "%~2 Recovery Mode" 
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /set {default} device  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /set {default}  osdevice  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
    bcdedit /store "%WorkDirectory%\DVD-AIO\boot\bcd" /timeout 60
    goto:eof
    
    :AddOem
    rmdir "%WorkDirectory%\DVD-%~1\sources\$oem$" /S /Q
    mkdir "%WorkDirectory%\DVD-%~1\sources\$oem$"
    xcopy "%OemLocation%\$oem$" "%WorkDirectory%\DVD-%~1\sources\$oem$" /cheriky
    goto:eof
    
    :Additional
    rmdir "%WorkDirectory%\DVD-%~1\Extra" /S /Q
    mkdir "%WorkDirectory%\DVD-%~1\Extra"
    xcopy "%ExtraLocation%" "%WorkDirectory%\DVD-%~1\Extra" /cheriky
    goto:eof
    
    :MakeISO
    del "%WorkDirectory%\Windows7-%~1.iso"
    IF /i %~1 NEQ AIO oscdimg -u2 -m -oc -lSeven_%~1--%number% -oc  -b"%WorkDirectory%\DVD-%~1\boot\etfsboot.com" "%WorkDirectory%\DVD-%~1"  "%WorkDirectory%\Windows7-%~1.iso"
    IF /i %~1 EQU AIO oscdimg -u2 -m -lSeven_%~1--%number%  -b"%WorkDirectory%\DVD-%~1\boot\etfsboot.com" "%WorkDirectory%\DVD-%~1"  "%WorkDirectory%\Windows7-%~1.iso"
    goto:eof
    
    :CleanUp
    dism /cleanup-wim
    del %WorkDirectory%\temp\*.* /S /Q
    goto:oef