The entry-point method of any application (in C# project, this is usually the method
) can return integer value called exit code
. It does not have any predefined meaning, but it's customary to return 0 to indicate "success", "not errors", anything else in all other cases which are totally application-dependent.
Any parent process of the process of your application can read this return value and do with at anything you want. Again, there is no special predefined meaning for this value, so it's up to you. In particular, the process running a batch file gets exit code used to branch batch file execution depending on the value returned. In .NET, you can start your application as as child process using
and check up its exit code using the property
, see http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
That's it. These day this feature is used rarely, especially on Windows. It used to be used for scripting, in particular, in some command-line build scripts, but with advent of MSBuild this approach to build it totally obsolete. In UNIX/Linux, using exit code is a bit more usual.