Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Environment.SystemDirectory Property

Gets the fully qualified path of the system directory.

[Visual Basic]
Public Shared ReadOnly Property SystemDirectory As String
[C#]
public static string SystemDirectory {get;}
[C++]
public: __property static String* get_SystemDirectory();
[JScript]
public static function get SystemDirectory() : String;

Property Value

A string containing a directory path.

Remarks

An example of the value returned is the string "C:\WinNT\System32".

Example

[Visual Basic] 
' Sample for the Environment.SystemDirectory property
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      '  <-- Keep this information secure! -->
      Console.WriteLine("SystemDirectory: {0}", Environment.SystemDirectory)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'SystemDirectory: C:\WINNT\System32
'

[C#] 
// Sample for the Environment.SystemDirectory property
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
//  <-- Keep this information secure! -->
    Console.WriteLine("SystemDirectory: {0}", Environment.SystemDirectory);
    }
}
/*
This example produces the following results:

SystemDirectory: C:\WINNT\System32
*/

[C++] 
// Sample for the Environment::SystemDirectory property
#using <mscorlib.dll>

using namespace System;

int main() {
   Console::WriteLine();
   //  <-- Keep this information secure! -->
   Console::WriteLine(S"SystemDirectory: {0}", Environment::SystemDirectory);
}
/*
This example produces the following results:

SystemDirectory: C:\WINNT\System32
*/

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Environment Class | Environment Members | System Namespace

Show:
© 2015 Microsoft