直接双击执行 D:\test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test1.exe
System.Environment.CurrentDirectory D:\
System.IO.Directory.GetCurrentDirectory()  D:\
System.AppDomain.CurrentDomain.BaseDirectory D:\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\
System.Windows.Forms.Application.StartupPath D:\
System.Windows.Forms.Application.ExecutablePath D:\Test1.exe

命令行执行,当前路径为C:\,执行D:\test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName d:\Test1.exe
System.Environment.CurrentDirectory C:\
System.IO.Directory.GetCurrentDirectory()  C:\
System.AppDomain.CurrentDomain.BaseDirectory d:\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase d:\
System.Windows.Forms.Application.StartupPath d:\
System.Windows.Forms.Application.ExecutablePath d:\Test1.exe

直接双击执行 D:\Test\Test1.exe
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test\Test1.exe
System.Environment.CurrentDirectory D:\Test
System.IO.Directory.GetCurrentDirectory()  D:\Test
System.AppDomain.CurrentDomain.BaseDirectory D:\Test\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\Test\
System.Windows.Forms.Application.StartupPath D:\Test
System.Windows.Forms.Application.ExecutablePath D:\Test\Test1.exe

在F:\Test\建立快捷方式,设置起始位置为F:\Test,然后双击执行
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName D:\Test\Test1.exe
System.Environment.CurrentDirectory F:\Test
System.IO.Directory.GetCurrentDirectory()  F:\Test
System.AppDomain.CurrentDomain.BaseDirectory D:\Test\
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase D:\Test\
System.Windows.Forms.Application.StartupPath D:\Test
System.Windows.Forms.Application.ExecutablePath D:\Test\Test1.exe

C# Winform App 获取当前路径的更多相关文章

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

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

  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#获取当前路径的几种方法

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

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

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

  6. C#: 获取当前路径不要用Environment.CurrentDirectory

    网上大把文章写到C#获取当前路径的方法如下: // 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. Syste ...

  7. C#获取当前路径的方法如下

    1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. System.Environm ...

  8. C# 获取当前路径方法(转)

    C# 获取当前路径方法 //获取包含清单的已加载文件的路径或 UNC 位置. public static string sApplicationPath = Assembly.GetExecuting ...

  9. 【转】C#(ASP.Net)获取当前路径的方法集合

    转自:http://www.gaobo.info/read.php/660.htm //获取当前进程的完整路径,包含文件名(进程名). string str = this.GetType().Asse ...

随机推荐

  1. Robot Framework的安装、更新与卸载

    Robot Framework的安装.更新与卸载 一,安装RF前的准备 一般就三种执行环境 Python, Jython (JVM) 和 IronPython (.NET): 安装python: #T ...

  2. 1.4 js基础

    1.eval(字符串),将字符串变成可执行的语句.        太强大了,太危险了 .目前不要去使用.        注入攻击   2.作用域[起作用的范围]         全局变量:声明在函数外 ...

  3. linux diff(differential) 命令

    功能说明:比较文件的差异. 语法:diff [OPTION]... FILES 实例: diff -ur temp1 temp2 diff -ur temp1 temp2 > temp.diff ...

  4. 【极客学院-idea教程】

    极客学院idea教程: http://whudoc.qiniudn.com/2016/IntelliJ-IDEA-Tutorial/index.html

  5. SQL 工具系列二

    1.RedGate 工具 SQL Prompt 脚步智能提示工具 脚步提示工具,轻松写入,编辑和探索SQL: SQL Prompt能根据数据库的对象名称,语法和用户编写的代码片段自动进行检索,智能的为 ...

  6. PHP学习3——数组

    主要内容: 简介 常用的方法 循环遍历数组 PHP预定义数组 数组的处理函数 数组 PHP由于是弱类型的语言,他的变量类型是可以自由变换的,他的数组很自由,长度是可以动态增加的. 他的索引默认为数字0 ...

  7. MySql 学习(一)

    入门使用 show databases; //假设存在seckill 数据库 use seckill; //查看所有表 show tables; //查看某个表的字段,例如存在 student 表 d ...

  8. sql server用户密码批量MD5加密

    nodejs自带加密模块md5加密: var crypto = require('crypto'); function cryptoMD5(content){ var md5 = crypto.cre ...

  9. canal —— 阿里巴巴mysql数据库binlog的增量订阅&消费组件

    阿里巴巴mysql数据库binlog的增量订阅&消费组件canal ,转载自  https://github.com/alibaba/canal 最新更新 canal QQ讨论群已经建立,群号 ...

  10. thinkphp下判断状态值语法

    在thinkphp框架下我们经常会用到状态值的判断:但是这样写会引起语法错误. <div> <if condition="{$res.status} eq '0'" ...