C# Program to Get the Path of System Directory Using Environment Class Last Updated : 03 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, environment variable settings information, contents of the call stack information, and time since the last system boot in milliseconds information. By just using some predefined methods we can get the information of the Operating System using the Environment class. In this article, we will discuss how to get the path of the system directory. So we use the SystemDirectory property of the Environment Class. This property returns the full path of the directory of the system Syntax: Environment.SystemDirectory Return Type: The return type of this property is a string and this string represents the path of the system directory. Example: C# // C# program to find the path of system directory using System; class GFG{ static public void Main() { // Declaring a variable string resultDir = ""; // Now finding the path of system directory // Using the SystemDirectory property of // the Environment class resultDir = Environment.SystemDirectory; // Displaying the result Console.WriteLine("System Directory:" + resultDir); } } Output: System Directory: C:\Windows\system32 Comment More infoAdvertise with us Next Article C# Program to Get the Path of System Directory Using Environment Class O ojaswilavu8128 Follow Improve Article Tags : C# CSharp-programs Similar Reads C# Program to Get the Full Path of the Current Directory Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get the Operating System Version of Computer using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get the Logical Drives of Computer System Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get Current Stack Trace Information Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 2 min read C# Program to Get the Environment Variables Using Environment Class In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, 3 min read Like