iView i895QW

@echo off

COLOR 0F

title Rev:11.0.4.2

rem This script is called by x:WindowsSystem32Startnet.cmd – WinPE

rem *******************************************************************

rem FLASH_BIOS=1 Auto flash BIOS

rem FLASH_BIOS=0 Do not auto flash BIOS

rem *******************************************************************

set FLASH_BIOS=0

rem *******************************************************************

set SINGLE_OS=0

rem *******************************************************************

set PPKG_FILE=1

set SPP_FILE=1

set SINGLE_INSTANCE=1

set COMPACT_OS=1

rem *******************************************************************

@echo.

@echo Running Intel Optimization powercfg for improved imaging times

@echo.

@echo call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

@echo.

set SCRIPTS_PATH=%WinPESource%Scripts

set IMAGES_PATH=%WinPESource%Images

@echo.

if “%1″==”PXE” (

set WinPESource=y:

) else (

set WinPESource=%WinPESource%

)

:SelectDisk

rem *****************************************************************

rem List all the disks, then search the volumes of each one to see

rem which disks may have “Winpe” in the label. We will ignore that

rem disk and use the first disk without the Winpe label that we find.

rem *****************************************************************

@echo.

rem Set Disk equal to blank to start

@echo Select Disk which eMMC

call :Fun_SelectDisk

if “%Disk%”==”” echo eMMC not found && goto :ERROR

:ListParTable

@echo.

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

@echo Checkup SingleOS or DualOS or whether exist windows partiton

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

rem create diskpart script for search windows partitions from emmc disk

@echo.>x:ListPar.txt

@echo select disk %Disk% >>x:ListPar.txt

@echo list partition >>x:ListPar.txt

@echo exit >>x:ListPar.txt

@echo.

rem run diskpart script

diskpart /s x:ListPar.txt >x:eMMCPar.txt

if %ERRORLEVEL% NEQ 0 echo Diskpart error && goto :Error

@echo.

rem SingleOS / DualOS switch

find “Partition 7” x:eMMCPar.txt >nul

if %ERRORLEVEL% NEQ 0 set OS=SingleOS&& goto :P artition

@echo Lis Vol>x:FindVol.txt

diskpart /s x:FindVol.txt>x:VolumeList.txt

rem set android volume hide

@echo. >x:HideVol.txt

@echo select disk %Disk%>>x:HideVol.txt

for /f “tokens=2,5” %%i in (‘type x:VolumeList.txt ^| find “RAW”‘) do (

if “%%j”==”Partition” (

@echo Select Volume %%i >>x:HideVol.txt

@echo attributes volume set hidden >>x:HideVol.txt

)

)

@echo call diskpart /s x:HideVol.txt

call diskpart /s x:HideVol.txt

rem ensure it’s DualOS,and check whether exist windows partition,if not:create the new windows partition

rem rem find “Partition 16” x:eMMCPar.txt >nul

rem rem if %ERRORLEVEL% NEQ 0 set OS=DualOS&& goto :P artition

@echo. >x:WinPar.txt

@echo. >x:DelPar.txt

@echo select disk %Disk%>>x:WinPar.txt

@echo select disk %Disk%>>x:DelPar.txt

for /f “skip=1 tokens=2” %%i in (‘type x:eMMCPar.txt ^| find “Partition”‘) do (

@echo select disk %Disk%>x:WinPar.txt

@echo select Partition %%i>>x:WinPar.txt

@echo detail partition >>x:WinPar.txt

@echo exit >>x:WinPar.txt

diskpart /s x:WinPar.txt>x:ParPro.txt

if %ERRORLEVEL% NEQ 0 echo Diskpart error && goto :Error

for /f %%j in (‘type x:ParPro.txt ^| find /c “de94bba4-06d1-4d40-a16a-bfd50179d6ac”‘) do (

if “%%j”==”1” echo select disk %Disk%>x:DelPar.txt

if “%%j”==”1” echo select partition %%i

if “%%j”==”1” echo select partition %%i >>x:DelPar.txt

if “%%j”==”1” echo delete Partition override >>x:DelPar.txt

if “%%j”==”1” echo exit >>x:DelPar.txt

if “%%j”==”1” diskpart /s x:DelPar.txt

)

for /f %%j in (‘type x:ParPro.txt ^| find /c “ebd0a0a2-b9e5-4433-87c0-68b6b72699c7″‘) do (

if “%%j”==”1” (

for /f %%k in (‘type x:ParPro.txt ^| find /c “RAW”‘) do (

if “%%k”==”0” echo select disk %Disk%>x:DelPar.txt

if “%%k”==”0” echo select partition %%i

if “%%k”==”0” echo select partition %%i >>x:DelPar.txt

if “%%k”==”0” echo delete Partition override >>x:DelPar.txt

if “%%k”==”0” echo exit >>x:DelPar.txt

if “%%k”==”0” diskpart /s x:DelPar.txt

)

)

)

for /f %%j in (‘type x:ParPro.txt ^| find /c “e3c9e316-0b5c-4db8-817d-f92df00215ae”‘) do (

if “%%j”==”1” echo select disk %Disk%>x:DelPar.txt

if “%%j”==”1” echo select partition %%i

if “%%j”==”1” echo select partition %%i >>x:DelPar.txt

if “%%j”==”1” echo delete Partition override >>x:DelPar.txt

if “%%j”==”1” echo exit >>x:DelPar.txt

if “%%j”==”1” diskpart /s x:DelPar.txt

)

for /f %%j in (‘type x:ParPro.txt ^| find /c “c12a7328-f81f-11d2-ba4b-00a0c93ec93b”‘) do (

if “%%j”==”1” echo select disk %Disk%>x:AssignLetter.txt

if “%%j”==”1” echo select partition %%i

if “%%j”==”1” echo select partition %%i >>x:AssignLetter.txt

if “%%j”==”1″ echo assign letter=”S” >>x:AssignLetter.txt

if “%%j”==”1” echo exit >>x:AssignLetter.txt

if “%%j”==”1” diskpart /s x:AssignLetter.txt

)

)

set OS=DualOS&& goto :P artition

:P artition

@echo ———————————————————————–

@echo Map drive letter for Install.wim

@echo ———————————————————————–

if EXIST %IMAGES_PATH%*.wim (

@echo “Found device with images folder”

set InstallPath=%IMAGES_PATH%

)

@echo.

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

@echo.

setlocal enabledelayedexpansion

cd /d %InstallPath%

set num=””

for /f “delims=” %%i in (‘dir /a-d /b *.wim’) do (

set /a num+=1

if “!num!” == “!num!” (

set WIM_NAME!num!=%%~ni

set WIM_SIZE_NAME!num!=%%~zi

)

)

if NOT “%WIM_NAME3%”==”” echo Can not select *.WIM && goto :Error

setlocal enabledelayedexpansion

cd /d %InstallPath%

set num=””

for /f “delims=” %%i in (‘dir /a-d /b /on *.swm’) do (

set /a num+=1

if “!num!” == “!num!” (

set SWM_NAME!num!=%%~ni

set SWM_NUM=!num!

)

)

if NOT “%SWM_NUM%”==”” (

echo Found *.swm at images path

set TARGET_WIM=%SWM_NAME1%

set RE_WIM=%WIM_NAME2%

set RE_WIM_SIZE=%WIM_SIZE_NAME2%

if /i “%RE_WIM%”==”Winre” (

set RE_WIM=%WIM_NAME1%

set RE_WIM_SIZE=%WIM_SIZE_NAME1%

)

)

if “%SWM_NUM%”==”” (

echo Found *.wim at images path

set TARGET_WIM=%WIM_NAME1%

set RE_WIM=%WIM_NAME2%

set RE_WIM_SIZE=%WIM_SIZE_NAME2%

if /i “%WIM_NAME1%”==”Winre” (

set TARGET_WIM=%WIM_NAME2%

set RE_WIM=%WIM_NAME1%

set RE_WIM_SIZE=%WIM_SIZE_NAME1%

)

)

@echo. %TARGET_WIM%

if “%TARGET_WIM%”==”” echo The windows image name not specified && goto :Error

@echo.

if defined RE_WIM_SIZE set /a RE_WIM_SIZE=%RE_WIM_SIZE:~0,-6%

if not defined RE_WIM_SIZE set /a RE_WIM_SIZE=0

if %RE_WIM_SIZE% LSS 430 set /a RECOVERY_SIZE=480

if %RE_WIM_SIZE% GEQ 430 (

if %RE_WIM_SIZE% LSS 680 (

set /a RECOVERY_SIZE=%RE_WIM_SIZE%+320

) else (

set /a RECOVERY_SIZE=%RE_WIM_SIZE%+1024

)

)

if “%SINGLE_OS%”==”1” set OS=SingleOS

@echo.

@echo ———————————————————————–

@echo Write the diskpart script now that we know what disk to use

@echo ———————————————————————–

:: SingleOS

if “%OS%”==”SingleOS” (

@echo call :Fun_ParSingleOS

call :Fun_ParSingleOS

)

:: DualOS

if “%OS%”==”DualOS” (

@echo call :Fun_ParDualOS

call :Fun_ParDualOS

)

@echo Winpart.txt now contains…..

type x:winpart.txt

@echo.

@echo ———————————————————————–

@echo Setting up the partition table

@echo ———————————————————————–

@echo call diskpart /s x:winpart.txt

diskpart /s x:winpart.txt

if %ERRORLEVEL% NEQ 0 echo Diskpart error && goto :Error

@echo.

@echo Making directories…

md w:recyclerscratch

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

@echo.

md z:recoverywindowsre

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

@echo.

@echo ———————————————————————–

@echo Applying the Windows image from the USB

@echo ———————————————————————–

if “%SWM_NUM%”==”” goto :D eployWIM

if NOT “%SWM_NUM%”==”” goto :D eploySWM

goto :Error

:D eployWIM

@echo Get windows image version

setlocal enabledelayedexpansion

for /f “usebackq skip=5 tokens=3″ %%d in (`DISM /Get-WimInfo /WimFile:”%InstallPath%%TARGET_WIM%.wim” /Index:1`) do (

if %%d==10.0.10586 set OS_VER=TH2

if %%d==10.0.14393 set OS_VER=RS1

)

if “%OS_VER%”==”TH2” (

if “%COMPACT_OS%”==”0” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

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

)

if “%COMPACT_OS%”==”1” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

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

)

) else (

if “%OS_VER%”==”RS1” (

if “%COMPACT_OS%”==”0” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

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

)

if “%COMPACT_OS%”==”1” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.wim” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

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

)

) else (

@echo The Windows version not found

goto :Error

)

)

goto :SetWinRE

:D eploySWM

@echo Get windows image version

setlocal enabledelayedexpansion

for /f “usebackq skip=5 tokens=3″ %%d in (`DISM /Get-WimInfo /WimFile:”%InstallPath%%TARGET_WIM%.swm” /Index:1`) do (

if %%d==10.0.10586 set OS_VER=TH2

if %%d==10.0.14393 set OS_VER=RS1

)

if “%OS_VER%”==”TH2” (

if “%COMPACT_OS%”==”0” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH”

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH”

if %ERRORLEVEL% NEQ 0 echo “Failed to apply image to w:” && goto :error

)

if “%COMPACT_OS%”==”1” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact

if %ERRORLEVEL% NEQ 0 echo “Failed to apply image to w:” && goto :error

)

) else (

if “%OS_VER%”==”RS1” (

if “%COMPACT_OS%”==”0” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /EA

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /EA

if %ERRORLEVEL% NEQ 0 echo “Failed to apply image to w:” && goto :error

)

if “%COMPACT_OS%”==”1” (

@echo call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

call dism /apply-image /imagefile:”%InstallPath%%TARGET_WIM%.swm” /SWMFile:”%InstallPath%%TARGET_WIM%*.swm” /index:1 /applydir:w: /scratchdir:”w:recyclerSCRATCH” /compact /EA

if %ERRORLEVEL% NEQ 0 echo “Failed to apply image to w:” && goto :error

)

) else (

@echo The Windows version not found

goto :Error

)

)

goto :SetWinRE

:SetWinRE

@echo.

@echo ———————————————————————–

@echo Move WinRE to Recovery Partition

@echo ———————————————————————–

if EXIST %InstallPath%Winre.wim (

@echo xcopy %InstallPath%Winre.wim z:recoverywindowsre /y

xcopy %InstallPath%Winre.wim z:recoverywindowsre /y

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

) else (

@echo Modifying attributes of winre.wim so we can move it.

attrib w:WindowsSystem32recoverywinre.wim -s -h -a -r

@echo move w:WindowsSystem32recoverywinre.wim z:recoverywindowsre

move w:WindowsSystem32recoverywinre.wim z:recoverywindowsre

if %ERRORLEVEL% NEQ 0 echo “Failed to move winre.wim to z:recoverywindowsre” && goto :error

)

@echo.

@echo reset attributes now

attrib z:RecoveryWindowsrewinre.wim +s +h +a +r

@echo.

:SetBootEnvironment

@echo ———————————————————————–

@echo Setting the boot environment

@echo ———————————————————————–

if “%OS%”==”SingleOS” (

@echo call :Fun_SetBoot

call :Fun_SetBoot

)

if “%OS%”==”DualOS” (

@echo call :Fun_SetBoot

call :Fun_SetBoot

@echo call :D ualOSQ2S

call :D ualOSQ2S

)

@echo ———————————————————————–

@echo Setting the recovery environment

@echo ———————————————————————–

@echo w:windowssystem32reagentc /SetREImage /Path z:RECOVERYWINDOWSRE /target w:windows

w:windowssystem32reagentc /SetREImage /Path z:RECOVERYWINDOWSRE /target w:windows

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

@echo.

rmdir /s /q w:recycler

@echo.

if “%FLASH_BIOS%”==”1” goto :FLASH_BIOS

goto :END

:FLASH_BIOS

@echo.

if EXIST %InstallPath%BIOS*.bin xcopy /y %InstallPath%BIOS*.bin %SCRIPTS_PATH%Tools

if EXIST %InstallPath%BIOS*.rom xcopy /y %InstallPath%BIOS*.rom %SCRIPTS_PATH%Tools

cd /d %SCRIPTS_PATH%Tools

setlocal enabledelayedexpansion

set num=””

if EXIST *.bin (

for /f “delims=” %%i in (‘dir /a-d /b *.bin’) do (

set /a num+=1

if “!num!” == “!num!” (

set BIOS_NAME!num!=%%~i

)

)

)

if EXIST *.rom (

for /f “delims=” %%i in (‘dir /a-d /b *.rom’) do (

set /a num+=1

if “!num!” == “!num!” (

set BIOS_NAME!num!=%%~i

)

)

)

if “%BIOS_NAME1%”==”” echo BIOS file does not exist && goto :Error

if NOT “%BIOS_NAME2%”==”” echo Too many *.bin files in the BIOS folder,Please keep only one *.bin file && goto :Error

set BIOS_NAME=%BIOS_NAME1%

@echo.

setlocal enabledelayedexpansion

set num=””

for /f “tokens=1,* delims==” %%a in (‘wmic BIOS get Manufacturer /value’) do (

set /a num+=1

if “!num!” == “3” (

set MANUFACTURER_NAME=%%b

)

)

@echo.

@echo ———————————————————————–

@echo BIOS file FOUND at %InstallPath%BIOS

@echo Current select BIOS is %BIOS_NAME%

@echo Start flashing BIOS…

@echo ———————————————————————–

@echo.

if “%MANUFACTURER_NAME%”==”American Megatrends Inc.” goto :AMI_BIOS

if “%MANUFACTURER_NAME%”==”INSYDE Corp.” goto :INSYDE_BIOS

@echo Unknown BIOS manufacturer, please upgrade WINPE to the latest version && goto :Error

:AMI_BIOS

@echo Flashing AMI BIOS…

if /i “%PROCESSOR_ARCHITECTURE%”==”x86” (

AFUWIN.EXE %BIOS_NAME% /P /B /N /X /JBC

if %errorlevel% NEQ 0 echo “Failed to flash BIOS” && goto :error

)

if /i “%PROCESSOR_ARCHITECTURE%”==”amd64” (

AFUWINx64.EXE %BIOS_NAME% /P /B /N /X /JBC

if %errorlevel% NEQ 0 echo “Failed to flash BIOS” && goto :error

)

del /q %SCRIPTS_PATH%Tools*.bin

goto :END

:INSYDE_BIOS

@echo Flashing Insyde BIOS…

for /r “%SCRIPTS_PATH%Tools” %%Z in (*.bin) do (

ren “%%Z” “%%~na.fd”

)

for /r “%SCRIPTS_PATH%Tools” %%Z in (*.rom) do (

ren “%%Z” “%%~na.fd”

)

if NOT EXIST %SCRIPTS_PATH%Tools*.fd echo “Can not find the BIOS file” && goto :error

:: Flash BIOS

if /i “%PROCESSOR_ARCHITECTURE%”==”x86” %SCRIPTS_PATH%ToolsH2OFFT-W.exe

if /i “%PROCESSOR_ARCHITECTURE%”==”amd64” %SCRIPTS_PATH%ToolsH2OFFT-Wx64.exe

del /q %SCRIPTS_PATH%Tools*.fd

if %errorlevel% NEQ 0 echo “Failed to flash BIOS” && goto :error

goto :END

:ERROR

color 4f

@echo.

@echo An error has been detected.

@echo.

@echo Input Ctrl + C to exit

pause >nul

goto :ERROR

:Fun_SelectDisk

@echo.>x:ListDisk.txt

@echo list disk >>x:ListDisk.txt

@echo exit >>x:ListDisk.txt

rem run diskpart script

diskpart /s x:ListDisk.txt >x:eMMCDisk.txt

for /f “skip=1 tokens=2” %%i in (‘type x:eMMCDisk.txt ^| find “Disk”‘) do (

@echo select disk %%i>x:DetailDisk.txt

@echo detail disk >>x:DetailDisk.txt

@echo exit >>x:DetailDisk.txt

@echo diskpart /s x:DetailDisk.txt>x:DiskInfo.txt

diskpart /s x:DetailDisk.txt>x:DiskInfo.txt

for /f “tokens=3” %%a in (‘type x:DiskInfo.txt ^| find “Type :”‘) do (

@echo Disk type :%%a

if “%%a”==”SD” set Disk=%%i && goto :EOF

)

)

set Disk=

goto :EOF

:Fun_ParSingleOS

@echo.>x:winpart.txt

@echo select disk %Disk%>>x:winpart.txt

@echo clean>>x:winpart.txt

@echo convert gpt>>x:winpart.txt

@echo create partition efi size=100>>x:winpart.txt

@echo format quick fs=fat32 label=”System”>>x:winpart.txt

@echo assign letter=”S”>>x:winpart.txt

@echo create partition msr size=128>>x:winpart.txt

@echo create partition primary>>x:winpart.txt

@echo format quick fs=ntfs label=”Windows”>>x:winpart.txt

@echo assign letter=”W”>>x:winpart.txt

@echo shrink desired=%RECOVERY_SIZE%>>x:winpart.txt

@echo create partition primary>>x:winpart.txt

@echo format quick fs=ntfs label=”Recovery”>>x:winpart.txt

@echo assign letter=”Z”>>x:winpart.txt

@echo set>>x:winpart.txt

@echo gpt attributes=0×8000000000000001>>x:winpart.txt

@echo exit>>x:WinPart.txt

goto :EOF

:Fun_ParDualOS

@echo.>x:winpart.txt

@echo select disk %Disk%>>x:winpart.txt

@echo create partition msr size=128>>x:winpart.txt

@echo create partition primary>>x:winpart.txt

@echo format quick fs=ntfs label=”Windows”>>x:winpart.txt

@echo assign letter=”W”>>x:winpart.txt

@echo shrink desired=%RECOVERY_SIZE%>>x:winpart.txt

@echo create partition primary>>x:winpart.txt

@echo format quick fs=ntfs label=”Recovery”>>x:winpart.txt

@echo assign letter=”Z”>>x:winpart.txt

@echo set>>x:winpart.txt

@echo gpt attributes=0×8000000000000001>>x:winpart.txt

@echo exit>>x:WinPart.txt

goto :EOF

:Fun_DualOSQ2S

if NOT EXIST w:RecoveryOEMBackupOEMScript.cmd echo.>w:RecoveryOEMBackupOEMScript.cmd

if NOT EXIST w:WindowsOEMScript.cmd echo.>w:WindowsOEMScript.cmd

echo if /i “%%PROCESSOR_ARCHITECTURE%%”==”x86” cmd.exe /c msiexec /passive /norestart /i %%WINDIR%%OEMInsydeQ2S_x86.msi >>w:WindowsOEMScript.cmd

echo if /i “%%PROCESSOR_ARCHITECTURE%%”==”x86” cmd.exe /c msiexec /passive /norestart /i %%WINDIR%%OEMInsydeQ2S_x86.msi >>w:RecoveryOEMBackupOEMScript.cmd

echo if /i “%%PROCESSOR_ARCHITECTURE%%”==”AMD64” cmd.exe /c msiexec /passive /norestart /i %%WINDIR%%OEMInsydeQ2S_x64.msi >>w:WindowsOEMScript.cmd

echo if /i “%%PROCESSOR_ARCHITECTURE%%”==”AMD64” cmd.exe /c msiexec /passive /norestart /i %%WINDIR%%OEMInsydeQ2S_x64.msi >>w:RecoveryOEMBackupOEMScript.cmd

echo REG ADD “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation” /v “RealTimeIsUniversal” /t REG_DWORD /d 1 /f >>w:WindowsOEMScript.cmd

echo REG ADD “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation” /v “RealTimeIsUniversal” /t REG_DWORD /d 1 /f >>w:RecoveryOEMBackupOEMScript.cmd

if /i “%PROCESSOR_ARCHITECTURE%”==”x86” xcopy /y /e %SCRIPTS_PATH%ToolsDualOSInsydeQ2S_x86.msi w:RecoveryOEMBackupOEM

if /i “%PROCESSOR_ARCHITECTURE%”==”x86” xcopy /y /e %SCRIPTS_PATH%ToolsDualOSInsydeQ2S_x86.msi w:WindowsOEM

if /i “%PROCESSOR_ARCHITECTURE%”==”amd64” xcopy /y /e %SCRIPTS_PATH%ToolsDualOSInsydeQ2S_x64.msi w:RecoveryOEMBackupOEM

if /i “%PROCESSOR_ARCHITECTURE%”==”amd64” xcopy /y /e %SCRIPTS_PATH%ToolsDualOSInsydeQ2S_x64.msi w:WindowsOEM

goto :EOF

:Fun_SetBoot

@echo call w:WINDOWSSYSTEM32BCDBOOT w:WINDOWS /s s: /f UEFI

w:WINDOWSSYSTEM32BCDBOOT w:WINDOWS /s s: /f UEFI

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

goto :EOF

:END

@echo.

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

@echo Copy over Test tools to TEST_TOOL

@echo TEST_TOOL SHOULD BE DELETED PRIOR TO SHIPPING

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

@echo %SCRIPTS_PATH%7za.exe x w:TEST_TOOL.zip -oW:

if EXIST %WinpeSource%TEST_TOOL.zip (

if /i “%PROCESSOR_ARCHITECTURE%”==”x86” %SCRIPTS_PATH%7za.exe x %WinpeSource%TEST_TOOL.zip -oW:

if /i “%PROCESSOR_ARCHITECTURE%”==”amd64” %SCRIPTS_PATH%7za_x64.exe x %WinpeSource%TEST_TOOL.zip -oW:

)

@echo.

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

@echo Copying over Unattend.xml to use on factory floor if it exists

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

@echo if EXIST %InstallPath%Unattend.xml copy %InstallPath%Unattend.xml w:WindowsPanther /y

if EXIST %InstallPath%Unattend.xml copy %InstallPath%Unattend.xml w:WindowsPanther /y

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

@echo Copying over Unattend.xml to use on factory floor if it exists

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

@echo if EXIST %InstallPath%LayoutModification.xml copy %InstallPath%LayoutModification.xml w:UsersDefaultAppDataLocalMicrosoftWindowsShell /y

if EXIST %InstallPath%LayoutModification.xml copy %InstallPath%LayoutModification.xml w:UsersDefaultAppDataLocalMicrosoftWindowsShell /y

if EXIST %InstallPath%DefaultLayouts.xml copy %InstallPath%DefaultLayouts.xml w:UsersDefaultAppDataLocalMicrosoftWindowsShell /y

@echo.

:SampleOS

@rem Remove exist TP FW

if EXIST w:WindowsInfTouchSetting.gt del /q w:WindowsInfTouchSetting.gt

if EXIST w:WindowsSystem32DriversSileadTouch.fw del /q w:WindowsSystem32DriversSileadTouch.fw

@rem Add TP drivers

if NOT EXIST %TPPath% echo The TP driver floder not found && goto :ERROR

set DriverPath=%TPPath%

if EXIST %DriverPath%Drivers*.inf (

@echo DISM /Image:W: /Add-Driver /Driver:%DriverPath%Drivers /recurse

DISM /Image:w: /Add-Driver /Driver:”%DriverPath%Drivers” /recurse

if %ERRORLEVEL% NEQ 0 goto :ERROR

)

if EXIST %DriverPath%*.inf (

@echo DISM /Image:W: /Add-Driver /Driver:%DriverPath% /recurse

DISM /Image:w: /Add-Driver /Driver:”%DriverPath%” /recurse

if %ERRORLEVEL% NEQ 0 goto :ERROR

)

if EXIST %TPPath%TouchSetting.gt xcopy /y %TPPath%TouchSetting.gt w:WindowsInf

if EXIST %TPPath%SileadTouch.fw xcopy /y %TPPath%SileadTouch.fw w:WindowsSystem32Drivers

@rem For recovery

@echo.

attrib -s -h w:Recovery

if EXIST w:WindowsSystem32DriversSileadTouch.fw xcopy /chrkyi w:WindowsSystem32DriversSileadTouch.fw w:RecoveryOEMBackup

if EXIST w:WindowsInfTouchSetting.gt xcopy /chrkyi w:WindowsInfTouchSetting.gt w:RecoveryOEMBackup

if EXIST %DriverPath%Drivers*.inf xcopy /cherkyi %DriverPath%Drivers* w:RecoveryOEMBackupOEMDrivers

if EXIST %DriverPath%*.inf xcopy /cherkyi %DriverPath%* w:RecoveryOEMBackupOEMDrivers

attrib +s +h w:Recovery

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

@echo Copying over NON Scanstate Packages, if they exist.

@echo IF YOU COPY OVER SCANSTATE PPKG, THIS CAUSE IMAGE TO FAIL DURING RECOVERY

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

@echo.

@echo if EXIST %InstallPath%*.ppkg copy %InstallPath%*.ppkg w:RecoveryCustomizations /y

if EXIST %InstallPath%*.ppkg copy %InstallPath%*.ppkg w:RecoveryCustomizations /y

@echo Apply PPKG

set PPKG_PATH=w:RecoveryCustomizations

if “%PPKG_FILE%”==”0” del /s /q %PPKG_PATH%usmt.ppkg

if “%SINGLE_INSTANCE%”==”1” (

@echo if EXIST w:RecoveryCustomizationsusmt.ppkg DISM /Apply-CustomDataImage /CustomDataImage:w:RecoveryCustomizationsusmt.ppkg /ImagePath:w: /SingleInstance

if EXIST w:RecoveryCustomizationsusmt.ppkg DISM /Apply-CustomDataImage /CustomDataImage:w:RecoveryCustomizationsusmt.ppkg /ImagePath:w: /SingleInstance

)

@echo.

@echo Apply… SPP

@echo if EXIST %InstallPath%*.spp copy %InstallPath%*.spp w:RecoveryCustomizations /y

if EXIST %InstallPath%*.spp copy %InstallPath%*.spp w:RecoveryCustomizations /y

set SPP_PATH=w:RecoveryCustomizations

if “%SPP_FILE%”==”1” (

setlocal enabledelayedexpansion

cd /d %SPP_PATH%

set num=””

for /f “delims=” %%i in (‘dir /a-d /b *.spp’) do (

set /a num+=1

if “!num!” == “!num!” (

@echo set PackagePath!num!=%%~ni

set PackagePath!num!=%%~ni

)

)

)

@echo Apply-SiloedPackage / Only support 4 SPP

if %num%==1 DISM.exe /ImagePath:w: /Apply-SiloedPackage /PackagePath:%SPP_PATH%%PackagePath1%.spp

if %num%==2 DISM.exe /ImagePath:w: /Apply-SiloedPackage /PackagePath:%SPP_PATH%%PackagePath1%.spp /PackagePath:%SPP_PATH%%PackagePath2%.spp

if %num%==3 DISM.exe /ImagePath:w: /Apply-SiloedPackage /PackagePath:%SPP_PATH%%PackagePath1%.spp /PackagePath:%SPP_PATH%%PackagePath2%.spp /PackagePath:%SPP_PATH%%PackagePath3%.spp

if %num%==4 DISM.exe /ImagePath:w: /Apply-SiloedPackage /PackagePath:%SPP_PATH%%PackagePath1%.spp /PackagePath:%SPP_PATH%%PackagePath2%.spp /PackagePath:%SPP_PATH%%PackagePath3%.spp /PackagePath:%SPP_PATH%%PackagePath4%.spp

@echo.

rem

rem Get finish time so we can evaluate total WinPE phase time.

rem

call |time>x:StopTime.txt

rem

rem Now parse both files to display the Start and Finish Time

rem

@echo.

for /f “tokens=5” %%A in (x:starttime.txt) do echo Script Start Time is %%A

for /f “tokens=5” %%A in (x:stoptime.txt) do echo Script Stop Time is %%A

@echo.

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

@echo Image deployment COMPLETE. Type EXIT from Command

@echo Prompt to restart or turn off device.

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

exit

GET 1 USD FOR LINK DOWNLOAD

NOTE: contact via email [email protected] , i will sent link download for you

More from my site