# CustomePE Media Builder

## Download

* Download: [Archive.org](https://archive.org/download/custompe-media-builder/CustomPE_Media_Builder.zip) / [Mega.nz](https://mega.nz/file/w20gEDJD#SuNInM4jXysjBGK7Tc3Sr97kcXjnl_J_9zHknHkL49o) - Version 1.00 - 13th September 2023

## Guide

No guide currently exists for this tool however a few notes are posted below, those familiar with [Windows Media Builder](https://windows-rt-devices.gitbook.io/windows/tools/windows-media-builder) shouldn't have any issues using it. This was created to assist the developers of Android and Linux for Windows RT devices in investigating the possibility of deploying Android or Linux eMMC images from a Windows Preinstallation Environment however it may also be useful for Windows projects.

<div><figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/uAAIoace3ns6OGVF1L1b/CustomPE_Menu.PNG" alt=""><figcaption><p>CustomPE Media Builder Main Menu</p></figcaption></figure> <figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/35tNorBuOIGFln7BAdjH/CustomPE_Settings.PNG" alt=""><figcaption><p>CustomPE Media Builder Settings</p></figcaption></figure></div>

### All-in-one Output

As well as single device output the CustomPE Media Builder can also create an All-in-one output which will create a WIM with an index for each device, the bootable index can be selected by running `Boot_Device_Selection.cmd` before booting the USB on the target device. Devices which are included in the All-in-one output can be modified from the settings menu.

<div><figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/3KaEqjAaTFbE44JBAn6M/Capture_BootScript1.PNG" alt=""><figcaption><p>CustomPE Media Builder Output</p></figcaption></figure> <figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/Fd6xv8fMAiInrxaObQQB/Capture_BootScript2.PNG" alt=""><figcaption><p>CustomPE Media Builder Boot Device Selection Script.</p></figcaption></figure></div>

### Start-up Script(s)

For single device output using the default settings the commands contained in `\CustomPE\CustomPE.cmd` will be executed, by default this just launches the command prompt however this script can be modified to suit a users requirements.

In the example below the drive letter and path assigned is `X:\CustomPE`  however this may vary so it is best to avoid hardcoding a path, for example if the script needs to launch `X:\CustomPE\Example.exe` it should be launched using `%CD%\Example.exe` in the script.

<figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/7ocFqXnA8XUPBntKdMDA/CustomPE_StartupScript1.PNG" alt=""><figcaption><p>CustomPE Media Builder Start-up Script (Running in QEMU)</p></figcaption></figure>

Each device can also have its own specific script by enabling "Include Separate Device Scripts" in settings, this could be useful when combined with with All-in-one output option.

The appropriate device script is launched automatically for single device output and where All-in-one output is used the script executed corresponds to the selection made in the [All-in-one output](#all-in-one-output) `Boot_Device_Selection.cmd` script.

In this example, when "Include Separate Device Scripts" is enabled the `\CustomPE\CustomPE.cmd` script launches the `\CustomPE\Device_Surface2\Surface2.cmd` script if Microsoft Surface 2 was was selected as the current bootable index.

<div><figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/zLp5jMcPmIbXGMZ8f59C/CustomPE_StartupScriptFiles1.PNG" alt=""><figcaption><p>Default Output</p></figcaption></figure> <figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/wFOi3jaYBzzT1OcooTAJ/CustomPE_StartupScriptFiles2.PNG" alt=""><figcaption><p>Single device output with "Include Separate Device Scripts" Enabled</p></figcaption></figure> <figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/01T8tIMsGrzwpCxYAAqh/CustomPE_StartupScriptFiles3.PNG" alt=""><figcaption><p>All-in-one output with "Include Separate Device Scripts" Enabled</p></figcaption></figure> <figure><img src="https://content.gitbook.com/content/g0WEvpZgMwlYVwyBqPep/blobs/D2wdBzk48suV5qONpO14/CustomPE_StartupScriptFiles4.PNG" alt=""><figcaption><p>Surface 2 Device Script</p></figcaption></figure></div>

## Credits

* 7-Zip - Copyright (C) 1999-2019, Igor Pavlov.
* GNU Wget - Copyright (C) 1996-2008, Free Software Foundation, Inc.
* QEMU - Copyright (C) 2003-2021 Fabrice Bellard and the QEMU Project developers. (Thanks to @x86corez & @driver1998)
* SetACL - Copyright (C) 2012, Helge Klein.
* Media Builder & Guide - @jwa4.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://windows-rt-devices.gitbook.io/windows/tools/customepe-media-builder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
