我是靠谱客的博主 怡然金鱼,最近开发中收集的这篇文章主要介绍c#获取执行文件所在的盘符,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1、System.Windows.Forms.Application.StartupPath;
2、System.AppDomain.CurrentDomain.BaseDirectory;
3、System.Environment.CurrentDirectory;

以上bai三du种zhi方法都可以获取程dao序根目录,4102
string programPath=以上三者选一。
string volume = programPath.Substring(0, System.Windows.Forms.Application.StartupPath.IndexOf(’:’));
MessageBox.Show(volume);

例如:1653
string volume = System.Windows.Forms.Application.StartupPath.Substring(0, System.Windows.Forms.Application.StartupPath.IndexOf(’:’));
MessageBox.Show(volume);

最后

以上就是怡然金鱼为你收集整理的c#获取执行文件所在的盘符的全部内容,希望文章能够帮你解决c#获取执行文件所在的盘符所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部