The following procedure demonstrates how to add a customized script to an offline Windows® PE image. Windows PE provides three methods for launching custom scripts: Winpeshl.ini, Startnet.cmd, and Autounattend.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. Autounattend.xml is the new answer file format introduced in Windows PE 2.0, which replaced Winbom.ini and Winpeoem.sif for Windows XP.

Before you can add customized scripts, you must first apply or mount the base Windows PE image by using the ImageX tool.

Add a Customized Script Using 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 Wpeinit.exe. Wpeinit.exe specifically installs Plug and Play devices, processes Autounattend.xml settings, and loads network resources.

  1. Create a customized Windows PE image as shown in Walkthrough: Create a Custom Windows PE Image

  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 Using 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 Autounattend.xml settings, and loads network resources.

Important:

If winpeshl.ini is present in %windir%\System32 folder, the startnet.cmd script is ignored.

  1. Create a customized Windows PE image as described in Walkthrough: Create a Custom Windows PE Image.

  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.

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

Add Customizations Using Autounattend.xml

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

To learn more about creating an answer file, see Work with Answer Files.

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

See Also