cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hjien88
Level 2

exe cannot run using LaunchAppAndWait command

Hi all,

I use installshield 2009 to build my installer.
I have put "FwUpgrade.exe" & "update.xml" under installshield's support files.
This exe is kind of window form application installer.
This exe not require any clicking actions.
I need to call and run "FwUpgrade.exe -f update.xml" for my case.
However, I always get result "-1" which the exe cannot run at all.

Could anyone please advice me on my mistake?
Thanks.

Here are my codes example:

prototype FwUpgrade();
function FwUpgrade()
string szKey, szNumName, szApp, szMsg, szNumValue;
string svValue;
number nType, nSize, nReturn, nError;
begin
//Upgrade Firmware
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey = "SOFTWARE\\P&C";
nType = REGDB_STRING;
szNumName = "MainVersion";
szNumValue = CurrentVersion;
nSize = -1;
nReturn = RegDBGetKeyValueEx(szKey,szNumName,nType,svValue,nSize);

if (StrCompare(CurrentVersion,svValue)>0) then
szApp = SUPPORTDIR ^ "FwUpgrade.exe";
if(LaunchAppAndWait(szApp,"", LAAW_OPTION_WAIT)<0)then
MessageBox("Launch app failed", SEVERE);
end if;
end if;
end;

Methods I have tried:
(1)szApp = SUPPORTDIR ^ "FwUpgrade.exe";
LaunchAppAndWait(szApp ,"", LAAW_OPTION_WAIT)

(2)szApp = SUPPORTDIR ^ "FwUpgrade.exe";
LaunchAppAndWait(szApp, "-f update.xml" , LAAW_OPTION_WAIT)

(3)szApp = SUPPORTDIR ^ "FwUpgrade.exe";
szCmd = szApp+" /f update.xml";
LaunchAppAndWait("CMD.exe", szCmd , LAAW_OPTION_WAIT)
Labels (1)
0 Kudos
(3) Replies
overlordchin
Level 6

This might sound silly but did you verify the path is exactly what you think it is?

szTestValue = SUPPORTDIR ^ "FwUpgrade.exe";
MessageBox(szTestValue, WARNING);

looking at the way you are calling it I do not see anything particularly wrong with what you are doing. Also what happens if you manually execute this file from the command line? Does it work?
0 Kudos
hjien88
Level 2

Thank you alot overlordchin!!

I solved my problem!
What a silly mistake i have made.
SUPPORTDIR does not work for Basic MSI project.

Therefore, after i change the directory,it works.
🙂
0 Kudos
palanisamy
Level 7

Use MsiGetProperty function to retrieve SUPPORTDIR property value in installscript.
0 Kudos