Launch an exe from installation files - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Launch an exe from installation files

Hi I have a problem with my project. I want to run an exe file before the files are copied so in custom actions I put the installation file link there but when I run the installation I get an error saying "Cannot find path C:\Program". I archive the files into cabs and use an exe bootstrapper so anyone can help me with this.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

You should use New Attached Custom Action to run the EXE file you wish. You can't run a installed file before it has been copied to its installation path because it doesn't exists yet at that location.

Also, if you are trying to run a installed file, for example if your file name would be MY_FILE.txt, the path should be written like this:

Code: Select all

"[#MY_FILE.txt]"
and not like this:

Code: Select all

[#MY_FILE.txt]
Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

I do run the exe the way you showed with the quotation marks but I need to run it before the sql scripts are run during installation so anyway I can do this?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

To run the EXE file before the scripts are executed follow these steps:
-- go to Custom Actions page
-- right click in the Install Sequence pane → Show Standard Actions → Before Finalization → InstallFiles.
-- right click on InstallFiles→ New Attached Custom Action, with your EXE file.

InstallFiles standard action takes place before the installation of the ODBC drivers used for your database connection, thus ensuring that the EXE file will run before the sql scrips.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

ok I got the exe file attached but my exe requires some dll files to run and these dll are next to the exe in the installation path but when I attach the custom action it says file is attached to installation so I guess my exe won't see the dll files any solution to this?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

You can try adding the DLL files and the EXE as temporary files in the Files and Folders page. This way the package will use them at install time, afterwards the files will be automatically deleted.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

I already install those files so it's not necessary to make them temporary but during the install I get an error saying that a program required for install to complete can not be run

I added my custom action as new installed custom action rather than attached to make the exe see the dll files would that be the cause?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

This error occurs because the file that is required hasn't been installed yet, therefore can't be found at the specified location.

Add your custom action after the InstallExecute standard action (right click in the Install Sequence pane → Show Standard Actions → Before Finalization → InstallExecute ), this should allow you to run the program.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

Well I tried and now the exe is running after the scripts are run which shouldn't happen I need to run exe before the scripts
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

Please use the temporary file version that I explained earlier. Temporary files are files that are not handled by Windows Installer. They are copied at the beginning of the setup process on the CostFinalize standard action and removed at the end of the setup after the InstallFinalize standard action.

This way your EXE will have available all the necessary files from the beginning of the installation. Also move back the custom action on the InstallExecute standard action.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

I am trying that way now but I couldn't make it new installed custom action instead I chose new attached custom action so will the exe be able to see the dll files?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

If the DLL files are not visible when using attached custom action you can try another option:

-- on InstallFiles -> Add Predefined Custom Action -> Launch File or Open URL.
-- assuming that the name of your EXE file is My_File.exe in the Command Line field from the Custom Actions Properties page you should write this:

Code: Select all

"[&My_File.exe]"

-- others settings will be left with their default values

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

OK now I solved the problem with the way you suggested thanks

Now I have another problem I need to run an exe file right between sql scripts and starting of services where should I put the custom action to achieve this?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Launch an exe from installation files

Hi,

You can try after the following standard action: Show Standard Actions → Before Finalization → InstallServices. Here is a small explanation of the standard actions that are running during an installation/uninstallation of a package.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Mert
Posts: 50
Joined: Mon Jun 15, 2009 4:00 pm

Re: Launch an exe from installation files

I already tried that one but my exe runs before the scripts with that action

Return to “Common Problems”