- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Custom Action with batch file Early in the Installation Process
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Custom Action with batch file Early in the Installation Process
I am using a Basic MSI project. In one of the dialog, the user inputs an IP address as binding server IP to one of our application. At this step, we would like to find out if this IP with port 80 is already used by another application. We wrote a simple batch file to validate the user input and return 1 or 0. Based on the return value, dialog proceeds to next step or shows an error, so that the user can give a different IP address.
In order to validate the user input in the dialog, we are trying to call a custom action which in turn is trying to call the batch file. As this custom action is executed in the dialog process, this method doesn't work as the batch file is not yet installed into the INSTALLDIR. Then I tried to put the batch file into a binary table, but it looks like it is not possible to put batch file in the binary table.
Any other idea of how this could be done?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @dinesh_ravin ,
See whether you can achieve it by executing the custom action batch file from the SUPPORTDIR, and you can add the file to SUPPORTDIR through the supports view:
https://helpnet.flexerasoftware.com/installshield23helplib/helplibrary/SetupFilesView.htm?
https://helpnet.flexerasoftware.com/installshield22helplib/helplibrary/SetupFiles.htm
cmd.exe /c "[SUPPORTDIR]BatchFile.bat"
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
It definitely can be done by adding the bat file as a 'Language Independent' Support file.
Then in your CA add something like this:
GetPropertyStringValue(hMSI,"SUPPORTDIR",szSupportDir);
szName = "cmd.exe";
szCmdLine = "/C " + szSupportDir + "\\NameOfYourBatFile.bat";
nResult = LaunchAppAndWait (szName, szCmdLine, LAAW_OPTION_WAIT);
if (nResult < 0) then
MessageBox ("Unable to launch " + szName,SEVERE);
endif;
Note that "\" is an escape character, so you need to double them if used in text.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)