C# 获取当前路径7种方法及输出
//获取模块的完整路径。
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种方法及输出的更多相关文章
- C# 获取当前路径7种方法
//获取模块的完整路径. string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //获取 ...
- 【转】C#获取当前路径7种方法
webformvar s = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //C盘 IIS路径 var s1 ...
- [No00006F]总结C#获取当前路径的各种方法
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Spring3 MVC请求参数获取的几种方法
Spring3 MVC请求参数获取的几种方法 一. 通过@PathVariabl获取路径中的参数 @RequestMapping(value="user/{id}/{name}&q ...
- Struts2获取request三种方法
Struts2获取request三种方法 struts2里面有三种方法可以获取request,最好使用ServletRequestAware接口通过IOC机制注入Request对象. 在Actio ...
- Spring3 MVC请求参数获取的几种方法[转]
Spring3 MVC请求参数获取的几种方法 Spring3 MVC请求参数获取的几种方法 一. 通过@PathVariabl获取路径中的参数 @RequestMapping(value=& ...
- Java反射定义、获取Class三种方法
反射机制的定义: 在运行状态时(动态的),对于任意一个类,都能够得到这个类的所有属性和方法. 对于任意一个对象,都能够调用它的任意属性和方法. Class类是反射机制的起源,我们得到Class类对象 ...
- Python执行Linux cmd命令,获取输出的一种方法,输出是bytes
import subprocess p = subprocess.Popen('df -lh', stdout=subprocess.PIPE, shell=True) print(p.stdout. ...
- 转载-centos网络配置(手动设置,自动获取)的2种方法
转载地址:http://blog.51yip.com/linux/1120.html 重新启动网络配置 # service network restart 或 # /etc/init.d/networ ...
- 只使用处理I/O的printDigit方法,编写一种方法一输出任意的double型量(可以是负的)
/** * Question:只使用处理IO的printDigit函数,编写一个过程以输出任意double型量(可以为负) * @author wulei * 这道题我的理解是使用最基本的System ...
随机推荐
- 关于sql json数据的处理
$resultProductPrice = DB::update("update lev_product_price set detail=json_set(detail,'$.颜色','红 ...
- Windows 10更新报错 0x8000ffff
Windows 10更新报错 0x8000ffff - Microsoft Community 那么您可用 "Windows 10 覆盖安装" 来修复,可参考以下步伐,连接里有视频 ...
- Posggresql插件Multicorn安装问题总结
根据官网https://multicorn.readthedocs.io/en/latest/installation.html的安装指南下载安装,关键信息: Postgresql 9.1+ Post ...
- 读取本地xml或json等本地文件报错Failed to load file:///D:/xml/test.xml: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
问题如上图: 原因及解析:在浏览器打开本地的html文件, 上面proxy中的url获取的就是一个本地文件, 协议是file://,如果是在服务器启动的话,则使用的是http或者https协议.出于安 ...
- ES6新增运算符 ?? || &&
运算符(?? || &&) && 与运算符 &&左边表达式为真时执行右边表达式 let a = true let b = 0 a && ...
- vue引入swiper的报错以及swiper在vue中的交互事件处理
安装遇到找不到 css的问题,百度查了一些帖子也不行,可能是swiper 升级6.0后的一些变化导致 安装成功的帖子:转载于:https://www.jianshu.com/p/0150d2ee109 ...
- CSS3滤镜属性filter让网页变黑白
很多特殊的时候,我们向英雄们致敬,在互联网上最常见的方式就是整个网页变黑白,今天逛某博客收集一段代码,用于网页整体变黑白,用css3滤镜属性filter让网页马上变黑白,一行代码就搞定. 在你的css ...
- Jetbrains Rider 2020.1.4 安装教程
话说Visual Studio 是世界第亿的IDE没人反对吧!!! 用惯了VS之后就不得不吐槽他的运行效率,五步一停十步一卡的岁月也不得不熬过来了,然而!!! 看到了视频里别人使用了Rider,集成了 ...
- MSSQL 查看数据库所有的触发器
SELECT object_name(a.parent_obj) as [表名] ,a.name as [触发器名称] ,(case when b.is_disabled=0 then '启用' el ...
- Windows 进程间通信 共享内存
向内存中写数据 1 // SharedMemorySample_write_main.cpp 2 #include <SDKDDKVer.h> 3 #include <Windows ...