[C#] 取得執行檔所在目錄的方法
方法一:
System.Reflection.Assembly a =
System.Reflection.Assembly.GetEntryAssembly();
string baseDir = System.IO.Path.GetDirectoryName(a.Location);
方法二:
string baseDir = Application.ExecutablePath; baseDir = baseDir.Remove( baseDir.LastIndexOf( '\\')); // 去掉執行檔部份參考資料:http://bytes.com/topic/c-sharp/answers/252592-how-can-i-get-my-exe-path
此文章所屬分類:
資訊技術 - Computer Science沒有人引用這篇文章
本篇文章的引用網址:http://www.cclo.idv.tw/cgi-bin/mtos_4.1/mt-tb.cgi/480

留下您的意見