C# Program to Get Complete Path of Current Directory
Given a directory, now our task is to find the path of the given directory or current directory. So to this task, we use the GetCurrentDirectory() method of the Directory class. This method will return the complete path of the current directory. The result given by this method will not end with a backslash (\).
public static string GetCurrentDirectory();
Return: It will return a string that represents the path of the current directory.
Exception: It will throw the following exceptions:
- UnauthorizedAccessException: This exception occurs when the caller does not have the required permission.
- NotSupportedException: This exception occurs when the operating system is Windows CE. It does not have the functionality of the current directory.
Current directory path: C:\Users\Sravan\ConsoleApplication12
My Personal Notes arrow_drop_up
Please Login to comment...