Set Current Directory

image_pdfimage_print
   
 

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") + "'");
    }
}
           
         
     


This entry was posted in File Stream. Bookmark the permalink.