I have a vbscript that creates a directory, copies a .exe to it and then
should run that . exe, waiting for the end of the execution in order to do
some other actions, such as copying another file to that directory
overwriting one created by the execution. The problem is that when it tries
to run the program, it just opens an explorer window in â??c:\â??, gives an
vbscript error: â??Unable to wait for processâ??, code:80020009, Source:
WshShell.Run, and exits with return code = 0! The code is:

Dim fso, wshshell, sProgDir, sOraRrpOrig, sOraRrpIniOrig, sOraRrpDir

Set fso = CreateObject("Scripting.FileSystemObject")
set WshShell = CreateObject("Wscript.Shell")
'sOraRrpOrig = "f:\instala_script\OraRrp\orarrp.exe"
sOraRrpOrig = "f:\OraRrp\orarrp.exe"
sOraRrpDir = "C:\Program Files\OraRrp\"
sProgRun = " ""c:\Program Files\OraRrp\OraRrp.exe"" -i -s"

Set f = fso.CreateFolder(sOraRrpDir)
fso.CopyFile sOraRrpOrig, sOraRrpDir
sReturn = WshShell.Run(sProgRun, 1, True)
if Sreturn = 0 Then
WScript.Echo "Finished installing OraRrp!"
Else
WScript.Echo "Error executing OraRrp.exe! R/C: " & sReturn
End if

I canâ??t see whatâ??s wrong with the code, and Iâ??m almost insane trying to get
this to work. Does anybody can help me with this?

Thanks in advance.

Americo

Re: Problem trying to run program from script, waiting for result by brudertl

brudertl
Thu Feb 23 15:45:59 CST 2006

Americo,

Try changing:
sProgRun = " ""c:\Program Files\OraRrp\OraRrp.exe"" -i -s"

to this:

sProgRun = chr(34) & "c:\Program Files\OraRrp\OraRrp.exe" & chr(34) & "
-i -s"


Troy


Re: Problem trying to run program from script, waiting for result by ARNascimento

ARNascimento
Fri Feb 24 11:30:29 CST 2006

Troy,

It worked! Thanks a lot!

I'm quite new to VBScript, and had never had any problem with double quotes,
but from now on I will stick to the GREAT Chr(34)!!!
Thanks again,

Américo