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
- :
- How to use LaunchApplication function?
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
‎May 12, 2011
06:42 PM
How to use LaunchApplication function?
I need to call a command line function from an installscript based project and redirect the output. My attempts to use the LaunchApplication function in my main project weren't working so I created the following simplistic test case which still doesn't work.
I created a brand new default installscript project. I then added the following code:
The first message box displays and then I always get the App Failed warning and the app didn't run because there is no dir.txt file.
I'm sure I'm missing something obvious, but can't see it. Any help would be appreciated.
I created a brand new default installscript project. I then added the following code:
MessageBox("Before LaunchApplication", INFORMATION);
nResult = LaunchApplication( "dir", ">> dir.txt", "C:\\data\\junk\\", SW_HIDE, 100, LAAW_OPTION_WAIT );
if(nResult < ISERR_SUCCESS)
then
MessageBox("Warning: App Failed.", INFORMATION);
abort;
else
MessageBox("App Succeeded.", INFORMATION);
abort;
endif;
The first message box displays and then I always get the App Failed warning and the app didn't run because there is no dir.txt file.
I'm sure I'm missing something obvious, but can't see it. Any help would be appreciated.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 13, 2011
11:33 AM
I think this might be what you are looking for:
Just make sure that you really want to use ">>" (which appends to the file) instead of just ">" (which overwrites/creates a new file).
HTH
nResult = LaunchApplication( WINSYSDIR ^ "cmd.exe", "/c dir >> dir.txt", "C:\\data\\junk", SW_HIDE, 100, LAAW_OPTION_WAIT );
Just make sure that you really want to use ">>" (which appends to the file) instead of just ">" (which overwrites/creates a new file).
HTH
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 13, 2011
06:38 PM
Thanks, I had already figured out that my example was a little bogus since dir is a built in shell command and not a separate exe but hadn't yet figured out how to get the redirector to work with an exe file call. Your cmd.exe \c solution is exactly what I needed. Much appreciated.