Archive: ExecWait doesn't wait


ExecWait doesn't wait
Hi,

I'm writing a small utility to run winzip from php. The exec function of php has a bug regarding quotation in arguments and brings up a dos box that I want to suppress. Other methods (via:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmdline, 0, $m);
do run and do hide the dos box, but do not wait for winzip to finish (which is essential).

I run it now via the start command of windows, but that brings up a dos box that I don't want. So I considered rerouting it via a small utility built with nsis, see below. Very simple, but it doesn't work: ExecWait doesn't wait.

Do you know a solution?

Thanks, best regards,
-Hendri.
(PS: I am running the latest nsis on winxp sp2).


name "Test"
outfile "test.exe"

SilentInstall silent

Section
Call GetParameters
Pop $0
ExecWait '$0'
sectionEnd

Function GetParameters

Push $R0
Push $R1
Push $R2
Push $R3

StrCpy $R2 1
StrLen $R3 $CMDLINE

;Check for quote or space
StrCpy $R0 $CMDLINE $R2
StrCmp $R0 '"' 0 +3
StrCpy $R1 '"'
Goto loop
StrCpy $R1 " "

loop:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 $R1 get
StrCmp $R2 $R3 get
Goto loop

get:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 " " get
StrCpy $R0 $CMDLINE "" $R2

Pop $R3
Pop $R2
Pop $R1
Exch $R0

FunctionEnd


Call the good old start.exe that does wait with nsExec that hides the dos box.


watch out, there is no such thing as start.exe on NT based systems, only w9x, on NT its built into cmd.exe

you probably need to use something like
%comspec% /c start foobar

(start on NT is very stupid, if you need to use a quoted path, start thinks this is the window title so you need to do: %comspec% /c Start "" "c:\foo bar", not sure what that does on 9x)


Indeed, %comspec% /c Start "" "c:\foo bar" seems to work. I found it myself too earlier today, but thanks anyway. Besides, with the WshShell object and the fact that start takes /wait, I managed to write a function that executes that command without dos box and it will wait for the application to finish. So the nsis utility is not necessary anymore, but still, the ExecWait not waiting surprised me.

-Hendri


i am trying to do something similar, but having no luck

i need to run some "msi" install programs at the end of my main script

i would like to use ExecWait, but the following doesn;t seem to work

ExecWait '%comspec% /c Start open "$INSTDIR\Tmp\msxml.msi"'

nothing happens

what am i doing wrong?

cheers
bhu


its not Start open, if you want to set the title, use doublequotes, but you really should use msiexec.exe instead of the whole %comspec% /c mess

see http://forums.winamp.com/showthread....hreadid=212645


thanx very much - that works!