Quantcast
Channel: 木子屋 - Win编程
Viewing all articles
Browse latest Browse all 206

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

$
0
0
在ConsoleApplication和WindowsFormsApplication都能使用:

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

只能在WindowsFormsApplication使用:

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

Viewing all articles
Browse latest Browse all 206

Trending Articles