Add Two OS > Single WIM

Discussion in 'Windows 8' started by Eddieleon7, Aug 17, 2014.

  1. Eddieleon7

    Eddieleon7 MDL Novice

    May 1, 2014
    32
    1
    0
    Hi, I wanna add Two OS Windows 8 + Windows 8.1 Into A Single WIM File.
    Is it possible?
    [x86,x64]
    Windows 8 Pro x86
    Windows 8 pro x64
    Windows 8 x86
    windows 8 x64
    Windows 8 SIngle Lan x64
    Windows 8.1 Single Lang x64
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cocachris89

    cocachris89 MDL Senior Member

    Mar 1, 2013
    492
    147
    10
  3. HALIKUS

    HALIKUS MDL Addicted

    Jul 29, 2009
    527
    369
    30
    #3 HALIKUS, Aug 19, 2014
    Last edited by a moderator: Apr 20, 2017
    :rolleyes:

    Code:
    @echo off
    rem for VMWARE if you want to test EFI, add to second line of vmx:  firmware= "efi"
    title Windows 7 and 8 AIO install.wim and Updates
    :checkPrivileges 
    NET FILE 1>NUL 2>NUL
    if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 
    :getprivileges 
    if '%1'=='ELEV' (shift & goto gotPrivileges)  
    setlocal DisableDelayedExpansion
    set "batchPath=%~0"
    setlocal EnableDelayedExpansion
    ECHO set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" 
    ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" 
    "%temp%\OEgetPrivileges.vbs" 
    exit /B 
    :gotPrivileges 
    set mount=c:\mount
    set imagex=c:\Windows\system32\imagex.exe
    set Dism=c:\Windows\system32\Dism.exe
    rem ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Dism /unmount-wim /mountdir:%mount% /discard
    pause
    
    rem Win8.1
    set SourceImageFile=en_windows_8.1_with_update_x86_dvd_4065105\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 Professional (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:1 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x86_dvd_4065105\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8.1_with_update_x64_dvd_4065090\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 Professional (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:2 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x64_dvd_4065090\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    
    set SourceImageFile=en_windows_8.1_with_update_x86_dvd_4065105\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 ProfessionalWMC (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:3 /mountdir:%mount%
    Dism /Image:%mount% /Get-TargetEditions
    Dism /Image:%mount% /Set-Edition:ProfessionalWMC
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x86_dvd_4065105\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    %imagex% /flags "ProfessionalWMC" /info MASTER.wim 3 "Windows 8.1 ProfessionalWMC (x86)" "Windows 8.1 ProfessionalWMC (x86)"
    RD %mount%
    
    set SourceImageFile=en_windows_8.1_with_update_x64_dvd_4065090\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 ProfessionalWMC (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:4 /mountdir:%mount%
    Dism /Image:%mount% /Get-TargetEditions
    Dism /Image:%mount% /Set-Edition:ProfessionalWMC
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x64_dvd_4065090\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    %imagex% /flags "ProfessionalWMC" /info MASTER.wim 4 "Windows 8.1 ProfessionalWMC (x64)" "Windows 8.1 ProfessionalWMC (x64)"
    RD %mount%
    
    set SourceImageFile=en_windows_8.1_with_update_x86_dvd_4065105\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 8.1 (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:5 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x86_dvd_4065105\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8.1_with_update_x64_dvd_4065090\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 8.1 (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:6 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x64_dvd_4065090\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    
    set SourceImageFile=en_windows_8.1_enterprise_with_update_x86_dvd_4065185\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 Enterprise (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:7 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x86_dvd_4065105\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8.1_enterprise_with_update_x64_dvd_4065178\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 Enterprise (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:8 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x64_dvd_4065090\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=Windows-8.1-Update-Core-Single-Language-en-US-x86-WIM\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 CoreSingleLanguage (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:9 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x86_dvd_4065105\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=Windows-8.1-Update-Core-Single-Language-en-US-x64-WIM\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8.1 CoreSingleLanguage (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:10 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8.1_with_update_x64_dvd_4065090\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    rem pause
    
    rem Win8.0
    set SourceImageFile=en_windows_8_x86_dvd_915417\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 Professional (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:11 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x86_dvd_915417\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8_x64_dvd_915440\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 Professional (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:12 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x64_dvd_915440\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8_x86_dvd_915417\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 ProfessionalWMC (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:13 /mountdir:%mount%
    Dism /Image:%mount% /Get-TargetEditions
    Dism /Image:%mount% /Set-Edition:ProfessionalWMC
    Dism /unmount-wim /mountdir:%mount% /commit
    %imagex% /flags "ProfessionalWMC" /info MASTER.wim 13 "Windows 8 ProfessionalWMC (x86)" "Windows 8 ProfessionalWMC (x86)"
    RD %mount%
    
    set SourceImageFile=en_windows_8_x64_dvd_915440\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 ProfessionalWMC (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:14 /mountdir:%mount%
    Dism /Image:%mount% /Get-TargetEditions
    Dism /Image:%mount% /Set-Edition:ProfessionalWMC
    Dism /unmount-wim /mountdir:%mount% /commit
    %imagex% /flags "ProfessionalWMC" /info MASTER.wim 14 "Windows 8 ProfessionalWMC (x64)" "Windows 8 ProfessionalWMC (x64)"
    RD %mount%
    
    set SourceImageFile=en_windows_8_x86_dvd_915417\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 8 (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:15 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x86_dvd_915417\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8_x64_dvd_915440\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 8 (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:16 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x64_dvd_915440\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8_enterprise_x86_dvd_917587\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 Enterprise (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:17 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x86_dvd_915417\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=en_windows_8_enterprise_x64_dvd_917522\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 Enterprise (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:18 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x64_dvd_915440\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=8_9200_HRM_CSLA_X86FREO_EN-US_DV5_UWFELM\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 CoreSingleLanguage (x86)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:19 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x86_dvd_915417\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    
    set SourceImageFile=8_9200_HRM_CSLA_X64FREO_EN-US_DV5_UWFELM\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 8 CoreSingleLanguage (x64)" && call :EXPORT
    MD %mount%
    Dism /mount-wim /wimfile:MASTER.wim /index:20 /mountdir:%mount%
    Dism /Image:%mount% /enable-feature /featurename:NetFX3 /All /Source:en_windows_8_x64_dvd_915440\sources\sxs /LimitAccess
    Dism /unmount-wim /mountdir:%mount% /commit
    RD %mount%
    pause
    
    
    
    rem Win7.0
    set SourceImageFile=7_ultimate_with_sp1.1_x86_dvd_u_677460-X17-59463\sources\install.wim && set SourceIndex=5 && set DestinationName="Windows 7 Ultimate (x86)" && call :EXPORT
    set SourceImageFile=7_ultimate_with_sp1.1_x64_dvd_u_677332-X17-59465\sources\install.wim && set SourceIndex=4 && set DestinationName="Windows 7 Ultimate (x64)" && call :EXPORT
    
    set SourceImageFile=7_ultimate_with_sp1.1_x86_dvd_u_677460-X17-59463\sources\install.wim && set SourceIndex=4 && set DestinationName="Windows 7 Professional (x86)" && call :EXPORT
    set SourceImageFile=7_ultimate_with_sp1.1_x64_dvd_u_677332-X17-59465\sources\install.wim && set SourceIndex=3 && set DestinationName="Windows 7 Professional (x64)" && call :EXPORT
    
    set SourceImageFile=7_ultimate_with_sp1.1_x86_dvd_u_677460-X17-59463\sources\install.wim && set SourceIndex=3 && set DestinationName="Windows 7 HomePremium (x86)" && call :EXPORT
    set SourceImageFile=7_ultimate_with_sp1.1_x64_dvd_u_677332-X17-59465\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 7 HomePremium (x64)" && call :EXPORT
    
    set SourceImageFile=7_ultimate_with_sp1.1_x86_dvd_u_677460-X17-59463\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows 7 HomeBasic (x86)" && call :EXPORT
    set SourceImageFile=7_ultimate_with_sp1.1_x64_dvd_u_677332-X17-59465\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 7 HomeBasic (x64)" && call :EXPORT
    
    set SourceImageFile=7_ultimate_with_sp1.1_x86_dvd_u_677460-X17-59463\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 7 Starter (x86)" && call :EXPORT
    
    set SourceImageFile=en_windows_7_enterprise_with_sp1_x86_dvd_620186\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 7 Enterprise (x86)" && call :EXPORT
    set SourceImageFile=en_windows_7_enterprise_with_sp1_x64_dvd_620201\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows 7 Enterprise (x64)" && call :EXPORT
    
    
    rem Vista
    set SourceImageFile=en_windows_vista_sp2_x86_dvd_342266\sources\install.wim && set SourceIndex=4 && set DestinationName="Windows Vista Ultimate (x86)" && call :EXPORT
    set SourceImageFile=en_windows_vista_sp2_x64_dvd_342267\sources\install.wim && set SourceIndex=4 && set DestinationName="Windows Vista Ultimate (x64)" && call :EXPORT
    
    set SourceImageFile=en_windows_vista_sp2_x86_dvd_342266\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows Vista Business (x86)" && call :EXPORT
    set SourceImageFile=en_windows_vista_sp2_x64_dvd_342267\sources\install.wim && set SourceIndex=1 && set DestinationName="Windows Vista Business (x64)" && call :EXPORT
    
    set SourceImageFile=en_windows_vista_sp2_x86_dvd_342266\sources\install.wim && set SourceIndex=3 && set DestinationName="Windows Vista HomePremium (x86)" && call :EXPORT
    set SourceImageFile=en_windows_vista_sp2_x64_dvd_342267\sources\install.wim && set SourceIndex=3 && set DestinationName="Windows Vista HomePremium (x64)" && call :EXPORT
    
    set SourceImageFile=en_windows_vista_sp2_x86_dvd_342266\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows Vista HomeBasic (x86)" && call :EXPORT
    set SourceImageFile=en_windows_vista_sp2_x64_dvd_342267\sources\install.wim && set SourceIndex=2 && set DestinationName="Windows Vista HomeBasic (x64)" && call :EXPORT
    
    set SourceImageFile=en_windows_vista_sp2_x86_dvd_342266\sources\install.wim && set SourceIndex=7 && set DestinationName="Windows Vista Starter (x86)" && call :EXPORT
    
    %imagex% /compress maximum /export MASTER.wim * MASTER.wim.wim
    echo aY | choice /n
    goto :eof
    
    :EXPORT
    echo Dism /Export-Image /DestinationName:%DestinationName% /SourceIndex:%SourceIndex% /DestinationImageFile:MASTER.wim /SourceImageFile:%SourceImageFile% /compress:maximum
    %Dism% /Export-Image /DestinationName:%DestinationName% /SourceIndex:%SourceIndex% /DestinationImageFile:MASTER.wim /SourceImageFile:%SourceImageFile% /compress:maximum
    goto :eof
    
    
     
  4. devdevadev

    devdevadev MDL Novice

    Jun 29, 2013
    17
    0
    0
    What function above code do ?

    How to use above code in order to merge multiple WIMs to a single WIM ?
     
  5. coleoptere2007

    coleoptere2007 MDL Guru

    Apr 8, 2008
    2,274
    1,166
    90
    #5 coleoptere2007, Sep 6, 2014
    Last edited: Sep 7, 2014
    Answer is 2 posts above yours. Read and learn the sticky link and this thread from murphy78 (thx to him) :cool:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...