C#中得到程序当前工作目录和执行目录的一些方法
2012-08-22 10:45
633 查看
整理记录,以备自己查询用。
1、获取模块的完整路径
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
如:E:\WindowsFormsApplication\bin\Release(Debug)\WindowsFormsApplication.vshost.exe
System.Windows.Forms.Application.ExecutablePath
如:E:\WindowsFormsApplication\bin\Release(Debug)\WindowsFormsApplication.EXE
2、获取当前目录的完全限定目录(应用程序的可执行文件的路径)
System.Environment.CurrentDirectory
如:E:\WindowsFormsApplication\bin\Release(Debug)
System.Windows.Forms.Application.StartupPath
如:E:\WindowsFormsApplication\bin\Release(Debug)
System.IO.Directory.GetCurrentDirectory()
如:E:\WindowsFormsApplication\bin\Release(Debug)
3、获取程序的基目录
System.AppDomain.CurrentDomain.BaseDirectory
如:E:\WindowsFormsApplication\bin\Release(Debug)\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
如:E:\WindowsFormsApplication\bin\Release(Debug)\
1、获取模块的完整路径
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
如:E:\WindowsFormsApplication\bin\Release(Debug)\WindowsFormsApplication.vshost.exe
System.Windows.Forms.Application.ExecutablePath
如:E:\WindowsFormsApplication\bin\Release(Debug)\WindowsFormsApplication.EXE
2、获取当前目录的完全限定目录(应用程序的可执行文件的路径)
System.Environment.CurrentDirectory
如:E:\WindowsFormsApplication\bin\Release(Debug)
System.Windows.Forms.Application.StartupPath
如:E:\WindowsFormsApplication\bin\Release(Debug)
System.IO.Directory.GetCurrentDirectory()
如:E:\WindowsFormsApplication\bin\Release(Debug)
3、获取程序的基目录
System.AppDomain.CurrentDomain.BaseDirectory
如:E:\WindowsFormsApplication\bin\Release(Debug)\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
如:E:\WindowsFormsApplication\bin\Release(Debug)\
相关文章推荐
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录与执行目录的一些方法
- ▲【C#中得到程序当前工作目录和执行目录的一些方法】▲
- [转]C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- 总结C#中得到程序当前工作目录和执行目录的一些方法
- 【收藏】C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法
- C#中得到程序当前工作目录和执行目录的一些方法