iexpress command line example to create EXE packages

Danny picture Danny · Mar 8, 2014 · Viewed 19.4k times · Source

I need help with Example for Use iexpress command line to create EXE package. I have a folder With multiple files and folders inside, and I want to create a single EXE file from this folder. Is it possible to help me with an example of how to create a command line for such a thing.

Answer

Valdimar picture Valdimar · Nov 7, 2014

IExpress.exe uses SED files, which are really just text files that describe the parameters used when building the package. To build a self-extracting installer on the command line, you just run IEXPRESS with the SED file as an argument:

iexpress /N Your_SED_Script.sed

The /N is to invoke unattended package building. Without it, the IExpress GUI wizard will simply pop up.

You can generate SED files by going through the IExpress wizard, or you can try to generate them automatically with some of your own code.

Let's look at the structure of an SED script to get you started.

Below is an example of an SED file I generated by going through the IExpress.exe GUI wizard once. Most of these options aren't critical, but in the lower half you'll see TargetName, which specifies the filename of the resulting self-extracting package. FILE0, FILE1, FILE2 specify files in the package. [SourceFiles] begins the section that describes where IExpress should look for the files.

Source File Part

FILE0="TestProgram.exe"
FILE1="TestData.dat"
FILE2="TestLibrary.lib"
[SourceFiles]
SourceFiles0=C:\Users\user\Documents\Visual Studio 2010\Projects\TestProject\Debug\
SourceFiles1=C:\Users\user\Documents\Visual Studio 2010\Projects\TestProject\Debug\lib\
[SourceFiles0]
%FILE0%=
%FILE1%=
[SourceFiles1]
%FILE2%=

Here we have two different locations, defined as SourceFiles0 and SourceFiles1. They each get their own sub-section, [SourceFiles0] and [SourceFiles1], below which are references to each of the files in those locations.

[Strings]
. 
. 
. 
AppLaunched=TestProgram.exe

The AppLaunched parameter in the [Strings] section sets the file to run after extraction. Below it just contains the executable TestProgram.exe, but you can set batch files (*.bat) to run after extraction. If Applaunched is empty, the package will just extract the files.

There are a few resources available online, but I'll admit it was pretty hard to find any information about how to build self-extracting packages as opposed to just opening them. The Wikipedia entry is a good starting point.

Wikipedia - IExpress

SED Overview

Full SED Script

[Version]
Class=IEXPRESS
SEDVersion=3
[Options]
PackagePurpose=InstallApp
ShowInstallProgramWindow=0
HideExtractAnimation=1
UseLongFileName=1
InsideCompressed=0
CAB_FixedSize=0
CAB_ResvCodeSigning=0
RebootMode=I
InstallPrompt=%InstallPrompt%
DisplayLicense=%DisplayLicense%
FinishMessage=%FinishMessage%
TargetName=%TargetName%
FriendlyName=%FriendlyName%
AppLaunched=%AppLaunched%
PostInstallCmd=%PostInstallCmd%
AdminQuietInstCmd=%AdminQuietInstCmd%
UserQuietInstCmd=%UserQuietInstCmd%
SourceFiles=SourceFiles
[Strings]
InstallPrompt=
DisplayLicense=
FinishMessage=
TargetName=C:\Users\user\Documents\TestSED.exe
FriendlyName=All your SEDs are belong to us
AppLaunched=TestProgram.exe
PostInstallCmd=<None>
AdminQuietInstCmd=
UserQuietInstCmd=
FILE0="TestProgram.exe"
FILE1="TestData.dat"
FILE2="TestLibrary.lib"
[SourceFiles]
SourceFiles0=C:\Users\user\Documents\Visual Studio 2010\Projects\TestProject\Debug\
SourceFiles1=C:\Users\user\Documents\Visual Studio 2010\Projects\TestProject\Debug\lib\
[SourceFiles0]
%FILE0%=
%FILE1%=
[SourceFiles1]
%FILE2%=