I'm using this great batch script to capture and apply my image
@echo off
cd /d %~dp0
if not exist "imagex.exe" goto _notexist
goto _main
:_notexist
echo.
echo IMAGEX.EXE executable not found. Please ensure that IMAGEX_APPLY.CMD
echo is in the same folder as IMAGEX.EXE before executing this script.
echo This script will now exit.
echo.
pause
exit
:_main
echo.
echo.
echo.
echo [I M A G E X A P P L Y M A I N M E N U]
echo.
echo 1) Specify or change source path (the path to you .wim image file)
echo Source: [%_asource%]
echo.
echo 2) Specify or change target path, where your image will be restored
echo Target: [%_atarget%]
echo.
echo 3) Specify or change index you want to restore (a number, such as 2)
echo Index: [%_index%]
echo.
if "%_asource%" == "" goto _menu1
if "%_atarget%" == "" goto _menu1
if "%_index%" == "" goto _menu1
echo 4) Apply your image now where ready
echo From [%_asource%] To [%_atarget%]
echo.
:_menu1
echo Q) Quit. R) Reset all variables.
echo.
:_mainch
set _ok=
set /p _ok=Enter your choice:
if "%_ok%" == "1" goto _getsrc
if "%_ok%" == "2" goto _gettarget
if "%_ok%" == "3" goto _getindex
if "%_ok%" == "4" goto _apply
if /I "%_ok%" == "q" goto _end
if /I "%_ok%" == "r" goto _reset
goto _mainch
:_getsrc
set _ok=
echo.
echo Specify location of source image to restore with full path.
set /p _ok=Enter Source path:
for %%A in (%_ok%) do set _ext=%%~xA
if not exist %_ok% (
echo.
echo ---------------------------------------------------------
echo Path does not exist. Please input a valid location again.
echo ---------------------------------------------------------
goto _getsrc
) else (
if /I "%_ext%"==".wim" (
set _asource=%_ok%
setx _asource %_ok%
goto _main
) else (
echo.
echo ---------------------------------------------------------------
echo Error: The path "%_ok%" does not seem to be a valid .wim image file.
echo ---------------------------------------------------------------
goto _getsrc
)
)
:_gettarget
set _ok=
echo.
echo Specify target to install source image with full path.
set /p _ok=Enter Target path:
if exist "%_ok%" (
set _atarget=%_ok%
setx _atarget %_ok%
) else (
echo.
echo ---------------------------------------------------------------
echo Error: The path "%_ok%" is not a correct location.
echo ---------------------------------------------------------------
goto _gettarget
)
goto _main
:_getindex
set _ok=
echo.
echo Specify image index with a number
set /p _ok=Enter Index number:
set _index=%_ok%
setx _index %_ok%
goto _main
:_apply
echo.
echo.
@echo on
imagex.exe /apply "%_asource%" %_index% "%_atarget%"
@echo off
echo.
pause
goto _end
:_reset
set _asource=
set _index=
set _atarget=
goto _main
:_end
but there is a problem that when i want to choose my .wim file it keep say to me that : Error: The path "%_ok%" does not seem to be a valid .wim image file.
even when i put the correct full path for the wim file
someone can help me with it?
and also i want that after the apply prcess complete the script will run the next command
d:\windows\system32\bcdboot d:\windows
when d: is the drive that the wim file was install to (the hard drive that windows will be in it) so i want that the script will ask for the drive letter or will use one of the variabels from it
10x
This post has been edited by yweiss: 08 November 2011 - 04:10 PM



Help
Back to top












