using System; using System.IO; namespace forgetCode { class Program { static void Main(string[] args) { string path = "D:\\test.txt"; if (File.Exists(path)) { Console.WriteLine("Please enter new content for the file:"); string newContent = Console.ReadLine(); File.WriteAllText(path, newContent); } } } }