Hi i am attempting to change the directory in a method in my program and i was wondering how i would then use the variable from the method to say that the directory has changed in a start screen method
any help would be much appreciated
static void choice4()
{
Console.WriteLine("Please enter a new directory to go to: ");
string newDirectory = Console.ReadLine();
try
{
Directory.SetCurrentDirectory(newDirectory);
}
catch (DirectoryNotFoundException n)
{
Console.WriteLine("The Directory {0} does not exist", n);
}
Console.WriteLine("Root directory: {0}", Directory.GetDirectoryRoot(newDirectory));
Console.WriteLine("Current directory: {0}", Directory.GetCurrentDirectory());
Console.ReadLine();
Console.Clear();
startscreen();
}
any help would be much appreciated