2014-01-06 34 views
-4

我们怎样才能找出正在运行的应用程序的文件系统位置?如何确定用于启动当前应用程序的路径?

+0

application.info ... –

+0

您是否在寻找['目录.GetCurrentDirectory'](http://msdn.microsoft.com/en-us/library/system.io.directory.getcurrentdirectory(v = vs.110).aspx) – Harrison

+1

这取决于应用程序的类型:console,winforms,wpf,asp.net,windows phone,...我希望你认识到,用C#标记你的问题的事实在这种情况下是毫无意义的。 –

回答

2

如果您在控制台的操作使用此

AppDomain.CurrentDomain.BaseDirectory

或Windows窗体上使用

Application.StartupPath 
+0

我使用WPF。 –

+3

@TravisBanger:你的问题没有给出任何迹象。你应该添加适当的标签。专家提示:添加WPF引用后,您的问题是[此问题]的副本(http://stackoverflow.com/questions/938421/getting-the-applications-directory-from-a-wpf-application)和[那一个](http://stackoverflow.com/questions/10926506/how-to-get-current-application-path-in-wpf)。 –

0

Environment.GetCommandLineArgs()[0];

相关问题