How to add a custom script to WinPE

Source: Internet
Author: User
Tags commit ini

The WinPE system provides three ways to start custom scripts: Winpeshl.ini, Startnet.cmd, and Unattend.xml. The default interface for WinPE is the command Prompt window. However, you can create a custom Winpeshl.ini file to run your own shell application. You can also create your own Startnet.cmd batch file to run a specific set of commands, batch files, or scripts. Unattend.xml is the new answer file format for WinPE 2.0, which replaces the Winbom.ini and Winpeoem.sif.

Before you can add any custom scripts, you must first use ImageX to apply or mount a basic WinPE image (Winpe.wim).

1. Using Winpeshl.ini to add custom scripts, you can use a file named Winpeshl.ini to launch a custom shell application. Winpeshl.exe will process the settings in Winpeshl.ini during startup. Use a text editor, such as Notepad, to create a Winpeshl.ini text file with the following structure. For example:

[Launchapp]

AppPath =%systemdrive%myshell.exe

[Launchapps]

%systemdrive%mydirapplication1.exe,-option1-option2

Application2.exe,-option1-option2

Note: Set the AppPath key as the path to the shell application. This path can be a fully qualified path, or you can use environment variables, such as%systemroot%system32myshell.exe. The AppPath item does not support command-line options. Save this file to the%systemroot%system32 of the WinPE image.

2. Use Startnet.cmd to add custom scripts and use Startnet.cmd to add custom command-line scripts in WinPE. By default, WinPE includes the Startnet.cmd script, which is located in the%systemroot%system32 of the WinPE image. Currently, Startnet.cmd starts Wpeinit.exe. The Wpeinit.exe is used to install Plug and Play (PNP) devices, handle Unattend.xml settings, and load network resources. Edit the Startnet.cmd to include the custom commands.

Note: For PNP and network support, make sure that you include a call to Wpeinit in your custom Startnet.cmd script.

3. Run Imagex/info d:boot.wim To view information about the WinPE image. We should pay attention to this line:

Image Count:2

Description This WinPE image file contains two images in fact. Detailed information about each image is shown later in detail. Specifically, what we need to edit here is the second image called WDS, because WDS uses this image to boot the computer.

Use the ImageX command plus parameter mountrw to load *.wim into the Pemount directory first:

IMAGEX/MOUNTRW C:winpe2pe2.wim 2 C:pemount

Use the peimg command to add third-party drivers to WinPE 2.0, and repeat this step if you need to add multiple device drivers.

Peimg/inf=c:winpe2netdrvxxx.inf c:pemountwindows

Use the ImageX command to add parameters unmount and commit to write the modifications to *.wim

Imagex/unmount C:pemount/commit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.