Skip to content
⌘ NSIS Forum Archive

Exec vs. ExecShell - bug?

9 posts

jaroslav_adamec#

Exec vs. ExecShell - bug?

It looks to me that Exec and ExecWait aren't working.

This two lines doesn't works:
Exec "C:\winnt\notepad.exe"
ExecWait "C:\winnt\notepad.exe"
bouth sets Error flag

but this one works:
ExecShell "" "C:\winnt\notepad.exe"

So what's wrong?

Jarda
jaroslav_adamec#
My program use third party software when I recognize that this softvare isn't installed on this computer I need to run their installation. So I want to run their instalation software and I used ExecWait instruction but it did nothing, so I tryed ExecShell and it works but with ExecShell I'm not able to recognize when and how this external program finished.
The example listed in my message was simplified as much as possible, ofcourse I don't need to run notepad.

Jarda
Schultz#
this taken from the docs..
"If no output variable is specified ExecWait sets the error flag if the program executed returns a nonzero error code, or if there is an error. "
So you might wish to add a varible to the ExecWait and see what the return code is when it is normally closed.
justin#
When using Exec, be sure that both:
  • $OUTDIR is set (i.e. via SetOutPath or StrCpy).
  • If your executable name/directory has spaces in it, use:

    Exec '"path to executable\executable.exe"'


-Justin
jaroslav_adamec#
Thanks,
the problem was that $OUTDIR wasn't set.

I have to say that in my documentation is nothing like Schultz wrote "If no output variable is specified ... "

There is only "$OUTDIR is used for the working directory".

Jarda
Schultz#
It is the sentance right before about using the $OUTPUT dir.

ExecWait full_path_of_command_to_execute [$(0-9)]
Execute the specfied program and wait for the executed process to quit. See Exec for more information. If no output variable is specified ExecWait sets the error flag if the program executed returns a nonzero error code, or if there is an error. If an output variable is specified, ExecWait sets the variable with the exit code (and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined).

Both the docs that come with Nsis 1.6 and the Online docs.
jaroslav_adamec#
Ok,
I'm very sorry, I started to work with NSIS a few days ago and I couldn't imagine how fast the develop of NSIS is.
I didn't now that if I have somethig what's two weeks old I have somethig realy very old.

So sorry Schultz.
Jarda
Schultz#
no need to be sorry for it. Cause it is also might be my fault for thinking that it could be in the docs that are a few weeks old. But lots of changes are good.. I have noticed that Justin always does a trend.. he will do alot of changes in a few months and then it will be a while before a version is released.. like version 1.44 was the top version for 4 months and then after that change after change which of course is not a bad thing at all.