Include a Custom Script in a Windows PE Image (Standard 7 SP1)

7/8/2014

You can add a custom script to an offline image of Windows Preinstallation Environment (Windows PE) 3.0. You can also launch custom scripts by using Winpeshl.ini, Startnet.cmd, or Autounattend.xml.

The Windows PE default interface is a command-prompt window. 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.

To add a custom script by using Winpeshl.ini

  1. Create a custom Windows PE image by following the steps in Create a Custom Windows PE Image.

  2. Mount the Windows PE image by using the ImageX tool.

    For information about ImageX, see ImageX Technical Reference.

  3. Use a text editor to create a text file named Winpeshl.ini with the structure shown in the following example, where AppPath is the path to your shell application:

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

    The path to the shell application can be fully qualified or use environment variables; for example, %SYSTEMROOT%\System32\Myshell.exe. The AppPath entry does not support command-line options.

    If you create a custom Winpeshl.ini and require plug and play or network support, include a call to Wpeinit.exe. Wpeinit.exe specifically installs plug and play devices, processes Autounattend.xml settings, and loads network resources.

  4. Save the Winpeshl.ini file to %SYSTEMROOT%\System32 in the custom Windows PE image.

  5. Commit the changes to the Windows PE image by following the steps in Create a Custom Windows PE Image.

To add a custom script by using Startnet.cmd

  1. Create a custom Windows PE image by following the steps in Create a Custom Windows PE Image.

  2. Mount the Windows PE image by using the ImageX tool.

    For information about ImageX, see ImageX Technical Reference.

  3. Edit Startnet.cmd to include your customized commands.

    By default, Windows PE includes a Startnet.cmd script at %SYSTEMROOT%\System32 of in your custom Windows PE image.

    To support plug and play or networking, include a call to Wpeinit.exe. Wpeinit.exe specifically installs plug and play devices, processes Autounattend.xml settings, and loads network resources.

    The default version of Startnet.cmd starts Wpeinit.exe.

  4. Commit the changes to the Windows PE image by following the steps in Create a Custom Windows PE Image.

To add customizations by using Autounattend.xml

  • Specify settings and actions in an Autounattend.xml answer file.

    On startup, Windows PE searches for Autounattend.xml at the root of any bootable device. You can also specify an Autounattend.xml file by using Startnet.cmd and Wpeinit.exe.

    For information about creating an Autounattend.xml answer file, see Build an Answer File Using Image Configuration Editor.

See Also

Concepts

Wpeinit Command-Line Options