C#应用程序获取自身路径和文件名示例

在ConsoleApplication和WindowsFormsApplication都能使用:

//获取应用程序自身路径和文件名
string filePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;

只能在WindowsFormsApplication使用:

//获取应用程序自身路径和文件名
string filePath = System.Windows.Forms.Application.ExecutablePath;


评论: 0 | 引用: 0 | 查看次数: 2974
发表评论
登录后再发表评论!