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

 

 1  1 // 获取程序的基目录。
2 2 System.AppDomain.CurrentDomain.BaseDirectory
3 3
4 4
5 5 // 获取模块的完整路径。
6 6 System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
7 7
8 8
9 9 // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。
10 10 System.Environment.CurrentDirectory
11 11
12 12
13 13 // 获取应用程序的当前工作目录。
14 14 System.IO.Directory.GetCurrentDirectory()
15 15
16 16
17 17 // 获取和设置包括该应用程序的目录的名称。
18 18 System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
19 19
20 20
21 21 // 获取启动了应用程序的可执行文件的路径。
22 22 System.Windows.Forms.Application.StartupPath
23 23
24 24
25 25 // 获取启动了应用程序的可执行文件的路径及文件名
26 26 System.Windows.Forms.Application.ExecutablePath
posted on 2011-11-16 15:25  小谈  阅读(17102)  评论(0编辑  收藏  举报