最新消息

[公告2014/05/30] 如有需要將部落格中,任何一篇文章的程式碼使用在商業用途,請與我聯繫。

[公告2015/04/26] Line版的 iInfo程式與投資應用 群組已上線想加入的朋友們,請先查看 "入群須知" 再與我聯繫 Line : aminwhite5168,加入請告知身分與回答 "入群須知" 的問題。

[公告2018/04/22] 台北 Python + Excel VBA 金融資訊爬蟲課程,課程如網頁內容 金融資訊爬蟲班:台北班 Python 金融資訊爬蟲、EXCEL VBA 金融資訊爬蟲

[公告2019/01/08] 請注意:我再次重申,部落格文章的程式碼,是要提供各位參考與學習,一旦網頁改版請自行修改,別要求東要求西要我主動修改,你們用我寫東西賺錢了、交差了,請問有分我一杯羹嗎?既然賺錢沒分我,請問有什麼理由要求我修改,如果沒能力改,就花錢來找我上課。

[公告2019/12/01] 若各位有 Excel VBA 案子開發需求,歡迎與我聯繫,可接案處理。

[公告2020/05/22] 頁面載入速度慢,起因為部分JS來源(alexgorbatchev.com)失效導致頁面載入變慢,目前已做調整,請多見諒。

2013年5月25日 星期六

Winpe 4.0 製作

先到官網下載製作winpe4.0的ADK套件  Windows® 8 的 Windows 評定及部署套件 並安裝,將以下的batch指令另存成bat執行,即可得到一個Winpe 4.0
@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下載與安裝

沒有留言:

張貼留言