如何获取当前目录 [英] How to get the current directory
本文介绍了如何获取当前目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我是wpf的新手.我曾经访问过当前应用程序目录"Application.StartupPath"
我正在使用WPF,但找不到任何方法来访问应用程序目录.
我可以使用,
访问当前exe文件的路径.
字符串exePath = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0] .FullyQualifiedName;"
如何访问此路径的目录.
谢谢
Hi Everybody,
I am new at wpf. I used to accesses the current application directory "Application.StartupPath"
I am using WPF and not finding any way how to access the application directory.
I am able to access the path of the current exe file using ,
"String exePath = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;"
How can I access the directory of this path.
Thank You
推荐答案
我在我写的博客文章 ^ ].我希望它(及其后面的讨论)有用.
I answered this very question in a blog post I wrote here[^]. I hope that it (and the discussions following it) are useful.
一些选项-
1)System.Windows.Forms.Application.StartupPath
2)System.IO.Directory.GetCurrentDirectory()
3)字符串appStartPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
干杯
Some options -
1) System.Windows.Forms.Application.StartupPath
2) System.IO.Directory.GetCurrentDirectory()
3) String appStartPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
Cheers
这篇关于如何获取当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文