class Program { static void Main(string[] args) { Console.WriteLine("ICO文件轉PNG"); string path = null; bool got = false; while (!got) { Console.WriteLine("請輸入需要轉換的文件完整路徑,然后按下回車。"); path = Console.ReadLine(); if (!File.Exists(path)) Console.WriteLine("找不到文件,請確認路徑是否正確。"); else got = true; } try { string save = Path.Combine(Path.GetDirectoryName(path), DateTime.Now.ToFileTime().ToString() + ".png"); new Icon(path).ToBitmap().Save(save, ImageFormat.Png);//這里還可以轉換成其他類型圖片,詳情ImageFormat Console.WriteLine("轉換成功。"); Process.Start(Path.GetDirectoryName(save)); } catch { } Console.ReadKey(); } }