- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: LanchApplication doesn't work in rare case
- 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
LanchApplication doesn't work in rare case
hi
we are using install-script project for creating executable's. Install-shield fails to invoke a batch script from SUPPORTDIR and it's a rare case scenario. Below is the function used in our install-script project which invokes the batch file from SUPPORTDIR.
function BOOL unpack()
STRING batname, cmdargs, svLogFileName, svInsDir,ExeFile,LogsDir,szDirectory;
NUMBER nvExitCode,NRet;
begin
if ( SYSINFO.WIN9X.bWin9X )
then
CMDPROMPT = "command.com";
else
CMDPROMPT = "cmd.exe";
endif;
batname = SUPPORTDIR ^ "unpack.bat";
LongPathToQuote(batname,TRUE);
svLogFileName=TARGETDIR ^ "unpack.txt";
LongPathToQuote(svLogFileName,TRUE);
szDirectory=TARGETDIR;
LongPathToQuote(szDirectory,TRUE);
cmdargs = batname+" "+szDirectory+" > "+svLogFileName+ " 2>&1";
nvExitCode=LaunchApplication(CMDPROMPT," /C "+cmdargs,SUPPORTDIR,SW_HIDE,60000,LAAW_OPTION_WAIT);
NRet=LAAW_PARAMETERS.nLaunchResult;
if(NRet=1)
then
return FALSE;
else
return TRUE;
endif;
return TRUE;
end;
Batch script unpack.bat:
@ echo ON
set PRO_HOME=%~1
if x"%PRO_HOME%"==x (
echo home not set
exit 2;
)
if NOT EXIST "%PRO_HOME%" exit 3
cd /D "%PRO_HOME%"
call "%PRO_HOME%\init.bat"
exit %ERRORLEVEL%
ERROR logged in unpack.txt:
'C:\Users\test~1\AppData\Local\Temp\{50849220-F22D-46F7-8101-D34FF50A19E6}\{BCEC963-6E2D-4196-L310-5KE3B31937A9}\unpack.bat' is not recognized as an internal or external command,
operable program or batch file.
There is no doubt batch script is present in SUPPORTDIR. we could not find any concrete reason behind this error.
In Most of the cases either we got the above error or in the worst case , log will not be created in TARGETDIR and fails with return code 1.
Install-shield version - 2018.
Project type - Install-script
Platform- occurs in all OS ,server as well as client.
Any help is appreciated.
Thanks,
logesh
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@SpiderLily1 any guess?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I have not actually done this before. I'm wondering why you need to launch a command prompt at all. Can you just launch the .bat directly? Also, maybe try LaunchAppAndWait instead of LaunchApplication?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thanks a lot for your suggestion @SpiderLily1 . can you give a simple snippet on invoking a batch script directly using LaunchAppandWait
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I have not used this personally, so I can only point you to the documentation:
https://helpnet.flexerasoftware.com/installshield19helplib/Subsystems/installshield19langref/helplibrary/LangrefLaunchAppAndWait.htm
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)