@echo off cls echo Start make winpe 4.0 echo. if "%1"=="" ( echo Usage : Make_Winpe Architecture echo Architecture : x86 or amd64 or ia64 goto Exit ) echo ==================================== echo 設定環境變數 echo ==================================== REM ProgramFiles需確認ADK安裝路徑 set Arch=%1 set Winpe_Fodler_Path=C:\winpe_%Arch% set DISMfolder="%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\%PROCESSOR_ARCHITECTURE%\DISM" set copypefolder="%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment" set winpepackagespath="%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\%Arch%\WinPE_OCs" set Path=%Path%;%DISMfolder%;%copypefolder% set Currentfolder=%CD% REM Main path set WinPERoot=%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment set OSCDImgRoot=%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\%PROCESSOR_ARCHITECTURE%\Oscdimg echo. if not exist "%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\copype.cmd" echo No install Windows ADK if not exist "%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\copype.cmd" goto Exit echo Setting environment variables OK...... echo. echo ==================================== echo 確認系統沒有之前winpe的資料夾,若有則刪除,Boot.wim複製到winpe4.0檔案夾 echo ==================================== if exist %Winpe_Fodler_Path% rd /s /q %Winpe_Fodler_Path% call copype %Arch% %Winpe_Fodler_Path% if not "%errorlevel%"=="0" echo Copy Boot.wim fail. if not "%errorlevel%"=="0" goto Exit echo. echo=========================== echo 解開Boot.wim echo=========================== dism /mount-wim /wimfile:%Winpe_Fodler_Path%\media\sources\boot.wim /index:1 /mountdir:%Winpe_Fodler_Path%\mount if not "%errorlevel%"=="0" echo Mount Boot.wim fail. if not "%errorlevel%"=="0" goto Exit echo. echo ==================================== echo 安裝常用套件 echo ==================================== dism /image:%Winpe_Fodler_Path%\mount /add-package /packagepath:%winpepackagespath%\winpe-wmi.cab if not "%errorlevel%"=="0" echo Add packages "winpe-wmi.cab" fail. if not "%errorlevel%"=="0" goto Unmount dism /image:%Winpe_Fodler_Path%\mount /add-package /packagepath:%winpepackagespath%\en-us\winpe-wmi_en-us.cab if not "%errorlevel%"=="0" echo Add packages "winpe-wmi_en-us.cab" fail. if not "%errorlevel%"=="0" goto Unmount echo. echo ==================================== echo 顯示已安裝套件資訊 echo ==================================== dism /image:%Winpe_Fodler_Path%\mount /Get-Packages if not "%errorlevel%"=="0" echo Get package information fail. if not "%errorlevel%"=="0" goto Unmount echo. REM echo ==================================== REM echo 加入Driver,有需要的可在此添加 REM echo ==================================== echo. echo ==================================== echo 顯示RAM預設設定 echo ==================================== Dism /image:%Winpe_Fodler_Path%\mount /Get-pesettings if not "%errorlevel%"=="0" echo Get Ram information fail. if not "%errorlevel%"=="0" goto Unmount echo. echo ==================================== echo 調整RAM大小至512MB以加速開機,可修改大小有32、64、128、256、512MB echo ==================================== Dism /image:%Winpe_Fodler_Path%\mount /Set-ScratchSpace:512 if not "%errorlevel%"=="0" echo Setting Ram fail. if not "%errorlevel%"=="0" goto Unmount echo. :Unmount echo ==================================== echo 將修改內容進行壓縮存回 Boot.wim echo ==================================== dism /unmount-wim /mountdir:%Winpe_Fodler_Path%\mount /commit if not "%errorlevel%"=="0" echo Unmount Boot.wim fail. if not "%errorlevel%"=="0" goto Exit echo. echo ==================================== echo 將Winpe 4.0 folder %Winpe_Fodler_Path%\media 做成可用CD開機的ISO檔 echo ==================================== xcopy "%ProgramFiles%\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\%PROCESSOR_ARCHITECTURE%\Oscdimg\*.*" %Winpe_Fodler_Path%\tool\ /s /e cd %Winpe_Fodler_Path%\tool oscdimg -n -bc:etfsboot.com %Winpe_Fodler_Path%\media %Winpe_Fodler_Path%\winpe_x86.iso :Exit cd .. cd "%Currentfolder%"Winpe 4.0 x86畫面
PS:在114~116行中可將做好的Winpe 4.0做成可CD/DVD開機的ISO檔,可用VMware Workstation開啟做好的Image,關於VMware Workstation安裝使用可參考VMware Workstation 9.0下載與安裝。
沒有留言:
張貼留言