获取程序的当前目录
String
strAppDir = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetName().CodeBase);
String strFullPathToMyFile = Path.Combine(strAppDir, "fileName.txt");
Console.WriteLine(String.Format("Path to the application is: '{0}'." +
"Full path to the file in the application folder is: '{1}'",
strAppDir, strFullPathToMyFile));
即使是骗,也要勤学苦练。