//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; // 输出结果
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.vshost.exe
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release
. D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.EXE

C#获取当前路径的七种方法的更多相关文章

  1. C#获取当前路径的七种方法 【转载】

    //1.获取模块的完整路径. string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; // ...

  2. C#获取当前路径的7种方法

    总结C#获取当前路径的7种方法 C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName ...

  3. C#获取当前路径的几种方法

    C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...

  4. 总结C#获取当前路径的7种方法

    C#获取当前路径的方法如下: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...

  5. 【转】java获取当前路径的几种方法

    1.利用System.getProperty()函数获取当前路径: System.out.println(System.getProperty("user.dir"));//use ...

  6. java获取当前路径的几种方法

    1.利用System.getProperty()函数获取当前路径: System.out.println(System.getProperty("user.dir"));//use ...

  7. java web 项目中获取当前路径的几种方法

    1.jsp中取得路径:   以工程名为TEST为例: (1)得到包含工程名的当前页面全路径:request.getRequestURI() 结果:/TEST/test.jsp (2)得到工程名:req ...

  8. node获取当前路径的三种方法

    node提供了3种获取路径的方法  ,在当前目录下,运行node const {resolve} = require('path') console.log('__dirname : ' + __di ...

  9. C#中怎样获取当前路径的几种方法

    String apppath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase; //获取整个文件路径名 a ...

随机推荐

  1. commons-lang3工具类学习(二)

    三.BooleanUtils 布尔工具类 and(boolean... array) 逻辑与 BooleanUtils.and(true, true)         = true    Boolea ...

  2. learning makefile = and :=

  3. Debian/Ubuntu/Deepin下AndroidStudio2/3打开AVD模拟器无反应

    Debian系AS无法启动模拟器 问题描述 早在半年前将开发环境从windows迁移到了Linux:当时用的是Debian系统,也是在安装完成AndroidStudio之后无法开启模拟器,也没出现什么 ...

  4. python读取与写入csv,txt格式文件

    python读取与写入csv,txt格式文件 在数据分析中经常需要从csv格式的文件中存取数据以及将数据写书到csv文件中.将csv文件中的数据直接读取为dict类型和DataFrame是非常方便也很 ...

  5. nginx 支持的命令行参数

    Command-line parameters 命令行参数 nginx supports the following command-line parameters: nginx支持以下命令行参数 - ...

  6. 高级数据类型--字典(dict)

    一.字典介绍 dict(字典) 是 除列表以外 Python 之中 最灵活 的数据类型.字典同样可以用来 存储多个数据,通常用于存储 描述一个 物体 的相关信息 和列表的区别: 列表 是 有序 的对象 ...

  7. L335 Nasa’s Twin Study Reveals Effects of Time Spent in Space on the Human Body

    What exactly happens to a human body in space? Despite decades of astronauts going on space missions ...

  8. javascript 统计字符串中每个字符出现的次数

    var str = "abdcadfasfdbadfafdasdfasyweroweurowqrewqrwqrebwqrewqrejwq;;"; // console.log(nu ...

  9. Java学习笔记42(数据库连接池 druid连接池)

    druid连接池: 是阿里的连接池,druid的稳定性及效率都很高,目前用的比较广,所以建议开发过程中尽量用druid连接池(支持国产最重要) druid连接池也需要配置文件,配置文件必须是prope ...

  10. C#生成PDF文件流

    1.设置字体 static BaseFont FontBase = BaseFont.CreateFont("C:\\WINDOWS\\FONTS\\STSONG.TTF", Ba ...