winform 获取当前程序运行根目录

 1  // 获取程序的基目录。
 2   System.AppDomain.CurrentDomain.BaseDirectory
 3  // 获取模块的完整路径。
 4   System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
 5  // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。
 6  System.Environment.CurrentDirectory
 7 // 获取应用程序的当前工作目录。
 8  System.IO.Directory.GetCurrentDirectory()
 9 // 获取和设置包括该应用程序的目录的名称。
10  System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
11 // 获取启动了应用程序的可执行文件的路径。
12  System.Windows.Forms.Application.StartupPath
13 // 获取启动了应用程序的可执行文件的路径及文件名
14 System.Windows.Forms.Application.ExecutablePath

 

posted @ 2016-10-24 20:07  saygoodby  Views(345)  Comments(0Edit  收藏  举报