Directory.SetCurrentDirectory(String path) : Directory « System.IO « C# / C Sharp by API






Directory.SetCurrentDirectory(String path)

  

using System;
using System.IO;

class MainClass {
    static void Main() {
        Console.WriteLine("Changing current directory to c:\\");
        Directory.SetCurrentDirectory(@"c:\");

        Console.WriteLine("Now the relative path 'file.txt' " + "will automatically become '" + Path.GetFullPath("file.txt") + "'");
    }
}

   
    
  








Related examples in the same category

1.Directory.CreationTime
2.Directory.Delete
3.Directory.Exists
4.Directory.GetCurrentDirectory()
5.Directory.GetFiles
6.Directory.GetLogicalDrives