码迷,mamicode.com
首页 > 移动开发 > 详细

C# Winform App 获取当前路径

时间:2015-01-28 19:19:38      阅读:490      评论:0      收藏:0      [点我收藏+]

标签:

直接双击执行 D:\test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test1.exe
System.Environment.CurrentDirectory D:\
System.IO.Directory.GetCurrentDirectory()  D:\
System.AppDomain.CurrentDomain.BaseDirectory D:\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\
System.Windows.Forms.Application.StartupPath D:\
System.Windows.Forms.Application.ExecutablePath D:\Test1.exe


命令行执行,当前路径为C:\,执行D:\test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName d:\Test1.exe
System.Environment.CurrentDirectory C:\
System.IO.Directory.GetCurrentDirectory()  C:\
System.AppDomain.CurrentDomain.BaseDirectory d:\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase d:\
System.Windows.Forms.Application.StartupPath d:\
System.Windows.Forms.Application.ExecutablePath d:\Test1.exe


直接双击执行 D:\Test\Test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test\Test1.exe
System.Environment.CurrentDirectory D:\Test
System.IO.Directory.GetCurrentDirectory()  D:\Test
System.AppDomain.CurrentDomain.BaseDirectory D:\Test\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\Test\
System.Windows.Forms.Application.StartupPath D:\Test
System.Windows.Forms.Application.ExecutablePath D:\Test\Test1.exe

在F:\Test\建立快捷方式,设置起始位置为F:\Test,然后双击执行
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test\Test1.exe
System.Environment.CurrentDirectory F:\Test
System.IO.Directory.GetCurrentDirectory()  F:\Test
System.AppDomain.CurrentDomain.BaseDirectory D:\Test\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\Test\
System.Windows.Forms.Application.StartupPath D:\Test
System.Windows.Forms.Application.ExecutablePath D:\Test\Test1.exe

C# Winform App 获取当前路径

标签:

原文地址:http://www.cnblogs.com/StevenLi/p/4256393.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!