How to modify a script for WinPE

Source: Internet
Author: User
Tags commit ini

You can add your own scripts to the PE system by modifying one of the Startnet.cmd, Unattend.xml, and Winpeshl.ini files. We can create our own custom Winpeshl.ini files so that we can run our own applications. Now follow the actual combat.

Before adding any custom scripts to PE, you must first load the basic WinPE mirror (Winpe.wim) with the ImageX tool.

First, add custom scripts using Startnet.cmd, and use Startnet.cmd to add custom command-line scripts to 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. Wpeinit.exe is used to install Plug and Play (PnP) devices, process Unattend.xml settings, and load network resources. Edit Startnet.cmd to include custom commands.

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

Second, run Imagex/info d:boot.wim to view the WinPE image information. We should pay attention to this line:

Image Count:2

Description This WinPE image file contains two images in fact. The details of each image are shown in detail later. The special point here is that we need to edit a second image called WDS because WDS uses this image to boot the computer.

MOUNTRW the *.wim into the Pemount directory by using the ImageX command plus the parameters:

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

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

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

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

Imagex/unmount C:pemount/commit

Third, use Winpeshl.ini to add your own script, you can use a file named Winpeshl.ini to start a custom application. Winpeshl.exe will process the statements in Winpeshl.ini during startup. Use a text editor, such as Notepad, to write 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: Writes the AppPath entry to the application's path. This path can be an absolute path, or you can use an environment variable, such as%systemroot%system32myshell.exe. command line options are not supported for apppath items. Save this file to the%systemroot%system32 of the WinPE image.

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.