This code is cleaned up a little from post 52 Code: @echo off setlocal ENABLEDELAYEDEXPANSION set WAIK=C:\Program Files\Windows AIK set ARCH=x86 IF /i %PROCESSOR_ARCHITECTURE% NEQ x86 set ARCH=amd64 set PATH=%WAIK%;%WAIK%\Tools\Servicing;%WAIK%\Tools\%ARCH%\;%WAIK%\Tools\%ARCH%\Servicing;%PATH%; cd /d %~dp0 echo A little housekeeping dism /cleanup-wim choice /d n /t 5 /M "Rename wims?" if %errorlevel%==1 goto RENAME goto SKIP_RENAME :RENAME set wim1="64bit Windows 7 Home Basic" set wim2="64bit Windows 7 Home Premium" set wim3="64bit Windows 7 Professional" set wim4="64bit Windows 7 Ultimate" FOR %%W IN (1 2 3 4) DO ( imagex /info ".\Win7_64\sources\install.wim" %%W !wim%%W! !wim%%W! choice /d y /t 3 > nul ) :SKIP_RENAME choice /d n /t 5 /M "Update wims?" if %errorlevel%==1 goto UPDATE goto SKIP_UPDATE :UPDATE FOR %%I IN (1 2 3 4) DO ( Echo. Echo Updating Image Index %%I Dism /MOUNT-WIM /WIMFILE:.\Win7_64\sources\install.wim /Index:%%I /MOUNTDIR:MOUNT choice /d y /t 3 > nul Dism /image:MOUNT /Add-Package /PackagePath:.\Win7_64_Updates choice /d y /t 3 > nul Dism /Unmount-Wim /MountDir:MOUNT /Commit choice /d y /t 3 > nul ) :SKIP_UPDATE oscdimg.exe -lWin7x64 -t11/11/2011:11:11 -o -m -u2 -b.\Win7_64\boot\etfsboot.com .\Win7_64 .\Win7x64.iso pause
Uiiihh...posting code without using Code: Tags only leaves to errors, as there will be inserted random breaks, which mess up the code :hmm:.
I have cleaned up the code even more in posts 60 & 61. There really isn't much more I can think of doing. If anybody has any suggestions, I would appreciate them. If this code helps even one person, I will have done my job. Thanks everybody.
One script for 32bit and 64bit The 32bit and 64bit code can be combinded as follows: Code: @echo off setlocal ENABLEDELAYEDEXPANSION set WAIK=C:\Program Files\Windows AIK set ARCH=x86 IF /i %PROCESSOR_ARCHITECTURE% NEQ x86 set ARCH=amd64 set PATH=%WAIK%;%WAIK%\Tools\Servicing;%WAIK%\Tools\%ARCH%\;%WAIK%\Tools\%ARCH%\Servicing;%PATH%; cd /d %~dp0 echo A little housekeeping dism /cleanup-wim choice /d n /t 5 /M "64 bit?" if %errorlevel%==1 goto 64bitcode :32bitcode set bit=32 set count=1 2 3 4 5 set wim1="32bit Windows 7 Starter" set wim2="32bit Windows 7 Home Basic" set wim3="32bit Windows 7 Home Premium" set wim4="32bit Windows 7 Professional" set wim5="32bit Windows 7 Ultimate" goto SKIP_64bitcode :64bitcode set bit=64 set count=1 2 3 4 set wim1="64bit Windows 7 Home Basic" set wim2="64bit Windows 7 Home Premium" set wim3="64bit Windows 7 Professional" set wim4="64bit Windows 7 Ultimate" :SKIP_64bitcode choice /d n /t 5 /M "Rename wims?" if %errorlevel%==1 goto RENAME goto SKIP_RENAME :RENAME FOR %%W IN (%count%) DO ( imagex /info ".\Win7_%bit%\sources\install.wim" %%W !wim%%W! !wim%%W! choice /d y /t 3 > nul ) :SKIP_RENAME choice /d n /t 5 /M "Update wims?" if %errorlevel%==1 goto UPDATE goto SKIP_UPDATE :UPDATE FOR %%I IN (%count%) DO ( Echo. Echo Updating Image Index : %%I Dism /MOUNT-WIM /WIMFILE:.\Win7_%bit%\sources\install.wim /Index:%%I /MOUNTDIR:.\Mount\ choice /d y /t 3 > nul Dism /Image:.\MOUNT /Add-Package /PackagePath:.\Win7_%bit%_Updates choice /d y /t 3 > nul Dism /Unmount-Wim /MountDir:.\MOUNT /commit choice /d y /t 3 > nul ) :SKIP_UPDATE oscdimg.exe -lWin7x%bit% -t11/11/2011:11:11 -o -m -u2 -b.\Win7_%bit%\boot\etfsboot.com .\Win7_%bit% .\Win7x%bit%.iso pause
Even better code than post 64 Hi guys. If you remove the Starter edition from the 32bit wim using a program like Josh Cell's WinAIO Maker Professional, you can improve the code like this: Code: @echo off setlocal ENABLEDELAYEDEXPANSION set WAIK=C:\Program Files\Windows AIK set ARCH=x86 IF /i %PROCESSOR_ARCHITECTURE% NEQ x86 set ARCH=amd64 set PATH=%WAIK%;%WAIK%\Tools\Servicing;%WAIK%\Tools\%ARCH%\;%WAIK%\Tools\%ARCH%\Servicing;%PATH%; cd /d %~dp0 echo A little housekeeping dism /cleanup-wim set bit=32 choice /d n /t 3 /m "64 bit?" if %errorlevel%==1 set bit=64 choice /d n /t 5 /M "Rename wims?" if %errorlevel%==1 goto RENAME goto SKIP_RENAME :RENAME set wim1="!bit!bit Windows 7 Home Basic" set wim2="!bit!bit Windows 7 Home Premium" set wim3="!bit!bit Windows 7 Professional" set wim4="!bit!bit Windows 7 Ultimate" FOR %%W IN (1 2 3 4) DO ( imagex /info ".\Win7_%bit%\sources\install.wim" %%W !wim%%W! !wim%%W! choice /d y /t 3 > nul ) :SKIP_RENAME choice /d n /t 5 /m "Update wims?" if %errorlevel%==1 goto UPDATE goto SKIP_UPDATE :UPDATE FOR %%I IN (1 2 3 4) DO ( Echo. Echo Updating Image Index : %%I Dism /MOUNT-WIM /WIMFILE:.\Win7_%bit%\sources\install.wim /Index:%%I /MOUNTDIR:MOUNT choice /d y /t 3 > nul Dism /Image:MOUNT /Add-Package /PackagePath:.\Win7_%bit%_Updates choice /d y /t 3 > nul Dism /Unmount-Wim /MountDir:MOUNT /commit choice /d y /t 3 > nul ) :SKIP_UPDATE oscdimg.exe -lWin7x%bit% -t11/11/2011:11:11 -o -m -u2 -b.\Win7_%bit%\boot\etfsboot.com .\Win7_%bit% .\Win7x%bit%.iso pause
Even better code than post 64 and 65 If you remove the Starter edition yourself and you don't care about renaming the wims, the code can be improved as follows: Code: @echo off set WAIK=C:\Program Files\Windows AIK set ARCH=x86 IF /i %PROCESSOR_ARCHITECTURE% NEQ x86 set ARCH=amd64 set PATH=%WAIK%;%WAIK%\Tools\Servicing;%WAIK%\Tools\%ARCH%\;%WAIK%\Tools\%ARCH%\Servicing;%PATH%; cd /d %~dp0 dism /cleanup-wim set bit=32 choice /d n /t 5 /m "64 bit?" if %errorlevel%==1 set bit=64 choice /d n /t 5 /m "Update wims?" if %errorlevel%==1 goto UPDATE goto SKIP_UPDATE :UPDATE FOR %%I IN (1 2 3 4) DO ( Echo. Echo Updating Image Index : %%I Dism /MOUNT-WIM /WIMFILE:.\Win7_%bit%\sources\install.wim /Index:%%I /MOUNTDIR:.\Mount\ choice /d y /t 3 > nul Dism /Image:.\MOUNT /Add-Package /PackagePath:.\Win7_%bit%_Updates choice /d y /t 3 > nul Dism /Unmount-Wim /MountDir:.\MOUNT /commit choice /d y /t 3 > nul ) :SKIP_UPDATE oscdimg.exe -lWin7x%bit% -t11/11/2011:11:11 -o -m -u2 -b.\Win7_%bit%\boot\etfsboot.com .\Win7_%bit% .\Win7x%bit%.iso pause
Last tweak for a while(I promise) Suppose you have dozens of updates to integrate and some updates have to be installed before others. What can you do? Simple. Under either Win7_32_Updates or Win7_64_updates, make sub directories that will be processed in alpha-numeric order. For example, directory updates01 will be processed before updates03. Likewise, directory blablabla will be processed before yeahyeahyeah. Just places the updates in the directories to be sorted in order. Using a FOR loop, replace the following code: Code: Dism /Image:.\MOUNT /Add-Package /PackagePath:.\Win7_%bit%_Updates choice /d y /t 3 > nul with Code: For /f %%f in ('dir /ad /b Win7_%bit%_Updates') do ( Dism /image:.\MOUNT /Add-Package /PackagePath:.\Win7_%bit%_Updates\%%f choice /d y /t 3 > nul ) Hope this helps people. Thanks again to Sabresite for his original code.
Add or Remove games I install and reinstall Windows several times a week to play with the different versions of 32bit & 64bit editions. The Professional edition doesn't come with games on by default. My favorite is Spider Solitaire. Some of the other editions have games I don't care for. Rather than adding or removing games manually everytime, the following script comes in handy before making the final ISO file: Code: @echo off cd /d %~dp0 set BIT=32 set NDX=1 2 3 4 5 choice /d n /t 5 /m "64 bit?" if %errorlevel%==1 set BIT=64 if %BIT%==64 set NDX=1 2 3 4 for %%I in (%NDX%) do ( Dism /Mount-Wim /WimFile:.\Win7_%bit%\sources\install.wim /Index:%%I /MountDir:MOUNT Dism /Image:MOUNT /Enable-Feature /FeatureName:InboxGames Dism /Image:MOUNT /Disable-Feature /FeatureName:"More Games" Dism /Image:MOUNT /Enable-Feature /FeatureName:Solitaire Dism /Image:MOUNT /Enable-Feature /FeatureName:SpiderSolitaire Dism /Image:MOUNT /Enable-Feature /FeatureName:Hearts Dism /Image:MOUNT /Enable-Feature /FeatureName:FreeCell Dism /Image:MOUNT /Enable-Feature /FeatureName:Minesweeper Dism /Image:MOUNT /Disable-Feature /FeatureName:PurblePlace Dism /Image:MOUNT /Enable-Feature /FeatureName:Chess Dism /Image:MOUNT /Enable-Feature /FeatureName:Shanghai Dism /Image:MOUNT /Disable-Feature /FeatureName:"Internet Games" Dism /Image:MOUNT /Disable-Feature /FeatureName:"Internet Checkers" Dism /Image:MOUNT /Disable-Feature /FeatureName:"Internet Backgammon" Dism /Image:MOUNT /Disable-Feature /FeatureName:"Internet Spades" Dism /Unmount-Wim /MountDir:MOUNT /Commit ) pause Don't worry about message saying that this or that edition doesn't have this or that game. The Starter and Basic editions are more limited than the others. It will still finish without problems. You can modify it for your particular situation. It should go without saying that this code and the previous code should be run as an Administrator.
Of course it can be with appropriate scripts it should be done, a fully automated script. Simplix Pack could be run separately to service images first though.
Tested this approach and works just fine with the following exception: $oem$ folder won't function at all.