@echo off
@rem This script is called by x:\Windows\System32\Startnet.cmd – WinPE
@echo.
@echo.
@echo.
@echo Running Intel Optimization powercfg for improved imaging times
@echo.
@echo.
@echo.
@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.>x:\listdisk.txt
@echo list disk>>x:\listdisk.txt
@echo exit>>x:\listdisk.txt
echo x:\listdisk.txt
@echo call diskpart /s x:\listdisk.txt
call diskpart /s x:\listdisk.txt>x:\Disks.txt
@echo.
@rem Set Disk equal to blank to start
set disk=
@echo.
@rem
@rem This line will write a diskpart script to select the disk and detail it's contents.
@rem We use this output to find a disk that does NOT have Winpe as the volume label.
@rem That disk will have the OS installed to it. This way you can exclude USB from diskpart.
@rem
@rem This works around the issue where the USB key is sometimes enumerated as disk 0 and the
@rem SSD is disk 1.
@rem
for /f "skip=8 tokens=2" %%A in (x:\Disks.txt) do (
@echo sel disk %%A>x:\Par.txt
@echo det disk>>x:\Par.txt
@echo exit>>x:\Par.txt
if NOT "%%A"=="DiskPart…" call :ListPar %%A
)
if "%Disk%"=="" echo No disk found without a volume label of "Winpe"&& set disk=0
@echo Using Disk "%Disk%"
@echo.
@echo.
@echo.
@rem *****************************************************************
@rem Detect if System is booted into UEFI mode or Bios mode
@rem *****************************************************************
for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') do set Firmware=%%B
@echo.
if %Firmware%==0×1 goto :Biosmode
if %Firmware%==0×2 goto :UEFImode
Goto :END
:UEFImode
@echo.
@rem ************************
@rem UEFI SECTION
@rem ************************
@echo The PC is booted in UEFI mode
@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=16>>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=700>>x:\winpart.txt
@echo create partition primary>>x:\winpart.txt
@echo format quick fs=ntfs label="Recovery">>x:\winpart.txt
@echo assign letter="R">>x:\winpart.txt
@echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac">>x:\winpart.txt
@echo gpt attributes=0×8000000000000001>>x:\winpart.txt
@echo exit>>x:\WinPart.txt
Goto :WINPARTSECTION
:WINPARTSECTION
@echo Winpart.txt now contains…..
@echo.
type x:\winpart.txt
@echo.
@echo.
@echo *****************************************************************
@echo Setting up the partition table
@echo *****************************************************************
@echo call diskpart /s x:\RemovePar.txt
diskpart /s %WinPESource%DiskpartFiles\RemovePar.txt
@echo call diskpart /s x:\DeletePar.txt
diskpart /s %WinPESource%DiskpartFiles\DeletePar.txt
@echo call diskpart /s x:\wimpart.txt
diskpart /s %WinPESource%DiskpartFiles\wimpart.txt
@echo.
@echo.
@echo *****************************************************************
@rem Map drive letter for Install.wim
@echo *****************************************************************
@ECHO.>x:\ListVol.txt
@ECHO List volume>>x:\ListVol.txt
@ECHO exit>>x:\ListVol.txt
@ECHO call diskpart /s x:\ListVol.txt
CALL DISKPART /s x:\ListVol.txt>x:\Output.txt
@ECHO.
@ECHO.
@REM Go through each drive letter, looking for the images\Install.txt file
FOR /f "skip=8 tokens=3" %%A IN (x:\Output.txt) DO (
IF EXIST %%A:\images\install.txt SET InstallPath=%%A:\images&& ECHO "Found device with images folder and install.txt file"
)
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Map drive letter for Install.swm and Winre.wim
@ECHO *****************************************************************
@REM Check InstallPath was found and there are images in it.
IF NOT EXIST %InstallPath%\Install.swm ECHO "Install.swm NOT found." && GOTO :ERROR
@ECHO Install.swm FOUND at %InstallPath%\install.swm
@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%\winre.wim
@ECHO.
@REM Check usmt.ppkg was found and there are images in it.
IF NOT EXIST %InstallPath%\usmt.ppkg ECHO "usmt.ppkg NOT found." && GOTO :ERROR
@ECHO usmt.ppkg FOUND at %InstallPath%\usmt.ppkg
@ECHO.
@ECHO Making directories…
MD x:\recycler\SCRATCH
IF %errorlevel% NEQ 0 ECHO "Failed to make x:\recycler\SCRATCH directory" && GOTO :ERROR
MD r:\Recovery\WindowsRE
IF %errorlevel% NEQ 0 ECHO "Failed to make r:\Recovery\WindowsRE directory" && GOTO :ERROR
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Copying Winre.wim.
@ECHO *****************************************************************
@ECHO copy %InstallPath%\Winre.wim r:\Recovery\WindowsRE
@ECHO Please waiting …
XCOPY %InstallPath%\Winre.wim r:\Recovery\WindowsRE /y
IF %ERRORlevel% NEQ 0 ECHO "Failed to copy Winre.wim to r:\Recovery\WindowsRE" && GOTO :ERROR
@ECHO.
@ECHO reset attributes winre.wim now
@ECHO attrib +s +h +a +r r:\Recovery\WindowsRE\Winre.wim
ATTRIB +s +h +a +r r:\Recovery\WindowsRE\Winre.wim
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Applying the Windows image from the USB
@ECHO *****************************************************************
@ECHO call DISM /Apply-Image /ImageFile:%InstallPath%\install.swm /SWMFile:%InstallPath%\install*.swm /Index:1 /ApplyDir:w:\ /Compact /ScratchDir:x:\recycler\SCRATCH
@ECHO Please waiting ..
CALL DISM /Apply-Image /ImageFile:%InstallPath%\install.swm /SWMFile:%InstallPath%\install*.swm /Index:1 /ApplyDir:w:\ /Compact /ScratchDir:x:\recycler\SCRATCH
IF %errorlevel% NEQ 0 ECHO "Failed to apply image to w:" && GOTO :ERROR
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Copying over Scanstate Packages
@ECHO *****************************************************************
@ECHO xcopy %InstallPath%\*.ppkg w:\Recovery\Customizations /y
XCOPY %InstallPath%\*.ppkg w:\Recovery\Customizations /y
IF %errorlevel% NEQ 0 ECHO "Failed to copy *.ppkg to w:\Recovery\Customizations" && GOTO :ERROR
@ECHO.
@ECHO Modify w:\Recovery folder access permissions
ICACLS w:\Recovery /inheritance:r /T
ICACLS w:\Recovery /grant:r "SYSTEM:(F)" /T
ICACLS w:\Recovery /grant:r "*S-1-5-32-544:(F)" /T
ATTRIB +s +h +r w:\Recovery\Customizations
ATTRIB +s +h +r w:\Recovery\OEM
ATTRIB +s +h +r w:\Recovery
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Setting the boot environment
@ECHO *****************************************************************
@ECHO call w:\WINDOWS\SYSTEM32\BCDBOOT w:\WINDOWS /s s: /f all
w:\WINDOWS\SYSTEM32\BCDBOOT w:\WINDOWS /s s: /f all
IF %errorlevel% NEQ 0 ECHO "Failed to set boot information" && GOTO :ERROR
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Setting the Recovery environment
@ECHO *****************************************************************
@ECHO w:\windows\system32\reagentc /SetREImage /Path r:\Recovery\WindowsRE /target w:\windows
w:\windows\system32\reagentc /SetREImage /Path r:\Recovery\WindowsRE /target w:\windows
IF %errorlevel% NEQ 0 ECHO "Failed to set Recovery information" && GOTO :ERROR
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Add default product key
@ECHO *****************************************************************
@REM ******************************************************************
@REM Windows 10 Default Product Keys to be used with OEM Activation 3.0
@REM ******************************************************************
@REM Windows 10 Home 37GNV-YCQVD-38XP9-T848R-FC2HD
@REM Windows 10 Home N 33CY4-NPKCC-V98JP-42G8W-VH636
@REM Windows 10 Pro NF6HC-QH89W-F8WYV-WWXV4-WFG6P
@REM Windows 10 Pro N NH7W7-BMC3R-4W9XT-94B6D-TCQG3
@REM Windows 10 SL NTRHT-XTHTG-GBWCG-4MTMP-HH64C
@REM Windows 10 CHN SL 7B6NC-V3438-TRQG7-8TCCX-H6DDY
@REM
@REM ******************************************************************
@REM Windows 10 Default Product Keys to be used without OEM Activation 3.0
@REM ******************************************************************
@REM Windows 10 Home 46J3N-RY6B3-BJFDY-VBFT9-V22HG
@REM Windows 10 Home N PGGM7-N77TC-KVR98-D82KJ-DGPHV
@REM Windows 10 Pro RHGJR-N7FVY-Q3B8F-KBQ6V-46YP4
@REM Windows 10 Pro N 2KMWQ-NRH27-DV92J-J9GGT-TJF9R
@REM Windows 10 SL GH37Y-TNG7X-PP2TK-CMRMT-D3WV4
@REM Windows 10 CHN SL 68WP7-N2JMW-B676K-WR24Q-9D7YC
@REM
@REM This is the default product key being used:
SET productkey=37GNV-YCQVD-38XP9-T848R-FC2HD
@ECHO.
@ECHO call DISM /Image:w: /Set-ProductKey:%productkey%
CALL DISM /Image:w: /Set-ProductKey:%productkey%
IF %errorlevel% NEQ 0 ECHO "Failed to SET productkey." && GOTO :ERROR
@ECHO.
@ECHO.
@ECHO *****************************************************************
@ECHO Copying over Unattend.xml to use on factory floor if it exists
@ECHO *****************************************************************
@ECHO if EXIST %InstallPath%\Unattend.xml xcopy %InstallPath%\Unattend.xml w:\Windows\Panther /y
IF EXIST %InstallPath%\Unattend.xml XCOPY %InstallPath%\Unattend.xml w:\Windows\Panther /y
@ECHO.
@ECHO.
@echo xcopy %InstallPath%\WIFI.cmd w:\ /y
IF EXIST %InstallPath%\WIFI.cmd xcopy %InstallPath%\WIFI.cmd w:\ /y
if %errorlevel% NEQ 0 echo "Failed to copy WIFI.cmd to w:\" && goto :error
@echo.
@echo *****************************************************************
@echo Trying to edit Registry for desktop Icons.
@echo *****************************************************************
reg load HKU\DEFAULTTEMP w:\users\default\ntuser.dat
reg add HKU\DEFAULTTEMP\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /d 00000000 /t REG_DWORD /f
rem reg add HKU\DEFAULTTEMP\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /d 00000000 /t REG_DWORD /f
rem reg add HKU\DEFAULTTEMP\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} /d 00000000 /t REG_DWORD /f
reg unload HKU\DEFAULTTEMP
@echo.
@ECHO.
@ECHO *****************************************************************
@ECHO Image deployment COMPLETE. Type EXIT from Command
@ECHO *****************************************************************
@ECHO.
GOTO :REBOOT
:LISTPAR
@REM This section is to bring a disk number and use it to List Partitions
@ECHO.
SET TempDisk=%1
DISKPART /s x:\Par.txt>x:\ParOutput.txt
FOR /f "skip=26 tokens=4" %%A IN (x:\ParOutput.txt) DO (
IF /i NOT "%%A"=="Winpe" SET Disk=%TempDisk%
)
GOTO :EOF
:REBOOT
@REM
@REM Get finish time so we can evaluate total WinPE phase time.
@REM
CALL |time>x:\StopTime.txt
@ECHO.
@ECHO Deployment complete, system restart.
WPEUTIL REBOOT
@ECHO.
:ERROR
@ECHO.
@ECHO An error has been detected.
COLOR 4F
@ECHO.
GOTO :END
:END
@REM
@REM Get finish time so we can evaluate total WinPE phase time.
@REM
CALL |time>x:\StopTime.txt
@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.
room is windows 10 or android ?
win 10
Do you have updated android rom?
here https://www.needrom.com/downlo.....s-a5c8-android/