Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Directory.GetCurrentDirectory Method

Gets the current working directory of the application.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

static member GetCurrentDirectory : unit -> string

Return Value

Type: System.String
A string that contains the path of the current working directory, and does not end with a backslash (\).

ExceptionCondition
UnauthorizedAccessException

The caller does not have the required permission.

NotSupportedException

The operating system is Windows CE, which does not have current directory functionality.

This method is available in the .NET Compact Framework, but is not currently supported.

The current directory is distinct from the original directory, which is the one from which the process was started.

For a list of common I/O tasks, see Common I/O Tasks.

The following example demonstrates how to use the GetCurrentDirectory method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Show:
© 2015 Microsoft