This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Problem using LaunchAppAndWait
Subscribe
- 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
‎Apr 19, 2013
11:09 AM
Problem using LaunchAppAndWait
Dear Community,
I have an InstallScript that needs to pass 2 parameters to the LaunchAppandWait function. The problem is that the parameters use the INSTALLDIR as part of the parameter. If the INSTALLDIR has spaces in it, the external program views that as another parameter and causes it to fail. How do I pass the first and second parameters to the external program so that the spaces are not viewed as parameter separators. He is the code:
STRING szParm1, szParm2, szParm3;
szParm1 = INSTALLDIR^"MyApp.exe ";
szParm2 = INSTALLDIR^"MyApp.ini";
szParm3 = szParm1 + szParm2;
LaunchAppAndWait(INSTALLDIR ^ "ChangeIt.exe", szParm3, LAAW_OPTION_WAIT);
I have an InstallScript that needs to pass 2 parameters to the LaunchAppandWait function. The problem is that the parameters use the INSTALLDIR as part of the parameter. If the INSTALLDIR has spaces in it, the external program views that as another parameter and causes it to fail. How do I pass the first and second parameters to the external program so that the spaces are not viewed as parameter separators. He is the code:
STRING szParm1, szParm2, szParm3;
szParm1 = INSTALLDIR^"MyApp.exe ";
szParm2 = INSTALLDIR^"MyApp.ini";
szParm3 = szParm1 + szParm2;
LaunchAppAndWait(INSTALLDIR ^ "ChangeIt.exe", szParm3, LAAW_OPTION_WAIT);
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 19, 2013
11:47 AM
There are several different approaches you can take. For param1 you can call the LongNameToShort function but for the other parameters (and therefore also for param1) you can wrap the paths with quotes. Generally use double quotes, and if a parameter already has double quotes, convert them to single quotes.
STRING szParm1, szParm2, szParm3;
szParm1 = "\"" + INSTALLDIR^"MyApp.exe \"";
szParm2 = "\"" + INSTALLDIR^"MyApp.ini \"";
szParm3 = szParm1 + szParm2;
LaunchAppAndWait(INSTALLDIR ^ "ChangeIt.exe", szParm3, LAAW_OPTION_WAIT);
or use LongPathToQuote
STRING szParm1, szParm2, szParm3;
szParm1 = "\"" + INSTALLDIR^"MyApp.exe \"";
szParm2 = "\"" + INSTALLDIR^"MyApp.ini \"";
szParm3 = szParm1 + szParm2;
LaunchAppAndWait(INSTALLDIR ^ "ChangeIt.exe", szParm3, LAAW_OPTION_WAIT);
or use LongPathToQuote
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 19, 2013
12:07 PM
In thinking about his I am not clear on whether your app takes a single command line parameter or whether you are intending to pass two parameters, which is what I assumed in the other post.
if param3 needs to be a single string then do:
szParm1 = "'" + INSTALLDIR^"MyApp.exe '"; //use single quotes
szParm2 = "'" + INSTALLDIR^"MyApp.ini '"; //use single quotes
szParm3 = "\"" + szParm1 + szParm2 + "\""; //wrap the space separated single quoted args with double quotes so that changeit.exe thinks there is only one arg
if param3 needs to be a single string then do:
szParm1 = "'" + INSTALLDIR^"MyApp.exe '"; //use single quotes
szParm2 = "'" + INSTALLDIR^"MyApp.ini '"; //use single quotes
szParm3 = "\"" + szParm1 + szParm2 + "\""; //wrap the space separated single quoted args with double quotes so that changeit.exe thinks there is only one arg
![](/skins/images/8C9D13A71C7F7695F3262372C0172D68/responsive_peak/images/icon_anonymous_message.png)