Community Forums
Page 2 of 2 FirstFirst 12
Results 6 to 10 of 10

Thread: Unable to Capture results properly from CMD line parameter executions by LaunchApp

  1. #6
    Join Date
    May 2007
    Location
    Eden Praire, MN
    Posts
    749
    Hi dinesh.redhawk,

    These command lines are tricky and I always start simple and add to it. I should have tested before posting... but that takes time

    You probably know that you can compile your InstallScript code without doing a full build (which can take quite a bit of time). Just right click on your Setup.rul (or similar) and click 'Compile'. This only takes a few seconds. Build when all compile errors are resolved. The following command line works for me:
    Code:
    szCmdLine = "/C NET LOCALGROUP " + szGroup + "\ /comment:\"" + szComment + "\" /add >\"" + szTempFolderPath + "\" 2>&1";

  2. #7
    Join Date
    May 2011
    Posts
    71
    Quote Originally Posted by rguggisberg View Post
    Hi dinesh.redhawk,

    These command lines are tricky and I always start simple and add to it. I should have tested before posting... but that takes time

    You probably know that you can compile your InstallScript code without doing a full build (which can take quite a bit of time). Just right click on your Setup.rul (or similar) and click 'Compile'. This only takes a few seconds. Build when all compile errors are resolved. The following command line works for me:
    Code:
    szCmdLine = "/C NET LOCALGROUP " + szGroup + "\ /comment:\"" + szComment + "\" /add >\"" + szTempFolderPath + "\" 2>&1";
    Ok, i tried this and its giving me the same result. Now lets jump to the 2nd part of my question i.e. the result of szResult. [Please refer to my first post, code is there]

    The szResult in my code is returning "The specified file path cannot be found" and nResult is -2. Definitely its not correct return status.
    This happens in the case when the group is already present and it writes this message in the log file "The specified local group already exists".

    In case when the group doesn't exist, it creates the group and szResult shows "Operation completed successfully" and the same gets written in the log file too.

    My observation says that because of the double quotes due to /C, Installer is somehow thinking the entire command as some kind of file path. You can verify this by printing the szCommand in a MessageBox.

    Whats your thoughts on this?

    Thanks

  3. #8
    Join Date
    May 2007
    Location
    Eden Praire, MN
    Posts
    749
    Keep in mind that nResult only contains the result (Success/Fail) of the LaunchAppAndWait. It definitely does NOT contain the result of your NET LOCALGROUP command. You need to parse the file that you piped the results to to get that.

  4. #9
    Join Date
    May 2011
    Posts
    71
    Quote Originally Posted by rguggisberg View Post
    Keep in mind that nResult only contains the result (Success/Fail) of the LaunchAppAndWait. It definitely does NOT contain the result of your NET LOCALGROUP command. You need to parse the file that you piped the results to to get that.
    My research says another thing - If you pass LAAW_PARAMETERS as parameters to LaunchAppandWait, then nResult will contain the results of the launched application i.e. in my case NET LOCALGROUP.
    Below is the explanation from Flexera Help:

    "
    If the application cannot be launched, the nLaunchResult member contains the result of calling GetLastError after the CreateProcess call. If LaunchApp, LaunchAppAndWait, or LaunchApplication is successful and the LAAW_OPTION_WAIT option was specified, the nLaunchResult member contains the return code of the launched application."

  5. #10
    Join Date
    May 2007
    Location
    Eden Praire, MN
    Posts
    749
    Quote Originally Posted by dinesh_redhawk View Post
    Ok, i tried this and its giving me the same result. Now lets jump to the 2nd part of my question i.e. the result of szResult. [Please refer to my first post, code is there]

    The szResult in my code is returning "The specified file path cannot be found" and nResult is -2. Definitely its not correct return status.
    This happens in the case when the group is already present and it writes this message in the log file "The specified local group already exists".

    In case when the group doesn't exist, it creates the group and szResult shows "Operation completed successfully" and the same gets written in the log file too.

    My observation says that because of the double quotes due to /C, Installer is somehow thinking the entire command as some kind of file path. You can verify this by printing the szCommand in a MessageBox.

    Whats your thoughts on this?

    Thanks
    Not sure what "Same result" is. Does it compile successfully? I used the command line I posted and it works as expected. MsgBox shows:
    szCmdLine=/C NET LOCALGROUP UserName /comment:"My Comment" /add >"MyPath\MyFileName.txt" 2>&1

    As far as the nResult thing.... You may be right, but based on past experience I am not convinced. I have not seen it work that way.... maybe it should. Do you have any other options specified besides LAAW_OPTION_WAIT ?

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •