“I told the doctor I broke my leg in two places. He told me to quit going to those places.” - Henny Youngman

Preinstall Program

Have you ever wanted a program that would execute several pieces of code one after another, with a progress bar which indicates the progress of the installation progress? This is useful when you are attempting to create a custom XP CD which installs software after installing Windows. That is exactly what this program does. The original purpose of this program was a Run Once replacment.

How to Use PreInst.exe

So lets say you want to use this program to make a custom XP CD, what would you have to do to get it to work properly. First get an XP CD (or ISO), then download ISOBuster, and nLite and install it. Copy all the files off of the CD to a directory to work in (like C:\XP) If you have an ISO use ISOBuster and extract the files. Then download $OEM$.zip and extract it to C:\XP, so that the folder C:\XP\$OEM$\$$ exists. Then download Preinst.zip and extract it to C:\XP so that the file C:\XP\preinst.ini exists. Then create the folder C:\XP\Programs and place all your install programs in there (silent installer are better). Then edit preinst.ini to reflect the programs you placed in the Programs folder. You need to have two lines of code for each program you want to execute. It will use the first line as an indicator, the second line is the actual command that will be executed. Then use nLite to create the ISO file using the C:\XP as your root directory. Burn the ISO and after installing Windows XP with this CD it will execute your programs after one another with a pretty UI Progress bar.

Hows it Work?

When Windows is being installed it looks for directories like $OEM$ for added files. During the final stages of the install XP will execute cmdlines.txt. It has limited ability to execute code, so instead of installing programs we tell XP to install programs on the first boot. The cmdlines.txt file tells the install to execute install.cmd, install.cmd adds a line to the registry which says to run Preinst.exe on the first boot.

On the first boot RunOnce (from the registry) will execute Preinst.exe (from the System32 directory) What does the Preinst.exe actually do? It will search available disk drive letters for preinst.ini. What this means is if you have preinst.ini on the root of your CD it will use that ini file to execute programs.


Okay that may be hard to understand so use this as a test just to see how the program works. Download Preinst.zip and extract it to C:\. then create the folder C:\Programs and place an exe file in there and rename it dx.exe then run C:\Preinst.exe. it will run dx.exe and wait until the program exits. Doing this may give you an idea of how Preinst.exe works.

More Info on Preinst.exe

This program originally was created by Simply_Simon, I edited it to make it fit my needs a little more and I sent it back to him. He liked it and improved on it, and gave me credit for attempting to make it better. Unfortunatly I no longer have the souce code, and all the downloads are gone. If you are interested in it at all check out this page where it is discussed.


If you just want to try out Preinst.exe then just download Preinst.zip. If you plan on using this program to make customized XP CD then download both. Sorry no source is available just compiled Windows binary.

Download PreInstall Program

Download $OEM$ Tools for an XP CD

Photo Albums

All examples, instructions, tutorials, custom code, and documents created by Brian Hoover on this site are in acordance with the Createive Commons Attribution 3.0 license.

This means you are free to take, and modify any thing on this site, even for commercial use, as long as Brian Hoover is cited as the original creator, and that http://www.brian-hoover.com is the original source.

About Me

Everything on this site is taken as-is, and no support contract or warrantees are in place for obligated continued support. If you have questions about the content on the site feel free to contact the Webmaster.

Creative Commons License
This work by Brian Hoover is licensed under a Creative Commons Attribution 3.0 United States License.
Based on a work at www.brian-hoover.com.