C#获取当前路径的七种方法 【转载】
//1.获取模块的完整路径。
string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
//2.获取和设置当前目录(该进程从中启动的目录)的完全限定目录
string path2 = System.Environment.CurrentDirectory;
//3.获取应用程序的当前工作目录
string path3 = System.IO.Directory.GetCurrentDirectory();
//4.获取程序的基目录
string path4 = System.AppDomain.CurrentDomain.BaseDirectory;
//5.获取和设置包括该应用程序的目录的名称
string path5 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
//6.获取启动了应用程序的可执行文件的路径
string path6 = System.Windows.Forms.Application.StartupPath;
//7.获取启动了应用程序的可执行文件的路径及文件名
string path7 = System.Windows.Forms.Application.ExecutablePath;
// 输出结果
1. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.vshost.exe
2. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
3. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
4. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\
5. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\
6. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
7. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.EXE
C#获取当前路径的七种方法 【转载】的更多相关文章
- C#获取当前路径的七种方法
//1.获取模块的完整路径. string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; // ...
- C#获取当前路径的7种方法
总结C#获取当前路径的7种方法 C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName ...
- C#获取当前路径的几种方法
C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...
- 总结C#获取当前路径的7种方法
C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...
- 【转】java获取当前路径的几种方法
1.利用System.getProperty()函数获取当前路径: System.out.println(System.getProperty("user.dir"));//use ...
- java获取当前路径的几种方法
1.利用System.getProperty()函数获取当前路径: System.out.println(System.getProperty("user.dir"));//use ...
- java web 项目中获取当前路径的几种方法
1.jsp中取得路径: 以工程名为TEST为例: (1)得到包含工程名的当前页面全路径:request.getRequestURI() 结果:/TEST/test.jsp (2)得到工程名:req ...
- Java 获取路径的几种方法 - 转载
1.获取当前类所在的“项目名路径” String rootPath = System.getProperty("user.dir"); 2.获取编译文件“jar包路径”(反射) S ...
- node获取当前路径的三种方法
node提供了3种获取路径的方法 ,在当前目录下,运行node const {resolve} = require('path') console.log('__dirname : ' + __di ...
随机推荐
- SQL-40 表中新增一列
题目描述 存在actor表,包含如下列信息:CREATE TABLE IF NOT EXISTS actor (actor_id smallint(5) NOT NULL PRIMARY KEY,fi ...
- pssac plot
for multi-waveforms with different colors: R-Xmin/-Xmax/Ymin/Ymax -Ba/b, a: x delta; b:y delta -MYma ...
- git命令学习
git init:把当前目录变成Git可以管理的仓库git add file:把文件添加到仓库git commit -m "描述语句":把文件提交到仓库git status:该命令 ...
- freeswitch编译mod_av模块
需要先编译libav库 编译libav下载:git clone https://freeswitch.org/stash/scm/sd/libav.git cd libav ./configure - ...
- python day17面向对象-组合
组合: 给一个类的对象封装一个属性,这个属性是另一个类的对象. class GameRole: def __init__(self, name, ad, hp): self.name = name s ...
- 获取Map的key和value的两种方法
//使用迭代器,获取key; /*Iterator<String> iter = map.keySet().iterator(); while(iter.hasNext()){ Strin ...
- 训练 の Bessie的体重问题
Bessie的体重问题 题目描述 Bessie像她的诸多姊妹一样,因为从Farmer John的草地吃了太多美味的草而长出了太多的赘肉.所以FJ将她置于一个及其严格的节食计划之中.她每天不能吃多过H ...
- POJ2777-Count Color (线段树)
题目传送门:http://poj.org/problem?id=2777 Count Color Time Limit: 1000MS Memory Limit: 65536K Total Sub ...
- HDU1754-I Hate It (线段树)
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1754 I Hate It Time Limit: 9000/3000 MS (Java/Others ...
- 认识MySQL中的索引
一.什么是索引 索引是一种将数据库中单列或者多列的值进行排序的结构,引用索引可以大大提高索引的速度. 二.索引的优缺点 优点:整体上提高查询的速度,提高系统的整体性能. 缺点:创建索引和维护索引都需要 ...