C# 获取当前exe所在路径

C# 获取当前路径7种方法 1 //获取模块的完整路径。 2 string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; 3 //获取和设置当前目录(该进程从中启动的目录)的完全限定目录 4 string path2 = System.Environment.CurrentDirect... 阅读详情

//获取当前进程的完整路径,包含文件名(进程名)。
string str = this.GetType().Assembly.Location;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)

//获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。
string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)

//获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。
string str = System.Environment.CurrentDirectory;
result: X:\xxx\xxx (.exe文件所在的目录)

//获取当前 Thread 的当前应用程序域的基目录,它由程序集冲突解决程序用来探测程序集。
string str = System.AppDomain.CurrentDomain.BaseDirectory;
result: X:\xxx\xxx\ (.exe文件所在的目录+"")

//获取和设置包含该应用程序的目录的名称。(推荐)
string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
result: X:\xxx\xxx\ (.exe文件所在的目录+"")

//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。
string str = System.Windows.Forms.Application.StartupPath;
result: X:\xxx\xxx (.exe文件所在的目录)

//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称。
string str = System.Windows.Forms.Application.ExecutablePath;
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)

//获取应用程序的当前工作目录(不可靠)。
string str = System.IO.Directory.GetCurrentDirectory();
result: X:\xxx\xxx (.exe文件所在的目录)

C#(WPF)程序将Debug中的.exe文件放入注册表中启动,获取错误的当前路径--解决方案 编写的程序需要开机运行,又不想进入win7的桌面。这样可以通过修改注册表,把原来的explorer.exe换成需要启动的软件。 注意,比如.exe文件存在于D盘的Debug文件夹中,则用 D:\\Debug\\MySoftWare.exe替换 explorer.exe。 但是一定要注意的是,尽量不要有中文文件夹。      但是在该程序代码中需要获取当前路径,即在程序初始化的 阅读详情

相关推荐

C#实现得到本地运行的EXE的路径(附完整源代码)

C#实现得到本地运行的EXE的路径(附完整源代码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 897

C#获取当前程序运行路径的方法集合

//获取当前进程的完整路径,包含文件名(进程名)。 string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。 string str = System.Diagno...

Advance Steel二次开发 779

C++获取exe所在的路径

【代码】C++获取exe所在的路径。

我不是码农的博客~~~ 403

C#获取当前程序所在路径的各种方法

C#获取当前程序所在路径的各种方法

BeanGo的博客 8669

基于Labview2012实现的双通道信号源(课程设计)

双通道信号源,产生8种波形,能进行调制,带信号幅度与频率扫描功能,波形可存储与导入

qq_40617082的博客 1464

Windows 10/11下R与RStudio最新版安装避坑指南(含镜像加速配置)

本文提供了Windows 10/11系统下R与RStudio最新版的详细安装指南,包含镜像加速配置和常见问题解决方案。通过分步教程帮助用户避开安装陷阱,优化开发环境设置,特别适合国内用户快速搭建高效的数据分析平台。

weixin_29065959的博客 1023

C# 关于文件路径的获取及当前exe所在路径的获取

C#获取exe当前路径的方法集合: string str = this .GetType().Assembly.Location;// 获取当前进程的完整路径,包含文件名(进程名) result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录 + .exe文件名) string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;// 获取新的 Process 组件并将其与当前活动

weixin_45499836的博客 2463

全球第一开源云ERP Odoo操作手册 模块安装和界面汉化指南

Odoo 的功能包含在不同的模块中, 刚创建的数据库除 Odoo 的核心模块外, 其它模块并没有被安装到系统中,你可以根据需要安装它们。本节将介绍安装模块和界面汉化的相关知识。

weixin_44793763的博客 2080

Unity(C#)获取当前运行exe路径的方法

转载于: Unity(C#)获取当前运行exe路径的方法 System.Environment.CurrentDirectory和System.AppDomain.CurrentDomain.BaseDirectory在Unity中有效,其他未测。 //获取当前进程的完整路径,包含文件名(进程名)。 string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的 P

weixin_43149049的博客 2904

博士申请-考核制经验分享(2)——个人简历

申博过程中一般在联系导师时就将个人简历作为邮件附件,有些学校也会在提交材料或者复试阶段提交个人简历。

weixin_49282401的博客 5557

基于DWA算法的机器人动态避障技术实现及matlab代码

DWA算法是一种基于轨迹的运动规划算法,其核心思想是:在机器人当前位置及速度的基础上,结合机器人感知到的环境信息,生成一组合法的速度指令,然后从这组速度指令中选取代价最小的速度指令作为机器人的下一步操作。下面,我们将通过一个实例来演示基于DWA算法的机器人动态避障技术实现。假设机器人在一个宽敞的场地内行驶,但场地内有一些固定障碍物和移动障碍物,机器人需要避开这些障碍物,并在场地内自由移动。本文给出了一种基于DWA算法的机器人动态避障技术实现及相应的matlab代码,读者可以根据自身需求进行修改和调整。

uote_e的博客 1008

c# winform获取当前路径exe程序的版本号

通常软件自动更新时,需要比较新版本与旧版本的版本号,如果新文件的版本号比旧文件高,就替换旧文件。(版本号一般可以在Visual Studio的程序信息里定义)  如何取得当前exe程序的版本号呢?可以用以下方式实现。 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4

普羅●米修斯 ——— HelloWorld 3221

一文读懂OpenClaw:核心组件与工作原理深度解析

Agent核心:负责理解意图、规划任务、协调执行消息系统:统一的消息格式,实现组件间解耦工具注册表:可扩展的工具系统,支持自定义工具模型适配层:多模型支持,统一API接口安全机制:沙箱隔离、权限确认、操作审计性能优化:并行执行、智能缓存、增量更新理解这些核心组件和工作原理,将帮助你更好地使用OpenClaw,也为后续开发自定义扩展打下坚实基础。在下一篇文章中,我们将详细介绍OpenClaw的界面操作,包括命令行与交互模式的各种技巧。

gaoxiang_120的专栏 838

A23:Unity(C#)获取当前运行exe路径的方法

System.Environment.CurrentDirectory和System.AppDomain.CurrentDomain.BaseDirectory在Unity中有效,其他未测。 //获取当前进程的完整路径,包含文件名(进程名)。 string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名) //获取新的 Process 组件并将其与当前活动的进程关联...

. 1103

医疗数据采集:Python爬虫爬取医学文献与药品信息(2026合规与伦理版)

医疗数据采集不同于爬取新闻或房价,它直接关系到人的生命健康和法律底线。技术层面:优先使用官方 API (PubMed E-utilities, BioThings),避免解析复杂HTML。法律层面:严守“不碰隐私、不破付费、不传谣言”三条红线。伦理层面:保持对生命的敬畏,确保数据的准确性和用途的正当性。在2026年,一个优秀的医疗数据工程师,不是那个能爬取最多数据的人,而是那个能在合规框架下,利用公开数据解决真实医疗问题的人。请务必珍视您的职业生涯和法律责任,切勿以身试法。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 291

基于图像形态学处理的交通灯检测识别matlab仿真

图像形态学处理是基于数学形态学的理论,利用结构元素(如矩形、圆形等)对图像进行处理,通过将结构元素与图像进行特定的逻辑运算,来提取图像中的目标特征、去除噪声、改善图像质量等。在交通灯检测识别中,主要利用交通灯的颜色、形状等特征,通过形态学操作突出这些特征,抑制背景和噪声干扰,从而实现对交通灯的准确检测和识别。图像采集与预处理采集:通过安装在车辆或道路上的摄像头获取交通场景图像。灰度化:将彩色图像转换为灰度图像,减少数据量,便于后续处理。

平时工作较为繁忙,私信消息一般晚上回复,谢谢大家~~ 161

C#获取当前运行exe路径的方法

System.Environment.CurrentDirectory和System.AppDomain.CurrentDomain.BaseDirectory在Unity中有效,其他未测。 //获取当前进程的完整路径,包含文件名(进程名)。 string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.ex...

南宫铭的博客 524

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Unity,C#获取当前进程(或者说是运行EXE)路径所在方法

Unity,C#获取当前进程(或者说是运行EXE)路径所在方法 以下方法,亲测,System.Environment.CurrentDirectory和System.AppDomain.CurrentDomain.BaseDirectory在Unity中有效,其他未测。 //获取当前进程的完整路径,包含文件名(进程名)。 string str = this.GetType().Assembly.Location; result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名

谁为拨动染血的时空苍穹 851

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

C# 获取当前执行程序路径 获取路径 上上层目录 上层目录

System.Environment.CurrentDirectory

Dxg团队 1807

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

A19:Unity(C#)获取当前运行exe路径的方法

转载,原文地址:http://www.cnblogs.com/cocoulong/archive/2010/01/30/1660119.html 以下方法,亲测,System.Environment.CurrentDirectory和System.AppDomain.CurrentDomain.BaseDirectory在Unity中有效,其他未测。 //获取当前进程的完整路径,包...

. 1069

C#中获取程序当前路径的方法

C#中获取程序当前路径的方法 string str1 =Process.GetCurrentProcess().MainModule.FileName;//获得当前执行的exe的文件名。 string str2=Environment.CurrentDirectory;//获取和设置当前目录的完全限定路径。 string str3=Directory.GetCurrentDire...

weixin_33705053的博客 77

C#获取当前程序路径

C#中获取程序当前路径的7种常用的方法 C#中获取程序当前路径的7种最常用的方法 string str1 =Process.GetCurrentProcess().MainModule.FileName;//可获得当前执行的exe的文件名。 string str2=Environment.CurrentDirectory;//获取和设置当前目录(即该进程从中启动的目...

davidjiao1988的博客 1909

C#获取当前应用程序所在的路径

1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName     获取模块的完整路径,可获得当前执行的exe的文件名。 2. System.Environment.CurrentDirectory       获取和设置当前目录(该进程从中启动的目录)的完全限定目录。 如果该进程在本地或网络驱动器的根目录中启动

wl05031的专栏 665
下一篇: C# FiddlerCore 抓取
GoDeeper
博客等级 码龄12年 928粉丝 1原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值