Windows Installer InstallAware for Windows Installer Header Image Windows Installer without Rocket Science

  InstallAware Blog

   

How to run a third party EXE using InstallAware

In my last post, we covered using InstallAware to install or un-install a third party MSI package. In this post we’ll cover a related task, running a third party EXE setup package, using the Run Program As command.

What does Run Program As do? As the name suggests, it runs a program (an EXE file) or pretty much any other kind of document/file that is recognized by the system and has a registered viewer/editor. The Run Program As command is very similar to the Run Program command – it has a few extra bells and whistles, so we’ll cover that one instead of the simpler Run Program command here. But remember that you are free to use either one that suits your needs…


As we did for the MSI setup, we’re going to place our Run Program As command just before the Apply Install command. Before moving further, also find out what command line parameters your EXE setup takes. Most EXE setups have fairly standard switches, such as “/s” or “/q” to indicate (without the quotes, of course) a silent installation. Other optional command line switches may also be available/necessary. Since this is different for each EXE setup, you’ll have to research this one on your own. Try running the setup file with a “/?” or a “/h” command line switch and see if it provides documentation on its proper usage. It’s also always a good idea to check the website of either the software vendor or the maker of the setup authoring toolkit, as one of the two is very likely to have their command line switches documented somewhere.

Let’s assume that the EXE setup we’re running today takes a parameter named “/install” to indicate an installation and uses “/uninstall” to indicate removal. So configure the Run Program As command window as in the screenshot below. If you want to run the EXE setup silently – probably a good idea – also add its silent installation parameter to the command line. I’ll also to catch the result of execution inside a variable called “RUN_ERROR“. If you haven’t defined this variable before, Run Program As will automatically define it for you. Of course, you’ll again need to check with your vendor documentation to find out what the return values for this EXE setup program are. Most EXE based setups return 0 to indicate success and 3010 to request a reboot (notably, Microsoft’s EXE setups). Your own experience may vary, based on the kinds of EXE files you’re trying this out with.

You probably want InstallAware to wait for your EXE setup to finish installing before moving on to the main installation. Running two setups on the target system simultaneously may not be that great of an idea after all :) Check the “Wait for Program to Finish” check-box to enable this option. Also note that unless you wait, the RUN_ERROR variable will not hold the actual value returned by your EXE setup, and it will only be useful in determining if the EXE setup was actually successfully launched.

As for the uninstall, the process is very similar. We again call Run Program As, but this time with the “/uninstall” parameter. Place the command right before Apply Uninstall to make sure it’s being run at the right time in our MSIcode script, which in this case becomes right before the un-installation of our own product.

And yet again, I use the RUN_ERROR variable to catch any errors. A simple If command can later test the value of RUN_ERROR for me and determine if everything is kosher.

Well, that’s about it for running programs! While we’re at it though, another useful bit of information: You may also use Run Program As to execute your own main program file after your own setup finishes installing. By default, all InstallAware themes have a “Run Program Now” kind of checkbox in the setup finished wizard step, but even if your end-user checks it, that won’t do anything unless you let InstallAware know what to run here:

Replace the “Comment: TO-DO: Insert command that starts your application here” line with your own Run Program As command, specifying a target path like “$TARGETDIR$\yourexenamehere.exe“. Please note that most .NET applications today DO NEED their working directory field set to “$TARGETDIR$“, otherwise they will silently exit or raise strange startup errors. A well-authored application should never make assumptions about its startup folder, but some of us still do ;)

The Run Program command, by the way, automatically sets the startup folder to the same folder as the program being run – so no need to manually enter a directory in there, if you used that command instead.

And for that matter, the Run Programs visual designer in the InstallAware IDE lets you do everything we did above graphically – even choosing the scheduling of the program being run:
a) Before Install
b) After Install
c) Before Uninstall
d) After Uninstall
e) Finish Dialog

 
Completely visually. But hey – it was fun to learn how to do it in script too, wasn’t it ;) And if I had told you that at the beginning, you might not have read this far ;) At least now you know what MSIcode script the Run Programs visual designer emits in the background for you :)

Well have a great month and talk to you soon!

Panagiotis Kefalidis
Software Design Team Lead
InstallAware Software Corporation

17 Responses to “How to run a third party EXE using InstallAware”

  1. Lex Y. Li Says:

    Panagiotis, as a user of InstallAware Studio, I have a question to ask. What about uninstalling a NSIS powered installer? I found it hard because after locating the uninstaller from registry and “Run Program” with it, “Run Program” returns immediately before any other uninstallation operations because NSIS uninstaller is just a wrapper. It is an annoying issue with NSIS installer but one of my project runtime is powered by NSIS which is out of my control. So do your InstallAware guys know any workaround?

  2. Panagiotis Says:

    Doesn’t NSIS support /q or /quiet or a flag like that for silent uninstallation? I’m not quite familiar with NSIS technology.

  3. Panagiotis Says:

    You can upgrade to Studio Admin though and use PackageAware to capture the process of NSIS and create an InstallAware package, exactly the same as NSIS. This project can be then fully customized as it’s a native InstallAware .mpr file. You can edit whatever you want through the IDE.

  4. Lex Y. Li Says:

    Thanks for your tip, Panagiotis. However, now I get rid of that NSIS installer because it is no longer needed.

  5. Isporuka Cveca Says:

    Amazing goods from you, man. I’ve comprehend your stuff previous to and you are just too great. I truly like what you’ve acquired here, surely like what that you are saying and the way in which you say it. You make it entertaining and you nonetheless care for to maintain it wise. I can’t wait to read far much more from you. This is really a terrific web site.

  6. verification of email address Says:

    That is very attention-grabbing, You’re an overly professional
    blogger. I have joined your feed and sit up for looking for extra
    of your wonderful post. Additionally, I have shared your website in my social
    networks

  7. Cheap Private Proxies Says:

    DreamProxies.com – lowest priced elite private proxies with 50% low cost! Elite quality, Unlimited proxies, Very speed along with Least expensive price ranges – just $0.25 every proxy! Best personal proxies only on DreamProxies.com

  8. USA Private Proxies Says:

    DreamProxies.com — cheapest high level private proxies with 50% discounted! Top-notch quality, Unlimited proxies, Very speed and also Least expensive prices – only $0.25 per proxy! Finest individual proxies only from DreamProxies.com

  9. USA Elite Proxies Says:

    DreamProxies.com — least expensive top-notch private proxies with 50% lower price! High level quality, Limitless proxies, Very speed and Cheapest charges – only $0.25 every proxy! Greatest non-public proxies simply from DreamProxies.com

  10. USA Private Proxies Says:

    DreamProxies.com — least expensive high level private proxies with 50% price cut! Top-notch quality, Limitless proxies, Very speed and also Cheapest price ranges : just $0.25 each proxy! Ideal personal proxies only from DreamProxies.com

  11. DreamProxies.com Says:

    DreamProxies.com : least expensive high level private proxies with 50% discount! Top notch quality, Unrestricted proxies, Super speed as well as Cheapest rates : simply $0.25 per proxy! Best personal proxies only from DreamProxies.com

  12. DreamProxies.com Says:

    DreamProxies.com : most affordable professional private proxies with 50% discounted! Top notch quality, Unlimited proxies, Excellent speed and Least expensive prices — simply $0.25 per proxy! Best non-public proxies only on DreamProxies.com

  13. half x oakley Says:

    View Content articles Video clips By CategoryCareers WorkComputersCulture SocietyFood DrinkHobbies, Games ToysHome GardenLegalParties EntertainingPetsSports FitnessHi, i am Donald using Skilled Community and I’m planning to teach you how you can alter spectacles. Today we’ll talk about the particular realignment associated with sun shades. Any time planning to alter your own sun shades you have to see whether it’s actually a metal framework or possibly a plastic-type framework. The particular adjustments of many support frames are similar, the particular adjustments can be made at the temples or wats, the particular bridge, the particular nostril sleeping pad on the metal, nonetheless on the plastic-type framework there is absolutely no nostril sleeping pad, there aren’t any nostril parts to get altered. If the spectacles, in case your sun shades can be a total metal framework selection they can be altered consequently using the very same options for adjusting the full metal framework. If the sun shades are of the particular plastic-type selection they can be altered using the very same techniques like a total plastic-type framework. Which is the method that you make the adjustments upon sun shades.

  14. do my assignment Says:

    If you do that, chances are you won’t experience information overload.
    Any time a blog is added it is vital to develop a plan for producing content on a regular basis.
    In a toddy bar, or in a ‘thattukkada (small eat out joint),’ men with bare chests can be heard debating communism and politics over a steaming up of milky tea and ‘puttu and kadala’
    curry.

  15. Super Freak Says:

    great post

  16. USA Private Proxies Says:

    DreamProxies.com — lowest priced elite private proxies with 50% lower price! Top notch quality, Limitless proxies, Super speed as well as Least expensive price ranges — only $0.25 each proxy! Greatest private proxies only by DreamProxies.com

  17. Buy Proxies Says:

    DreamProxies.com : cheapest top-notch private proxies with 50% price cut! Top notch quality, Unrestricted proxies, Super speed and also Least expensive prices : simply $0.25 every proxy! Very best exclusive proxies only by DreamProxies.com

Leave a Reply