level 10
sdjnzczp
楼主
@echo off
@rem This script is called by x:\Windows\System32\Startnet.cmd - WinPE
@echo.
@echo.
@echo.
@echo.
@rem *******************************************************************
@rem FLASH_BIOS=1 Auto flash BIOS / FLASH_BIOS=0 Do not auto flash BIOS
@rem *******************************************************************
@echo.
set FLASH_BIOS=0
@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.
@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 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 *****************************************************************
@rem Map drive letter for Install.wim and Winre.wim
@echo *****************************************************************
@rem Create an output file containing all the drive letters
@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:\Listdisk.txt>x:\Output.txt
@echo call diskpart /s x:\listVol.txt>x:\Output.txt
diskpart /s x:\listVol.txt>x:\Output.txt
@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 *****************************************************************
@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
@echo.
@rem SingleOS / DualOS switch
find "Partition 10" x:\eMMCPar.txt >nul
if %ERRORLEVEL% NEQ 0 Goto :SingleOS
@rem ensure it's DualOS,and check whether exist windows partition,if not:create the new windows partition
find "Partition 16" x:\eMMCPar.txt >nul
if %ERRORLEVEL% NEQ 0 Goto :DualOS
@echo.>x:\checkpart.txt
@echo select disk "%Disk%">>x:\checkpart.txt
@echo list partition>>x:\checkpart.txt
@echo exit>>x:\checkpart.txt
@echo call diskpart /s x:\checkpart.txt>x:\outpar.txt
call diskpart /s x:\checkpart.txt>x:\outpar.txt
@echo.
@echo.>x:\DelPar.txt
@echo select disk "%Disk%">>x:\DelPar.txt
for /f "skip=25 tokens=2" %%A in (x:\outpar.txt) do (
if %%A NEQ DiskPart... echo select partition %%A>>x:\DelPar.txt && echo delete partition override>>x:\DelPar.txt
)
echo exit>>x:\DelPar.txt
diskpart /s x:\DelPar.txt
Goto :DualOS
:SingleOS
@echo.
@echo This is a SingleOS!
@echo.
@echo.
: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=450>>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=0x8000000000000001>>x:\winpart.txt
@echo exit>>x:\WinPar
2015年08月04日 17点08分
1
@rem This script is called by x:\Windows\System32\Startnet.cmd - WinPE
@echo.
@echo.
@echo.
@echo.
@rem *******************************************************************
@rem FLASH_BIOS=1 Auto flash BIOS / FLASH_BIOS=0 Do not auto flash BIOS
@rem *******************************************************************
@echo.
set FLASH_BIOS=0
@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.
@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 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 *****************************************************************
@rem Map drive letter for Install.wim and Winre.wim
@echo *****************************************************************
@rem Create an output file containing all the drive letters
@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:\Listdisk.txt>x:\Output.txt
@echo call diskpart /s x:\listVol.txt>x:\Output.txt
diskpart /s x:\listVol.txt>x:\Output.txt
@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 *****************************************************************
@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
@echo.
@rem SingleOS / DualOS switch
find "Partition 10" x:\eMMCPar.txt >nul
if %ERRORLEVEL% NEQ 0 Goto :SingleOS
@rem ensure it's DualOS,and check whether exist windows partition,if not:create the new windows partition
find "Partition 16" x:\eMMCPar.txt >nul
if %ERRORLEVEL% NEQ 0 Goto :DualOS
@echo.>x:\checkpart.txt
@echo select disk "%Disk%">>x:\checkpart.txt
@echo list partition>>x:\checkpart.txt
@echo exit>>x:\checkpart.txt
@echo call diskpart /s x:\checkpart.txt>x:\outpar.txt
call diskpart /s x:\checkpart.txt>x:\outpar.txt
@echo.
@echo.>x:\DelPar.txt
@echo select disk "%Disk%">>x:\DelPar.txt
for /f "skip=25 tokens=2" %%A in (x:\outpar.txt) do (
if %%A NEQ DiskPart... echo select partition %%A>>x:\DelPar.txt && echo delete partition override>>x:\DelPar.txt
)
echo exit>>x:\DelPar.txt
diskpart /s x:\DelPar.txt
Goto :DualOS
:SingleOS
@echo.
@echo This is a SingleOS!
@echo.
@echo.
: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=450>>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=0x8000000000000001>>x:\winpart.txt
@echo exit>>x:\WinPar