疾风萧萧

See, this isn't the finish line.The future is the finish line......
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

How to gets the path for the executable file?

Posted on 2005-09-28 15:01  疾风  阅读(506)  评论(0)    收藏  举报
1、System.AppDomain.CurrentDomain.BaseDirectory, Gets the base directory that the assembly resolver used to probe for assemblies.

2、System.Windows.Forms.Application.ExecutablePath, Gets the path for the executable file that started the application, including the executable name.

3、System.Windows.Forms.Application.StartupPath, Gets the path for the executable file that started the application, not including the executable name.

4、System.Environment.CurrentDirectory, Gets and sets the fully qualified path of the current directory; that is, the directory from which this process starts. By definition, if this process starts in the root directory of a local or network drive, the value of this property is the drive name followed by a trailing slash (for example, "C:\"). If this process starts in a subdirectory, the value of this property is the drive and subdirectory path, without a trailing slash (for example, "C:\mySubDirectory").