05-15-2024, 06:36 PM
Using the AI link you provided, Davider:
using System;
using System.IO;
class Program
{
static void Main()
{
// Path to the new current directory
string newCurrentDirectory = @"C:\Your\New\Path";
// Check if the directory exists before setting it
if (Directory.Exists(newCurrentDirectory))
{
// Set the current directory
Directory.SetCurrentDirectory(newCurrentDirectory);
Console.WriteLine("The current directory has been set to: " + Directory.GetCurrentDirectory());
}
else
{
Console.WriteLine("The specified directory does not exist.");
}
}
}