首页 技术 正文
技术 2022年11月16日
0 收藏 920 点赞 4,574 浏览 955 个字

//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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,557
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898