C# Program to Get the Full Path of the Current Directory Using Environment Class Last Updated : 01 Nov, 2021 Summarize Comments Improve Suggest changes Share 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. In this article, we will discuss how to get the full path of the current directory. So to solve this problem we use the CurrentDirectory property of the Environment Class. This property returns the complete path of the current working directory of your computer. This property also throws the following exceptions: ArgumentException: This exception is thrown when the CurrentDirectory property tries to set to an empty string.ArgumentNullException: This exception is thrown when the CurrentDirectory property tries to set to null.IOException: This exception is thrown when the input/output error occurred.DirectoryNoFoundException: This exception is thrown when the CurrentDirectory property tries to set a local path/address that cannot be found.SecurityException: This exception is thrown when the caller does not have suitable permission. Syntax: Environment.CurrentDirectory Return Type: The return type of this property is a string. And the returned string represents the current directory path. Example: C# // C# program to find the current directory path // Using Environment Class using System; class GFG{ static public void Main() { // Declaring a string string resultPath = ""; // Get the complete path of the current // working directory. Using // CurrentDirectory property of // Environment class resultPath = Environment.CurrentDirectory; Console.WriteLine("System Directory:\n" + resultPath); } } Output: System Directory: /Users/Projects/newprogram/ Comment More infoAdvertise with us Next Article C# Program to Get the Logical Drives of Computer System Using Environment Class O ojaswilavu8128 Follow Improve Article Tags : C# CSharp-programs Similar Reads C# Program to Get the Path of System 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 C# Program to Get the Network Domain Name Associated with Current 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 Like