fd1
Posts: 21
Joined: Fri Sep 02, 2005 8:12 pm

batch file as attached custom action

Hi,
Can I use a batch file to run as an attached Custom Action?
If so, how do I do this?
I've been trying to setup a batch file to run as an attached custom action during the Begin stage but it's not working.
In the Command Line field, I only added a parameter as a property and left the Execution Condition field empty.
dorel
Posts: 25
Joined: Mon Oct 18, 2004 8:13 am

Hi,
Atached custom actions can have as source an EXE, a DLL, or a VBScript or a JavaScript. No BAT. You can run a bat file as an installed custam action (the bat file is a file installed by your package). For this select "Add Predefined Custom Action"->"Lanuch File or Open URL" from the context menu and edit the command line of this custom action to be a formatted string that expands in the full path of the bat file (Edit buton->Insert Reference to File).

Regards
Dorel Pislan
Advanced Installer Team
http://www.advancedinstaller.com
fd1
Posts: 21
Joined: Fri Sep 02, 2005 8:12 pm

Thanks Dorel, but the bat file I need to run is not part of the installed package and has to be run before installation that's why I need a way to run it as attached script.
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

The custom action will be executed before the installation, even if it is of installed type.

You can schedule another custom action to delete this BAT file at the end of the installation, but this won't solve the problem completely, as the file will reappear in the case of a repair process.

The last solution, if you want to run this BAT as an attached custom action you could use a workaround. You can create an EXE that generates this BAT file in a temporary folder on the disk and then launches it. After the BAT execution is over the program deletes it from this temporary location.

All the best,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
fd1
Posts: 21
Joined: Fri Sep 02, 2005 8:12 pm

Thank you Mike, but my question is how will this installed custom action script be executed in a pre-installation stage before it even gets installed?
I tried running it as installed type but it wasn't working and I assumed that the reason for it is that the installer cannot find the bat file. Is my assumption correct?
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

You are right, if an installed custom action is conditioned to run in the install phase then it will not run if scheduled before the "InstallFiles" standard action.

Similarly, if it is conditioned to run on the uninstall phase, it will not run if scheduled after the "Uninstall" standard action.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”