Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Custom Action for running batch File with param


6 replies to this topic

K.Senthil Babu

K.Senthil Babu
  • Full Members
  • 4 posts

Posted 13 June 2012 - 11:47

I need to create a installation package for installing FireBird Database Server, For which i need to run a batch file which is located in the firebird dir which will be installed to the client. I created a custom Action script using Install script, but it is not working one for Installing and another for UnInstalling.

Please HELP ME

function InstallFireBirdBatchFile(hMSI)
// This InstalFireBirdBatchFile must be executed After InstallFinalize
// To Do: Declare local variables.
STRING szProgram,szParam;
NUMBER nResult;
begin
szProgram = "cmd.exe";
LongPathToQuote(szProgram,TRUE);
szParam = "/c" + " " + INSTALLDIR + "FB251\\bin\\Install_super.bat NewFB251";

// NewFB251- Is the parameter for the batch file
LongPathToQuote(szParam, TRUE);
MessageBox ("Command is: " + szProgram + szParam,INFORMATION);
nResult = LaunchAppAndWait(szProgram,szParam,LAAW_OPTION_WAIT);
if nResult<0 then
MessageBox ("Failed... : " ,INFORMATION);
else
MessageBox ("Success...: ",INFORMATION);
endif;
Log
end;

function UnInstallFireBirdBatchFile(hMSI)
// This UnInstalFireBirdBatchFile must be executed Before Removal of Files
// To Do: Declare local variables.
STRING szProgram,szParam;
NUMBER nResult;
begin
szProgram = "cmd.exe";
LongPathToQuote(szProgram,TRUE);
szParam = "/c" + " " + INSTALLDIR + "FB251\\bin\\UnInstall.bat NewFB251";
// NewFB251- Is the parameter for the batch file
LongPathToQuote(szParam, TRUE);
MessageBox ("Command is: " + szProgram + szParam,INFORMATION);
nResult = LaunchAppAndWait(szProgram,szParam,LAAW_OPTION_WAIT);
if nResult<0 then
MessageBox ("Failed... : " ,INFORMATION);
else
MessageBox ("Success...: ",INFORMATION);
endif;
Log
end;[/CODE][B][B]

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 13 June 2012 - 15:02

Can you please explain in more detail what is not working? Do you get any error messages?
BTW you don't need InstallScript to launch a .bat file, you could instead run cmd.exe as a custom action.

K.Senthil Babu

K.Senthil Babu
  • Full Members
  • 4 posts

Posted 13 June 2012 - 15:19

During the Installation the Install Shield just opens the command prompt and closing. The parameters which i am passing is not being executed. Hence the installation of Firebird database is incomplete, just only the files needed for the firebird database is copied to the client machine.

I Tried the same with the Custom Action wizard by selecting
Type: "Launch an executable"
Location:"Stored in Directory table"
SOURCE:"System32 "
Target: "cmd.exe /c [INSTALLDIR]JKTechFB251\bin\Install_server.bat JKTechFB251"
Instal Execute Sequence: "After Finalize"
When tried Raising Error : There is a problem with the windows installer package. A Program run as part of the setup didnot finish as expected.

K.Senthil Babu

K.Senthil Babu
  • Full Members
  • 4 posts

Posted 13 June 2012 - 15:42

During the Installation the Install Shield just opens the command prompt and closing. The parameters which i am passing is not being executed. Hence the installation of Firebird database is incomplete, just only the files needed for the firebird database is copied to the client machine.

I Tried the same with the Custom Action wizard by selecting
Type: "Launch an executable"
Location:"Stored in Directory table"
SOURCE:"System32 "
Target: "cmd.exe /c [INSTALLDIR]FB251\bin\Install_server.bat NewFB251"
Instal Execute Sequence: "After Finalize"
When tried Raising Error : There is a problem with the windows installer package. A Program run as part of the setup didnot finish as expected.

MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 14 June 2012 - 08:59

What do you do in the batch file?
You can try avoiding the batch file by adding the same functionality in the Installscript.

K.Senthil Babu

K.Senthil Babu
  • Full Members
  • 4 posts

Posted 14 June 2012 - 11:22

The batch file is for Installing the Firebird Database Server on to the client machine. All the Steps that has to be done during the installation are available default in the batch file. If i use the MSI for firebird database server only default instance will create, we want to create custom instance.

MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 14 June 2012 - 15:10

What you say is fine.
But all that you do with the batch file can be done in Installscript. You may, thus, get rid of the batch file and use Installscript instead.

So if you are invoking FireBird installer with parameters:
firebired.msi /instance="NamedInstance" /etc, for example,

you may get rid of the batch file and do it fully using Installscript. That is more clean and reduces the overhead of batch file.