cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bigrat
Level 3

.bat files problem

hi ,i'am trying to execute a *.bat file in installshield 2009,but don't know how....
need your help
thank you very much in advance
Labels (1)
0 Kudos
(6) Replies
Not applicable

LaunchAppAndWait(*.bat","",WAIT);
0 Kudos
bigrat
Level 3

thanks
i know using the function launchappandwait(), do i have to endit the scripts?
but in installshield2009 i can't find the entrance to the scripts
do u know how?
0 Kudos
Not applicable

IS2009 support LaunchAppandwait(). You don’t have to edit it.

If you can’t use *.bat directly, try this,

LaunchAppAndWaitInitStartupInfo ( );
LaunchApplication( SystemFolder^"cmd.exe", "/c fullpath\\yourfile.bat","",SW_HIDE,15000, LAAW_OPTION_WAIT );
if (LAAW_PARAMETERS.nLaunchResult!=0) then
Messagebox (“error”, SEVERE);
endif;

SW_HIDE hides the CMD prompt. I successfully used this script in my project.
0 Kudos
Not applicable

If you use Basic MSI,you can try CA 50. I have given the entries from CA table; exepath is a property, value of the property is cmd.exe. [#myname.bat] is first column in file table i.e. file. It will return the file name with fullpath.

Action Type Source Target
CA4 50 exepath /c call "[#myname.bat]"
0 Kudos
bigrat
Level 3

thanks for your help!
am a beginner ,now i already know how to use launchappandwait(),but dont know the way to add my .bat file to my project
i mean,in the CustomActions view of IS2009,it only show adding "New DLL,New EXE,New VBScript"
how will i do now?
thanks in advance 🙂
0 Kudos
Not applicable

I thought you are going to install *.bat file. Now it looks like you want to run *.bat which is not part of the installation.
There are multiple ways; I used the one of the method below;
1. Add the *.bat in “support files” which is under “behavior and logic”
2. Create an IS custom action;
MsiGetProperty(hMSI, "SUPPORTDIR", szSupportDir, nLength);
szpath = szSupportDir^"Your.bat";
LongPathToQuote(szpath,TRUE);
LaunchApplication( SystemFolder^"cmd.exe", "/c "+szpath,"", SW_HIDE,5000, LAAW_OPTION_WAIT );

For topics like Creating CA…etc... IS help covers a lot.
0 Kudos