如何运行exe文件后返回退出code? [英] How to return exit code after running an exe?

查看:260
本文介绍了如何运行exe文件后返回退出code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了用于验证功能,这个应用程序,我需要通过使用VBScript执行控制台应用程序。执行该exe文件后,我想返回退出code函数是否返回成功与否。我怎样才能返回一个状态或退出code。在.NET?

I have created a Console application for validating a function and this application i need to execute by using vbscript. After executing this exe i want to return an exit code whether the function return success or not. How can i return a status or exit code in .net?

推荐答案

我会假设你正在写C#或VB.NET。在这两种情况下,人们通常有一个主要功能不返回任何内容,但是您可以更改为返回一个整数重新present出口code。

I'm going to assume you're writing either C# or VB.NET. In either case usually people have a Main function that returns nothing, but you can change this to return an integer to represent the exit code.

有关C#看看这个MSDN页

您可以做的:

static int Main()
{
    //...
    return 0;
}

有关VB.NET看到这个MSDN网页

For VB.NET see this MSDN page.

您可以做的:

Module mainModule
    Function Main() As Integer
        '....
        '....
        Return returnValue
    End Function
End Module

这篇关于如何运行exe文件后返回退出code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆