tags:

views:

206

answers:

2

I have a C# console application AAA.exe which can return an integer to indicate the result

static int Main(string[] args)
  {
    . . .
    if(case1)
       return -1;

    if(case2)
       Environment.Exit(1);

    return 0;
}

I will call AAA.exe in a batch file and need the return value

AAA.exe /p="param1"

My question is:

  1. how to get the return value of AAA.exe?
  2. is there any difference between return 0; and Environment.Exit(0); statements?
+3  A: 

You can use "errorlevel" in your batch file to get the returned value. More info here.

Foole
+1  A: 

Is there any difference between return 0; and Environment.Exit(0); statements?

See this post

thedugas