当前程序的所在目录
textBox1.Text = AppDomain.CurrentDomain.BaseDirectory;
返回
D:\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
http://www.cnblogs.com/SissyNong/archive/2009/09/22/1571752.html
当前程序的完整路径
textBox1.Text = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
D:\Administrator\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
获取程序文件名 (无扩展名)
textBox1.Text = System.IO.Path.GetFileNameWithoutExtension(@"C:\cmd.exe");
返回 cmd
来自为知笔记(Wiz)