概述
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#获取执行文件所在的盘符所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复