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
- :
- Re: Run command with output redirection and check result
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 23, 2012
09:37 AM
Run command with output redirection and check result
Hello all!
In order to check whether process with given name is running I would like to run following command using InstallScript:
I would like to check it's result afterwards (0 or 1).
What method with what options should I use? (LaunchApp, LaunchAppAndWait etc.).
I've tried different combinations and no one works as expected. I suppose the problem is in using "|" output redirection operator.
In order to check whether process with given name is running I would like to run following command using InstallScript:
wmic process list brief | find /i "MyApp.exe"
I would like to check it's result afterwards (0 or 1).
What method with what options should I use? (LaunchApp, LaunchAppAndWait etc.).
I've tried different combinations and no one works as expected. I suppose the problem is in using "|" output redirection operator.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
May 24, 2012
03:37 AM
Here is the function I've gone to. Checks whether process is running using WMI.
function BOOL ProcessRunningWMI(szAppName)
STRING szCmdLine;
begin
szCmdLine = "/c \"wmic process list brief | find /i \""+szAppName+"\"\"";
if (LaunchApplication("cmd",szCmdLine,"",SW_HIDE,2000,
LAAW_OPTION_WAIT | LAAW_OPTION_USE_SHELLEXECUTE ) < ISERR_SUCCESS) then
return FALSE;
endif;
return LAAW_PARAMETERS.nLaunchResult = 0;
end;
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)