Jump to content

7Customizer - a Windows 7 Customization and Deployment tool


Recommended Posts

When you have integrated IE9, updates etc., you can use the compress.cmd given above!

I've done like this for me.

It's always needed to mount/unmount the image before to compress a new time without error with the same compression!

Do not compress the install.wim image twice![

TNX myselfidem and sorry if i'm repeating. I just want well understanding.

1) In my case (described above), by using Export.cmd, I launched

"C:\Program Files\Windows AIK\Tools\amd64\imagex.exe" /export C:\Win7\sources\install.wim 4 C:\Win7\sources\installnew.wim "Windows 7 ULTIMATE" /compress maximum /check

Then by using now (after integrated IE9, updates etc...) the compress.cmd I'll lauch again

"C:\Program Files\Windows AIK\Tools\amd64\imagex.exe" /export C:\Win7\sources\install.wim 1 C:\Win7\sources\installv2.wim "Windows 7 ULTIMATE"  /check /compress maximum

And you warn me :blink:

Do not compress the install.wim image

2) Do I have to mount my install.wim before compressing? Or, the compress.cmd will do the job?

Regards

Edited by coucou
Link to comment
Share on other sites


You don't need to mount the install.wim image using the command /export.

First you can use Export.cmd to save only one image (example: Ultimate).

You can use compress.cmd after you have added IE9, updates, etc. and Unmount /Commit the image. But do not use twice when it's done! Use only one time compress.cmd!

It's not needed to use twice => the result is the same: (example: before => 2 234 317 Ko and after compression => 2 091 057 Ko; and after another compression => 2 091 057 Ko)

compress.cmd result using twice:

C:\7elite32\batch>compress.cmd

ImageX Tool for Windows

Copyright © Microsoft Corp. All rights reserved.

Version: 6.1.7600.16385

Exporting: [C:\7elite32\source\sources\install.wim, 1] ->

[C:\7elite32\source\sources\installv2.wim]

[ 100% ] Exporting progress

Successfully exported image #1.

Total elapsed time: 1 min 35 sec

Appuyez sur une touche pour continuer...

C:\7elite32\batch>compress.cmd

ImageX Tool for Windows

Copyright © Microsoft Corp. All rights reserved.

Version: 6.1.7600.16385

Exporting: [C:\7elite32\source\sources\install.wim, 1] ->

[C:\7elite32\source\sources\installv2.wim]

[ 100% ] Exporting progress

Successfully exported image #1.

Total elapsed time: 1 min 55 sec

Appuyez sur une touche pour continuer...

If there is errors, it's better to save first install.wim image ( a copy) and after we can use (like this it's not needed to remove and rename manually the files):

compress.cmd (we can use safely twice this batch file but it's not needed)


@echo off & color 1F
echo.
"C:\Program Files\Windows AIK\Tools\x86\imagex.exe" /export C:\Win7\sources\install.wim 1 C:\Win7\sources\installv2.wim "Windows 7 ULTIMATE" /check /compress maximum
echo.
>nul timeout /t 3
DEL /S /F /Q "C:\Win7\sources\install.wim"
REN "C:\Win7\sources\installv2.wim" "install.wim"
echo.
pause

Regards

*Edit: I will try to secure the batch file Export.cmd to not remove "install.wim" if we use twice the batch file!

the command timeout /t 3 doesn't work on Windows XP.

Edited by myselfidem
Link to comment
Share on other sites

Thanks coucou ! :)

About Export.cmd, you can try (Like this if we use Export.cmd twice; the new install.wim image isn't removed) :

WAIK for Windows 7 must be installed!

Export.cmd


@echo off & color 1F
rem @myselfidem 07/30/2011
SETLOCAL ENABLEEXTENSIONS
echo.
rem >nul taskkill /F /FI "WINDOWTITLE eq batch"
rem (change the folder name 'batch' with the current window folder name, to close this one)
echo.
rem Allows using Dism.exe and cmd.exe with Administrator rights.
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\Dism.exe" /t REG_SZ /d RUNASADMIN /f
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Program Files\Windows AIK\Tools\Servicing\Dism.exe" /t REG_SZ /d RUNASADMIN /f
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\cmd.exe" /t REG_SZ /d RUNASADMIN /f
echo.
cls
Title Exporting Image Windows
echo.
color 1F
MODE CON COLS=70 LINES=18
cls
echo.
echo ========================================================
echo = Exporting a single Image to save space for Windows 7 =
echo ========================================================
echo.
echo WAIK 3.0 for Windows 7 must be installed
echo.
echo This batch file is useful to save and compress a single
echo image inside the same folder 'DVD\sources' to save space
echo on your UA-DVD.
echo.
echo You can select your Windows 7 Edition (x86 or amd64).
echo.
echo.
echo.
echo.
echo Press any Key to continue...&pause>nul
echo.
cls
:start
color 1F
MODE CON COLS=70 LINES=70
cls
echo.
echo =======================
echo = Select Architecture =
echo =======================
echo.
echo Example:amd64
echo.
set /p cb=Write Architecture and hit Enter:
echo.
if errorlevel 1 goto :error
echo.
echo =====================
echo = Select Image path =
echo =====================
echo.
echo Example:C:\Wind7\sources
echo.
set /p source=Write image path:
echo.
echo.
echo =============================
echo = Image Name an Index Number=
echo =============================
echo.
echo ------------------------------
echo Examples:
echo.
echo a) NAME = Select Image Name
echo B) INDEX = Type 3 for Index: 3
echo ------------------------------
echo.
echo 1) ULTIMATE
echo 2) PROFESSIONAL
echo 3) HOMEPREMIUM
echo 4) HOMEBASIC
echo 5) STARTER
echo.
echo -----------------------------------------------------
echo Warning: Choose carefully the Image Name
echo.
echo You can restart the process to change the image name.
echo -----------------------------------------------------
echo.
echo 6) Return to Start
echo.
echo.
choice /C 123456 /N /M "a) Select one of the options above (1-6)"
if ERRORLEVEL 6 goto :start
if ERRORLEVEL 5 set Flag=Windows 7 STARTER
if ERRORLEVEL 4 set Flag=Windows 7 HOMEBASIC
if ERRORLEVEL 3 set Flag=Windows 7 HOMEPREMIUM
if ERRORLEVEL 2 set Flag=Windows 7 PROFESSIONAL
if ERRORLEVEL 1 set Flag=Windows 7 ULTIMATE
echo.
set /p Index=B) Type Index Number and hit Enter:
echo.
if errorlevel 1 goto :error
echo.
goto :work
echo.
:work
color 1F
MODE CON COLS=70 LINES=20
cls
echo.
echo =====================
echo = Windows 7 Edition =
echo =====================
echo.
echo %Flag% %cb% index: %index%
echo.
echo -----------------
echo Is this correct ?
echo -----------------
echo.
echo 1) Yes
echo 2) No. Change
echo.
choice /C 12 /N /M "Select one of the options above (1 or 2)"
if ERRORLEVEL 2 goto :start
if ERRORLEVEL 1 goto :setok
echo.
:setok
color 1F
MODE CON COLS=70 LINES=40
cls
echo.
echo =====================
echo = Exporting image ...
echo =====================
echo.
echo DON'T STOP the process. Please, wait...
echo.
set imgx="C:\Program Files\Windows AIK\Tools\%cb%\imagex.exe"
%imgx% /info "%source%\install.wim" %index% >nul
if errorlevel 1 goto :error
echo.
if not exist "%source%\New" mkdir "%source%\New"
echo.
%imgx% /export %source%\install.wim %index% %source%\New\install.wim "%Flag%" /check /compress maximum
echo.
ping /n 3 127.0.0.1 >nul
echo.
IF EXIST "%source%\install.wim" DEL "%source%\install.wim"
IF EXIST "%source%\New\install.wim" MOVE "%source%\New\install.wim" "%source%\install.wim"
echo.
if exist "%source%\New" rd /s /q "%source%\New"
echo Press any Key to exit&pause>nul & goto :exit
echo.
:Error
color 4F
MODE CON COLS=70 LINES=15
cls
echo.
echo ------------
echo Oops...ERROR
echo ------------
echo.
echo 1) Select correct image path and index number
echo.
echo 2) To compress again, select index:1
echo.
echo 3) Selected Image is already exported
echo.
echo Please try again...
echo.
echo.
echo Press any Key to exit&pause>nul & goto :exit
:exit

*Edit: Batch file Updated!

Edited by myselfidem
Link to comment
Share on other sites

TNX myselfidem,

I'll give a try a next time.

I presume this new Expot.cmd will works for both x32 and x64 (under Win7 only).

Regards

Yes, coucou !

Export.cmd is available for Windows 7 x86 or amd64 only!

I've updated a new time the batch file to use easier! ;)

Edited by myselfidem
Link to comment
Share on other sites

[ Export.cmd is available for Windows 7 x86 or amd64 only! But you can use under Windows XP!

I've updated a new time the batch file to use easier! ;)

Do I well understand that Export.cmd could be used under Win7 and/or WinXP? :unsure:

Regards

Link to comment
Share on other sites

[ Export.cmd is available for Windows 7 x86 or amd64 only! But you can use under Windows XP!

I've updated a new time the batch file to use easier! ;)

Do I well understand that Export.cmd could be used under Win7 and/or WinXP? :unsure:

Regards

No, sorry! The command "choice" doesn't work under Windows XP! :blink:

It's needed to adapt the batch file to do the choice!

I've updated my last post!

Export.cmd given above works only under Win7!

With OS Windows XP, we can use this batch file:

Export.cmd (under Windows XP):


@echo off & color 1F
echo.
echo Customizing Windows 7 images, under Windows XP
echo WAIK 3.0 for Windows 7 must be installed
echo.
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
echo.
echo =======================
echo = Select Architecture =
echo =======================
echo.
echo Example:amd64
echo.
set /p cb=Architecture:
echo.
if errorlevel 1 goto :error
echo.
echo ======================
echo = Select Image path =
echo ======================
echo.
echo Example:C:\Wind7\sources
echo.
set /p source=Write the image path:
echo.
echo ==============
echo = Image name =
echo ==============
echo.
echo Examples:
echo.
echo Windows 7 ULTIMATE
echo Windows 7 PROFESSIONAL
echo Windows 7 HOMEPREMIUM
echo Windows 7 HOMEBASIC
echo Windows 7 STARTER
echo.
set /p image=Write the image name:
echo.
echo ===============
echo = Image Index =
echo ===============
echo.
set /p index=Set image index:
echo.
echo Selected Windows version : %image% %cb% index: %index%
echo.
set imgx="C:\Program Files\Windows AIK\Tools\%cb%\imagex.exe"
%imgx% /info "%source%\install.wim" %index% >nul
if errorlevel 1 goto :next
echo.
%imgx% /export %source%\install.wim %index% %source%\installv2.wim "%image%" /check /compress maximum
ping /n 3 127.0.0.1 >nul
echo.
DEL /S /F /Q "%source%\install.wim"
REN "%source%\installv2.wim" "install.wim"
echo.
goto :exit
echo.
:next
echo The selected Image is already exported.
echo After adding updates, etc. you can compress your new image.
echo Please try again...And, Select index:1
echo.
echo Press any Key to exit&pause>nul
goto :exit
echo.
:Error
color 4F
MODE CON COLS=70 LINES=15
cls
echo.
echo ------------
echo Oops...ERROR
echo ------------
echo.
echo Please, select correct architecture and image path.
echo.
echo.
echo And try again...
echo.
echo.
echo Press any Key to exit&pause>nul
goto :exit
:exit

*Edit: batch file updated

Edited by myselfidem
Link to comment
Share on other sites

Thanks coucou ! :)

For boot.wim, we can use:

Export_Boot.cmd


@echo off & color 1F
rem @myselfidem 07/30/2011
SETLOCAL ENABLEEXTENSIONS
echo.
rem >nul taskkill /F /FI "WINDOWTITLE eq batch"
rem (change the folder name 'batch' with the current window folder name, to close this one)
echo.
rem Allows using Dism.exe and cmd.exe with Administrator rights.
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\Dism.exe" /t REG_SZ /d RUNASADMIN /f
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Program Files\Windows AIK\Tools\Servicing\Dism.exe" /t REG_SZ /d RUNASADMIN /f
>nul REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\cmd.exe" /t REG_SZ /d RUNASADMIN /f
echo.
cls
Title Exporting Boot.wim Images
echo.
color 1F
MODE CON COLS=70 LINES=18
cls
echo.
echo =========================================================
echo = Exporting Boot.wim Images to save space for Windows 7 =
echo =========================================================
echo.
echo WAIK 3.0 for Windows 7 must be installed
echo.
echo This batch file is useful to save and compress images inside
echo the same folder 'DVD\sources' to save space for your UA-DVD.
echo.
echo You can select your Windows 7 Edition (x86 or amd64).
echo.
echo.
echo.
echo.
echo Press any Key to continue...&pause>nul
echo.
cls
:start
color 1F
MODE CON COLS=70 LINES=20
cls
echo.
echo =======================
echo = Select Architecture =
echo =======================
echo.
echo Example:amd64
echo.
set /p cb=Type Architecture an hit Enter:
echo.
if errorlevel 1 goto :error
echo.
echo.
echo.
echo =========================
echo = Select the Image path =
echo =========================
echo.
echo Example: C:\Wind7\sources
echo.
set /p source=Write image path:
echo.
if errorlevel 1 goto :error
echo.
color 2f
MODE CON COLS=70 LINES=20
cls
echo.
echo ==============
echo = Image path =
echo ==============
echo.
echo.
echo Architecture:%cb%
echo.
echo Image path:%source%
echo.
echo.
echo -----------------
echo Is this correct ?
echo -----------------
echo.
echo 1) Yes
echo 2) No. Change
echo.
choice /C 12 /N /M "Select one of the options above (1 or 2)"
if ERRORLEVEL 2 goto :start
if ERRORLEVEL 1 goto :work
:work
color 1F
MODE CON COLS=70 LINES=50
cls
echo.
echo ==============================
echo = Exporting Boot.wim images...
echo ==============================
echo.
set imgx="C:\Program Files\Windows AIK\Tools\%cb%\imagex.exe"
%imgx% /info "%source%\boot.wim" %index% >nul
if errorlevel 1 goto :error
echo.
if not exist "%source%\New" mkdir "%source%\New"
echo.
%imgx% /export %source%\boot.wim * %source%\New\boot.wim /boot /check /compress maximum
echo.
ping /n 3 127.0.0.1 >nul
echo.
IF EXIST "%source%\boot.wim" DEL "%source%\boot.wim"
IF EXIST "%source%\New\boot.wim" MOVE "%source%\New\boot.wim" "%source%\boot.wim"
echo.
if exist "%source%\New" rd /s /q "%source%\New"
echo.
echo ----------------------------
echo Do you want compress again ?
echo ----------------------------
echo.
echo 1) Yes
echo 2) No. Exit
echo.
choice /C 12 /N /M "Select one of the options above (1 or 2)"
if ERRORLEVEL 2 goto :exit
if ERRORLEVEL 1 goto :work
echo.
:Error
color 4F
MODE CON COLS=70 LINES=15
cls
echo.
echo ------------
echo Oops...ERROR
echo ------------
echo.
echo Please, select correct architecture and image path.
echo.
echo And try again...
echo.
echo.
echo.
echo Press any Key to exit&pause>nul & goto :exit
:exit

*Edit: Batch file Updated!

Edited by myselfidem
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...