//获取模块的完整路径。
string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.vshost.exe

//获取和设置当前目录(该进程从中启动的目录)的完全限定目录
string path2 = System.Environment.CurrentDirectory;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

//获取应用程序的当前工作目录
string path3 = System.IO.Directory.GetCurrentDirectory();
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

//获取程序的基目录
string path4 = System.AppDomain.CurrentDomain.BaseDirectory;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\

//获取和设置包括该应用程序的目录的名称
string path5 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\

//获取启动了应用程序的可执行文件的路径
string path6 = System.Windows.Forms.Application.StartupPath;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release

//获取启动了应用程序的可执行文件的路径及文件名
string path7 = System.Windows.Forms.Application.ExecutablePath;
D:\work\prj\VP-VPlatform\XmlAndXsd\bin\Release\XmlAndXsd.EXE

C# 获取当前路径7种方法及输出的更多相关文章

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

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

  2. 【转】C#获取当前路径7种方法

    webformvar s = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //C盘 IIS路径 var s1 ...

  3. [No00006F]总结C#获取当前路径的各种方法

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. Spring3 MVC请求参数获取的几种方法

    Spring3 MVC请求参数获取的几种方法 一.      通过@PathVariabl获取路径中的参数 @RequestMapping(value="user/{id}/{name}&q ...

  5. Struts2获取request三种方法

    Struts2获取request三种方法   struts2里面有三种方法可以获取request,最好使用ServletRequestAware接口通过IOC机制注入Request对象. 在Actio ...

  6. Spring3 MVC请求参数获取的几种方法[转]

    Spring3 MVC请求参数获取的几种方法 Spring3 MVC请求参数获取的几种方法 一.      通过@PathVariabl获取路径中的参数 @RequestMapping(value=& ...

  7. Java反射定义、获取Class三种方法

    反射机制的定义: 在运行状态时(动态的),对于任意一个类,都能够得到这个类的所有属性和方法.  对于任意一个对象,都能够调用它的任意属性和方法. Class类是反射机制的起源,我们得到Class类对象 ...

  8. Python执行Linux cmd命令,获取输出的一种方法,输出是bytes

    import subprocess p = subprocess.Popen('df -lh', stdout=subprocess.PIPE, shell=True) print(p.stdout. ...

  9. 转载-centos网络配置(手动设置,自动获取)的2种方法

    转载地址:http://blog.51yip.com/linux/1120.html 重新启动网络配置 # service network restart 或 # /etc/init.d/networ ...

  10. 只使用处理I/O的printDigit方法,编写一种方法一输出任意的double型量(可以是负的)

    /** * Question:只使用处理IO的printDigit函数,编写一个过程以输出任意double型量(可以为负) * @author wulei * 这道题我的理解是使用最基本的System ...

随机推荐

  1. Prometheus API说明

    本文来自Prometheus官网手册 和 Prometheus简介,https://www.cnblogs.com/zhoujinyi/p/11955131.html HTTP API 在Promet ...

  2. 解决django中的跨域问题

    解决django中的跨域问题: Django项目中出现跨域问题,用第三方包django-cors-headers来解决跨域问题. 安装:pip install django-cors-headers; ...

  3. 第6课第4节_Binder系统_驱动情景分析_服务注册过程_分析

    Service_manager.c 8074 2017/6/30 首先从应用程序分析(Android) binder_loop(bs, svcmgr_handler) { readbuf[0] = B ...

  4. uniapp 上传

    fileList1: [], // uviewui ui组件<u-upload uploadText="上传打款凭证" :fileList="fileList1&q ...

  5. CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

    1.npm install -g increase-memory-limit 2.increase-memory-limit 3.重启解决

  6. jwt刷新token

    前一段时间讲过了springboot+jwt的整合,但是因为一些原因(个人比较懒)并没有更新关于token的刷新问题,今天跟别人闲聊,聊到了关于业务中token的刷新方式,所以在这里我把我知道的一些点 ...

  7. NPOI 导出 EXCEL

    1. 2.创建NPOIHelper using System;using System.Collections.Generic;using System.Data;using System.IO;us ...

  8. 39.Feign

    Java方式配置 /**局部**/ @FeignClient(value = "user-center", /*修改(user-center)feign的日志级别*/ config ...

  9. STM32中HAL库和标准库的区别

    转载自:https://www.lmonkey.com/t/RwykY8bBX STM32标准库与HAL库比较 ST为开发者提供了非常方便的开发库.到目前为止,有标准外设库(STD库).HAL库.LL ...

  10. angular 用法总结

    架构: 1.一个总页面,然后用组件组成 2.每个组件又由三个文件组成,html,css,ts,三种不同的语言放在三个不同的文件中, 3.ts是总配置文件,里面联合各个其他文件(html,css) 语法 ...