2

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

3
  • possible duplicate of Return image from exe Commented Jun 4, 2010 at 5:39
  • why have you created a new account and asked virtually an identical question to what you asked yesterday? Commented Jun 4, 2010 at 5:39
  • @slugster: I think he's trying to implement one of the suggestions (from the comments: "have the exe return the file path via stdout and then the vbscript reads the output of the exe to get the path, then reads the file. – James Manning"). I'd say it's different enough ("what are my options in passing data between two programs"/"how to implement one of the options"). Commented Jun 4, 2010 at 5:55

2 Answers 2

2
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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Environment.ExitCode = MyNumber;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.