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?
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:
cmd.exe /c "[SUPPORTDIR]BatchFile.bat"
It definitely can be done by adding the bat file as a 'Language Independent' Support file.
Then in your CA add something like this:
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);
Note that "\" is an escape character, so you need to double them if used in text.