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#获取执行文件所在内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复