次の方法で共有


Include a Custom Script in a Windows PE Image

The following procedure demonstrates how to add a customized script to a Windows PE image offline. Windows PE provides three methods for launching custom scripts: Winpeshl.ini, Startnet.cmd, and Unattend.xml. The Windows PE default interface is a Command Prompt window. However, you can create a customized Winpeshl.ini file to run your own shell application. You can also create your own version of Startnet.cmd to run a specific set of commands, batch files, or scripts. Unattend.xml is a new answer file format for Windows PE 2.0, which replaces Winbom.ini and Winpeoem.sif.

Before you can add any customized scripts, you must first apply or mount the base Windows PE image (Winpe.wim) by using ImageX.

Add a Customized Script with Winpeshl.ini

You can launch a customized shell application by using a file called Winpeshl.ini. Winpeshl.exe will process the settings in Winpeshl.ini during boot. If you create a customized Winpeshl.ini and require Plug and Play or network support, you must include a call to Wipeinit.exe. Wpeinit.exe specifically installs Plug and Play devices, processes Unattend.xml settings, and loads network resources.

  1. Create a customized Windows PE image as shown in Walkthrough: Create a Custom Windows PE Image. During Step 4 of that process ("Add additional customizations"), use the following steps.

  2. Create a text file called Winpeshl.ini by using a text editor (such as Notepad) with the following structure. For example,

    [LaunchApp]
    AppPath = %SYSTEMDRIVE%\myshell.exe
    [LaunchApps]
    %SYSTEMDRIVE%\mydir\application1.exe, -option1 -option2
    application2.exe, -option1 -option2
    

    Set the AppPath entry to the path to your shell application. The path can either be fully qualified or use environment variables, such as %SYSTEMROOT%\System32\Myshell.exe. The AppPath entry does not support command-line options.

  3. Save the file to %SYSTEMROOT%\System32 of your customized Windows PE image.

  4. Recapture your Windows PE image as described in Walkthrough: Create a Custom Windows PE Image.

Add a Customized Script with Startnet.cmd

You can add customized command-line scripts in Windows PE by using Startnet.cmd. By default, Windows PE includes a Startnet.cmd script located at %SYSTEMROOT%\System32 of your customized Windows PE image. Startnet.cmd currently starts Wpeinit.exe. Wpeinit.exe specifically installs Plug and Play devices, processes Unattend.xml settings, and loads network resources.

  1. Create a customized Windows PE image as described in Walkthrough: Create a Custom Windows PE Image. During Step 4 of that process ("Add additional customizations"), use the following steps.
  2. Edit Startnet.cmd to include your customized commands.

Note

For Plug and Play or networking support, ensure that you include a call to wpeinit in your customized Startnet.cmd script.

  1. Save your changes and recapture your Windows PE image as described in Walkthrough: Create a Custom Windows PE Image.

Add Customizations with Unattend.xml

You can use an answer file with Windows PE to specify various settings and actions. When Windows PE starts, it implicitly looks for a file called Unattend.xml at the root of any bootable device (for example, a USB flash drive or a floppy disk). You can also specify an Unattend.xml file by using Startnet.cmd and Wpeinit.exe.

To learn more about creating an answer file, see Building an Answer File.

To learn more about Wpeinit, see Wpeinit Command-Line Options and the previous section on using Startnet.cmd.

See Also

Concepts

Winpeshl.ini Files