Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Run EXE from embedded VB

Created: 19 Feb 2013 • Updated: 20 Feb 2013 | 7 comments

I have  CA in Wise package  to run exe from embedded Vbscript, but it does not call the exe file.
The path is: C:\ AD Clearner\_MainCleaner\cleaner.exe. With a space between AD & clearner

I have the below script:

sExec=Session.Property("CLEARNERDIR") & "clearner.exe"

Set oShell = CreateObject("WScript.Shell")

Return = oShell.Run (sExec, 1, True)

if i add msgbox sExec i get the right path.

Any idea as why the clearner.exe does not get called.

Thanks.

Comments 7 CommentsJump to latest comment

VBScab's picture

I suspect you're running this in the ExecuteDeferred sequence, where only a very limited set of properties are available.

Search MSDN for details on using the special 'CustomActionData' property.

Also, do you *have* to use script? Why not use the standard action to run the executable?

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

NetRock's picture

Thanks for your comment.

As i mentioned if i add MsgBox i get the right value for sExec so the issue is not finding the properities

i am trying to make the installation silent as i could so that is way i am using embedded VB, it prevents the popup from exe file.

a quick prompt really appreiated.

Thanks!

EdT's picture

If you have a space in the path then you need to put double quotes around the whole path string. The string is correct but the execution needs double quotes to know it is a single path and not a path with an argument. 

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

NetRock's picture

Thanks.

I tried this already:

Return = oShell.Run ("sExec", 1, True)

and somewhere i saw this:

Return = oShell.Run ("""sExec""", 1, True)

and None helped any other idea.

Thanks

VBScab's picture

In the above cases, the code which gets run is either sExec or "sExec" because the string is being intrepeted literally. Instead, do this (ASCII character 34 is double-quote):

sExec=Chr(34) & Session.Property("CLEARNERDIR") & "clearner.exe" & Chr(34)

and leave the call to the .Run method as it was.

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

EdT's picture

Where is the custom action sequenced? Are you trying to run a file that is being installed by the MSI?

If so, are you sequencing the custom action in deferred AFTER the installfiles action, or if sequenced in immediate, after installfinalize?

What exit code is in the Return variable?

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

NetRock's picture

That's the catch i do not get any errors at all in the log file.

so what i did created a VB to accept an exe files as agrument, and it is working fine now.

I am at crunch time...and must really get it done Yesterday!!!

Anyway, thanks a lot for your kind help as always, you two have been great teacher to me.

I appreciate your help highly.