tags:

views:

212

answers:

2

I have an exe (I have the C# code for that also). I am invoking the exe in my vb script application. Now I want to return a value from the exe and capture the same in my vb code. How can I do that?

+1  A: 
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("csharpprocess.exe")

Do While oExec.Status = 0
     WScript.Sleep 100
Loop

WScript.Echo oExec.ExitCode

Reference:
http://msdn.microsoft.com/en-us/library/2f38xsxe%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/za76z6hh%28v=VS.85%29.aspx

Igor Zevaka
A: 

To return a number from the EXE file, set this value in your C# code before you exit it.

Environment.ExitCode = MyNumber;
Wolf5