Winform获取应用程序的当前路径
//获取当前进程的完整路径,包含文件名(进程名)。
string str = this.GetType().Assembly.Location;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取新的Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。
string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。
string str = System.Environment.CurrentDirectory;
result: X:\xxx\xxx (.exe文件所在的目录)
//获取当前 Thread 的当前应用程序域的基目录,它由程序集冲突解决程序用来探测程序集。
string str = System.AppDomain.CurrentDomain.BaseDirectory;
result: X:\xxx\xxx\ (.exe文件所在的目录+"\")
//获取和设置包含该应用程序的目录的名称。
string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
result: X:\xxx\xxx\ (.exe文件所在的目录+"\")
//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
string str = System.Windows.Forms.Application.StartupPath;
result: X:\xxx\xxx (.exe文件所在的目录)
//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。
string str = System.Windows.Forms.Application.ExecutablePath;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)
//获取应用程序的当前工作目录(不可靠)。
string str = System.IO.Directory.GetCurrentDirectory();
result: X:\xxx\xxx (.exe文件所在的目录)
Winform获取应用程序的当前路径的更多相关文章
- Winform获取应用程序的当前路径的方法集合(转)
Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏 //获取当前进程的完整路径,包含文件名(进程名). string str = this.GetType().Assembly.Loc ...
- winform 获取当前程序运行根目录
// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.G ...
- [转载]c# winform 获取当前程序运行根目录
// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.G ...
- Winform获取当前程序名称或路径
以下几种方法获取当前程序名称或路径: // 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. // 获 ...
- c# winform 获取当前程序运行根目录
1 // 获取程序的基目录. 2 System.AppDomain.CurrentDomain.BaseDirectory 3 4 5 // 获取模块的完整路径. 6 System.Diagnosti ...
- c# winform 获取当前程序运行根目录,winform 打开程序运行的文件夹
// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.G ...
- VB.NET WinForm获取运行程序用户名
一个程序也许会被多个用户运行,如下: 那在VB.NET的WinForm环境下,怎样获取User Name呢?可从下面的方法: 代码: Public Shared Function GetProcess ...
- C# WinForm获取当前路径汇总
摘自:http://greatverve.cnblogs.com/archive/2011/12/15/winform-path.html Winform获取应用程序的当前路径的方法集合,具体如下,值 ...
- (转)C# WinForm获取当前路径汇总
Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏本文来源 :http://www.cnblogs.com/greatverve/archive/2011/12/15/winform- ...
随机推荐
- 【转】Android中设置TextView的颜色setTextColor--代码中设置字体颜色
原文网址:http://www.cnblogs.com/myphoebe/archive/2012/01/06/2314728.html android中设置TextView的颜色有方法setText ...
- HDU 5949 Relative atomic mass 【模拟】 (2016ACM/ICPC亚洲区沈阳站)
Relative atomic mass Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Oth ...
- WebTable 扩展
# coding:utf-8 """ 页面 table处理 """ from selenium import webdriver from ...
- JavaScript高级程序设计37.pdf
用DOM范围实现简单选择 selectNode()和selectNodeContents()它们都接收一个DOM节点参数,然后使用该节点中的信息来填充范围,其中selectNode()方法选择整个节点 ...
- [转]Angular, Backbone, or Ember: Which is Best for your Build?
In order to choose which framework is right for your build, we've asked four important questions of ...
- MySQL数据库MyISAM和InnoDB存储引擎的比较(转)
MySQL有多种存储引擎,MyISAM和InnoDB是其中常用的两种.这里介绍关于这两种引擎的一些基本概念(非深入介绍). MyISAM是MySQL的默认存储引擎,基于传统的ISAM类型,支持全文搜索 ...
- resin 4.0数据源的配置
在resin 的conf 文件下有resin.xml 我们在这里能够配置数据源以及配置项目 一.配置多个数据源,多个项目共享这些数据源.也就是这些数据源配置在<host> </ ...
- android 60 发送短信
import android.os.Bundle; import android.app.Activity; import android.telephony.SmsManager; import a ...
- lua function
This is the main reference for the World of Warcraft Lua Runtime. Note that these are mostly standar ...
- 基于HBase0.98.13搭建HBase HA分布式集群
在hadoop2.6.0分布式集群上搭建hbase ha分布式集群.搭建hadoop2.6.0分布式集群,请参考“基于hadoop2.6.0搭建5个节点的分布式集群”.下面我们开始啦 1.规划 1.主 ...