View Full Version : Executing a .EXE before installation starts?

06-10-2005, 12:27 PM
Hi there,

I have a little application command-line .exe that I want to run and check the return code of, before the installation gets very far.

Based on the return code, I want to give the user an error box and/or terminate the installation.

In reading the documentation, it seems much more complex to do this than I'd expect...is there something I'm missing? This seems like a common thing to want to do.

Anyone have any tips?


06-10-2005, 12:35 PM
Put it at the beginning of your OnBegin function and use a LaunchAndWait command. Then if you need to use the MessageBox command and then an abort.

06-10-2005, 12:39 PM
Thanks for your reply.

My only question here is - from the documentation, it doesn't look like LaunchAppAndWait() actually returns the return code of the command line application. It just seemed to return whether or not the application was launched - not the exit code of the app.

06-10-2005, 12:41 PM
The nResult field of the LAAW_PARAMETERS structure enables you to capture the application's return code.

06-10-2005, 01:11 PM
Ah, that works well - thanks.

One additional question. I've created a custom action that calls an InstallShield function which runs the EXE and such. Right now I've placed that custom action AfterInstallFinalize, because I need the EXE installed to run it, of course.

How can I get that EXE installed way up front so it's runnable, before the full install takes place?

Also, is it possible to only run this custom action when a particular product is installed?

Thanks again to you all.

06-10-2005, 01:56 PM
If you don't need to install the EXE but just want to run it during installation, perhaps look into the Support Files view and the SUPPORTDIR variable?

06-10-2005, 02:00 PM
Perfect - just what I was looking for. Thanks.

06-10-2005, 02:06 PM
Oh, just one other thing...is there a way to run this custom action just for one particular product?

06-10-2005, 02:52 PM
I'm not sure I follow: are you using the same project for multiple products?

06-10-2005, 03:04 PM
Yes; we have all kinds of configurations that can be installed with this single installer. One of the configurations contains a web server, which can only be installed if this little EXE runs and returns the proper return code. The other configurations don't care about the results of the little EXE.

06-10-2005, 03:17 PM
Perhaps use an if-statement that tests PRODUCT_GUID against a specific value? Or IFX_PRODUCT_NAME? Of course, it depends how you differentiate the products...