Aoson R18

@echo off

@rem *****************************************************************

@rem Script to deploy a WIMboot WIM on a target device in a standard configuration

@rem *****************************************************************

@rem Initialize WinPE

@echo wpeinit

wpeinit

@echo.

@echo.

@echo.

@echo *****************************************************************

@rem Get the USB Drive letter of the device we booted WinPE from

@echo *****************************************************************

@echo call wpeutil UpdateBootInfo

wpeutil UpdateBootInfo

@echo.

set WinPEREG=”HKLMSystemCurrentControlSetControl”

set WinPEKey=PEBootRamdiskSourceDrive

@echo.

@rem Get volume letter of USB Key

@echo for /f “skip=2 tokens=3” %%A in (‘call Reg query %WinPEREG% /v %WinPEKEY%’) do set WinPESource=%%A

for /f “skip=2 tokens=3” %%A in (‘call Reg query %WinPEREG% /v %WinPEKEY%’) do set WinPESource=%%A

@echo WinPESource is drive letter “%WinPESource%”

@echo.

@echo.

@echo.

@echo *****************************************************************

@echo Setting up the partition table

@echo *****************************************************************

@echo call diskpart /s %WinPESource%DiskpartFileswimpart.txt

diskpart /s %WinPESource%DiskpartFileswimpart.txt

@echo.

@echo.

@echo.

@echo *****************************************************************

@rem Map drive letter for Install.wim and Winre.wim

@echo *****************************************************************

@rem Create an output file containing all the drive letters

@echo call diskpart /s %WinPESource%DiskpartFileslistVol.txt>%WinPESource%Output.txt

diskpart /s %WinPESource%DiskpartFileslistVol.txt>%WinPESource%Output.txt

@echo.

@rem Go through each drive letter, looking for the imagesInstall.txt file

for /f “skip=8 tokens=3” %%A in (%WinPESource%Output.txt) do (

if exist %%A:imagesinstall.txt set InstallPath=%%A:images&& “echo Found device with images folder and install.txt file”

)

@echo.

@echo.

@rem Check InstallPath was found and there are images in it.

if NOT EXIST %InstallPath%Install.wim echo “Install.wim NOT found.” && goto :Error

@echo Install.wim FOUND at %InstallPath%imagesinstall.wim

@echo.

@rem Check that Winre.wim is there as well.

if NOT EXIST %InstallPath%Winre.wim echo “Winre.wim NOT found.” && goto :Error

@echo Winre.wim FOUND at %InstallPath%imageswinre.wim

@echo.

@echo.

@echo.

@echo *****************************************************************

@rem Switches to the USB disk

@rem Create folders on local (eMMC) disk and copy files from USB disk

@echo *****************************************************************

@echo.

@echo Making directories…

md c:recyclerscratch

if %errorlevel% NEQ 0 echo “Failed to make c:recyclerscratch directory” && goto :error

md m:”windows images”

if %errorlevel% NEQ 0 echo “Failed to make m:windows images directory” && goto :error

md m:recoverywindowsre

if %errorlevel% NEQ 0 echo “Failed to make m:recoverywindowsre directory” && goto :error

@echo.

@echo copy %InstallPath%install.wim m:”windows images”

copy %InstallPath%install.wim m:”windows images”

if %errorlevel% NEQ 0 echo “Failed to copy install.wim to m:Windows images” && goto :error

@echo.

@echo copy %InstallPath%winre.wim m:recoverywindowsre

copy %InstallPath%winre.wim m:recoverywindowsre

if %errorlevel% NEQ 0 echo “Failed to copy winre.wim to m:recoverywindowsre” && goto :error

@echo.

@echo.

@echo.

@echo *****************************************************************

@echo Applying the WIMboot image from the Images Partition in the eMMC

@echo USB disk NO LONGER NEEDED from this point

@echo *****************************************************************

@echo call DISM /Apply-Image /ImageFile:”m:windows imagesinstall.wim” /ApplyDir:c: /Index:1 /WIMBoot /ScratchDir:c:recyclerSCRATCH

DISM /Apply-Image /ImageFile:”m:windows imagesinstall.wim” /ApplyDir:c: /Index:1 /WIMBoot /ScratchDir:c:recyclerSCRATCH

if %errorlevel% NEQ 0 echo “Failed to apply image to c:” && goto :error

@echo.

@echo.

@echo.

@echo *****************************************************************

@echo Setting the boot environment

@echo *****************************************************************

@echo call c:WINDOWSSYSTEM32BCDBOOT c:WINDOWS /s s: /f all

c:WINDOWSSYSTEM32BCDBOOT c:WINDOWS /s s: /f all

if %errorlevel% NEQ 0 echo “Failed to set boot information” && goto :error

@echo.

@echo.

@echo.

@echo *****************************************************************

@echo Setting the recovery environment

@echo *****************************************************************

@echo c:windowssystem32reagentc /SetREImage /Path M:RECOVERYWINDOWSRE /target c:windows

c:windowssystem32reagentc /SetREImage /Path M:RECOVERYWINDOWSRE /target c:windows

if %errorlevel% NEQ 0 echo “Failed to set recovery information” && goto :error

@echo.

@echo.

@echo.

@echo *****************************************************************

@echo WIMboot image deployment COMPLETE. Type EXIT from Command

@echo Prompt to restart or turn off device.

@echo *****************************************************************

goto :END

:ERROR

@echo.

@echo An error has been detected.

@echo.

:END

Loading...

More from my site