FFUMain.cmd

@echo This script is for Windows10 Capture FFU USB windows usage 
@echo ==================== File Version V4.4.0.1 ====================
@echo                                          john.liu@emdoor.com
@echo                                          ------------2017-12-16
@echo.
@echo off
@rem  This script is called by x:\Windows\System32\Startnet.cmd - WinPE
@echo.
@echo Running Intel Optimization powercfg for improved imaging times
@echo.
@echo  ============================ Step 0000 Recorde strattime============================
call |time>x:\StartTime.txt
@echo  ============================ Step 0001  Powercfg============================
@echo call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
@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 *****************************************************************
@rem  Map drive letter for install.ffu
@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.
@rem Go through each drive letter, looking for the images\Capture.txt file
for /f "skip=8 tokens=3" %%A in (x:\Output.txt) do (
if exist %%A:\images\Capture.txt set CapturePath=%%A:\images&& echo "Found device with images folder and Capture.txt file"
)
@echo.
@echo.
@echo *****************************************************************
@echo  Capture the Windows image from the USB IMAGES
@echo *****************************************************************
REM @echo call DISM.exe /capture-ffu /imagefile:%CapturePath%\WinOEM.ffu /capturedrive=\\.\PhysicalDrive%Disk% /name:%Disk% /description:"Windows 10 FFU"
REM call DISM.exe /capture-ffu /imagefile:%CapturePath%\WinOEM.ffu /capturedrive=\\.\PhysicalDrive%Disk% /name:%Disk% /description:"Windows 10 FFU"
ApplyImage.bat %CapturePath%\WinOEM.ffu


color 2f
@echo *********************************************************************
@ECHO     PPPPPPPPpp            A            sSSSSSSSSs       sSSSSSSSSs
@ECHO     PPP       PPp        AAA         SSs        SS    SSs        SS
@ECHO     PPP        PPP      AA AA       SSS              SSS
@ECHO     PPP        PPP     AA   AA      SSS              SSS
@ECHO     PPP       PPP     AA     AA      SSSSSs           SSSSSs
@ECHO     PPPPPPPPPP       aAA     AAa          SSSSSs           SSSSSs
@ECHO     PPP             aAAAAAAAAAAAa              SSS              SSS
@ECHO     PPP             AAA       AAA              SSs              SSs
@ECHO     PPP            AA           AA  Ss        SSS   Ss         SSS
@ECHO     PPP           AA             AA  SSSSSSSSSS       SSSSSSSSSS
@ECHO ***********************************************************************
rem  pause
rem exit
goto :END


:ERROR
@echo.
@echo An error has been detected.
color 4f
@echo. 
goto :END


: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=24 tokens=3" %%A in (x:\ParOutput.txt) do (
if /i "%%A"=="no" set Disk=%TempDisk%
)
for /f "skip=26 tokens=4" %%A in (x:\ParOutput.txt) do (
if /i NOT "%%A"=="Winpe" set Disk=%TempDisk%
)
Goto :EOF


:END
@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.
@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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值