Environment.ExitCode-Eigenschaft
Ruft den Exitcode des Prozesses ab oder legt diesen fest.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared Property ExitCode As Integer
'Usage
Dim value As Integer
value = Environment.ExitCode
Environment.ExitCode = value
public static int ExitCode { get; set; }
public:
static property int ExitCode {
int get ();
void set (int value);
}
/** @property */
public static int get_ExitCode ()
/** @property */
public static void set_ExitCode (int value)
public static function get ExitCode () : int
public static function set ExitCode (value : int)
Eigenschaftenwert
Eine 32-Bit-Ganzzahl mit Vorzeichen, die den Exitcode enthält. Der Standardwert ist 0.
Hinweise
Diese Eigenschaft kann zur Rückgabe eines Erfolgscodes durch eine Anwendung verwendet werden. Sie kann z. B. zur Steuerung der Ausführung einer Gruppe von Anweisungen verwendet werden, die in einem Skript gestartet werden. Wenn der Wert dieser Eigenschaft von der Anwendung nicht festgelegt wurde, wird 0 zurückgegeben.
Der System-Exitcode wird auf den Rückgabewert der Funktion main festgelegt, bzw. auf 0, wenn mainvoid zurückgibt.
Beispiel
Im folgenden Codebeispiel wird ein eigener Exitcode angezeigt.
' Sample for the Environment.ExitCode property
Imports System
Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("ExitCode: {0}", Environment.ExitCode)
End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'ExitCode: 0
'
// Sample for the Environment.ExitCode property
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("ExitCode: {0}", Environment.ExitCode);
}
}
/*
This example produces the following results:
ExitCode: 0
*/
// Sample for the Environment::ExitCode property
using namespace System;
int main()
{
Console::WriteLine();
Console::WriteLine( "ExitCode: {0}", Environment::ExitCode );
}
/*
This example produces the following results:
ExitCode: 0
*/
// Sample for the Environment.ExitCode property
import System.*;
class Sample
{
public static void main(String[] args)
{
Console.WriteLine();
Console.WriteLine("ExitCode: {0}",
System.Convert.ToString(Environment.get_ExitCode()));
} //main
} //Sample
/*
This example produces the following results:
ExitCode: 0
*/
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0