MakePE: Creating a Build Script


MakePE comes with several Example Build Script already included.  These are in the root of MakePE.  The image below contains the Example Build Scripts that I will release first.  If you look at some of my other posts on MakePE, they may be named different, so don’t get hung up on what they are called.

2015-10-14_22-42-35

You should create your own Build Scripts because when I make updates on GitHub to MakePE, I will be updating the Example Build Scripts, but you need to know what to do with them, that is where this post will come in.  For starters I am going to detail the solo Example Build Scripts, marked above.

2015-10-14_22-42-35

Each of these Example Build Scripts will build a single WinPE.  Since Windows 10 is the hot thing, let’s look at one of these.

	@echo off
	pushd %~dp0
	
::	Run MakePE.cmd to load the Defaults and MySettings
	call .\Scripts\MakePE.cmd

::	Now you can make changes to the default Variables
	rem set DoPause=No

::	Rebuild BasePE instead of using the BasePE.wim
	rem set RebuildBasePE=Yes

::	Set the WinPE Version and Architecture
	set WinPEVersion=10
	set PLATFORM=x86
	
::	Run MakePE
	call .\Scripts\MakePE.cmd
	
::	You can pause at the end
	pause

Make sure the first few lines, through the MakePE.cmd entry are in every Build Script.  This will set the CMD location, and run MakePE for the first time to read the default settings in your MySettings.cmd

By default, MakePE will pause at milestones so you can see what is going on.  When you are ready to let go of the training wheels, you can either remove the DoPause in MySettings.cmd, or in the Build Scripts.  Just remove the rem when you are ready.

The RebuildBasePE=Yes is set (but commented out) so you can easily add this until you have your BasePE working properly since it only builds it once.  Enable this line if you need it, and leave it off when you are comfortable enough.

Basically anything in MySettings.cmd can be modified in the Build Script, so you can add whatever you want.  Since the MySettings.cmd set a default WinPE Version and Architecture, you should make sure you have these entries in your Build Scripts all the time, and make a separate Build Script for your needs.

Once you have all your Variables set, running MakePE.cmd a second time will actually execute the job.  The pause at the end helps you review things.

At a minimum, you should have the following in a proper Build Script

@echo off
pushd %~dp0
call .\Scripts\MakePE.cmd
set WinPEVersion=10
set PLATFORM=x86
call .\Scripts\MakePE.cmd

Got it?


You can get creative too.  Let’s say you need to make WinPE 10 for x86 and x64.  You can run both the “Example – WinPE 10 x64.cmd” and the “Example – WinPE 10 x86.cmd” individually to get them created, or you can run “Example – ALL WinPE 10.cmd

2015-10-14_22-42-35

Looking at this script you see that the Pause has been turned off by default, and it is configured to run both WinPE 10 x86 and WinPE 10 x64.

	@echo off
	pushd %~dp0
	
::	Run MakePE.cmd to load the Defaults and MySettings
	call .\Scripts\MakePE.cmd

::	Now you can make changes to the default Variables
	set DoPause=No

::	You can change the WinPE Version and Architecture
	set WinPEVersion=10
	set PLATFORM=x86
	call .\Scripts\MakePE.cmd
	
::	And change it again
	set WinPEVersion=10
	set PLATFORM=x64
	call .\Scripts\MakePE.cmd
	
::	You can pause at the end
	pause

Cool huh?  But things get real fun if you run “Example – Everything.cmd“.  As long as you have the required components for each version, it will build them all for you.  Just remember to take a lunch and come back in an hour.

	@echo off
	pushd %~dp0
	
::	Run MakePE.cmd to load the Defaults and MySettings
	call .\Scripts\MakePE.cmd

::	Now you can make changes to the default Variables
	set DoPause=No

::	Rebuild BasePE instead of using the BasePE.wim
	rem set RebuildBasePE=Yes

::	And build a WinPE 3 x86
	set WinPEVersion=3
	set PLATFORM=x86
	call .\Scripts\MakePE.cmd

::	Followed by a WinPE 3 x64
	set WinPEVersion=3
	set PLATFORM=x64
	call .\Scripts\MakePE.cmd
	
::	Jumping next to WinPE 5 x86
	set WinPEVersion=5
	set PLATFORM=x86
	call .\Scripts\MakePE.cmd
	
::	And ending with WinPE 5 x64
	set WinPEVersion=5
	set PLATFORM=x64
	call .\Scripts\MakePE.cmd
	
::	Jumping next to WinPE 10 x86
	set WinPEVersion=10
	set PLATFORM=x86
	call .\Scripts\MakePE.cmd
	
::	And ending with WinPE 10 x64
	set WinPEVersion=10
	set PLATFORM=x64
	call .\Scripts\MakePE.cmd
	
::	You can pause at the end
	pause

So now go and build your own!

Advertisements