C# Environment CurrentDirectory
Description
Environment CurrentDirectory
gets or sets the fully
qualified path of the current working directory.
Syntax
Environment.CurrentDirectory
has the following syntax.
public static string CurrentDirectory { get; set; }
Example
The following example demonstrates setting the CurrentDirectory property.
using System.IO;//from ww w . j a v a 2s.c om
using System;
public class MainClass{
public static void Main(String[] argv){
// Change the directory to %WINDIR%
Environment.CurrentDirectory = Environment.GetEnvironmentVariable("windir");
DirectoryInfo info = new DirectoryInfo(".");
Console.WriteLine("Directory Info: "+info.FullName);
}
}
The code above generates the following result.