共用方式為


Environment.SystemDirectory 屬性

定義

取得系統目錄的完整路徑。

public:
 static property System::String ^ SystemDirectory { System::String ^ get(); };
public static string SystemDirectory { get; }
member this.SystemDirectory : string
Public Shared ReadOnly Property SystemDirectory As String

屬性值

String

含有目錄路徑的字串。

範例

下列範例會顯示執行程式碼範例之電腦的系統目錄。 (基於安全性考慮,系統目錄會從範例輸出中省略。)

// Sample for the Environment::SystemDirectory property
using namespace System;
int main()
{
   Console::WriteLine();
   
   //  <-- Keep this information secure! -->
   Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory );
}

/*
This example produces the following results:

SystemDirectory: C:\WINNT\System32
*/
// 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
*/
// Sample for the Environment.SystemDirectory property
open System

//  <-- Keep this information secure! -->
printfn $"\nSystemDirectory: {Environment.SystemDirectory}"

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

備註

傳回之值的範例是字串 「C:\WINDOWS\System32」。

適用於