开发者

How to return value from exe and capture the returned value using C#

开发者 https://www.devze.com 2023-01-02 00:16 出处:网络
I have an exe (I have the C# code for that also). I am invoking the exe in my vbscrip开发者_如何学JAVAt application. Then I want to return a value from the exe and

I have an exe (I have the C# code for that also). I am invoking the exe in my vbscrip开发者_如何学JAVAt application. Then I want to return a value from the exe and capture the value in my vbscript code. How can I do that?


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


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

Environment.ExitCode = MyNumber;
0

精彩评论

暂无评论...
验证码 换一张
取 消