Get or set the fully qualified path of the current working directory in CSharp

Description

The following code shows how to get or set the fully qualified path of the current working directory.

Example


/* w w  w . ja va 2  s . c  om*/
using System.IO;
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.





















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random