如何在Windows窗体应用程序中获取应用程序物理路径
如何在Windows窗体中获取应用程序路径,我使用了波纹管代码,但它说的是“找不到方法”
Application.ExecutablePath; Application.StartupPath;
请建议我,我缺少任何命名空间?
提前致谢
这将返回应用程序的完整路径
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
你也可以这样做
System.AppDomain.CurrentDomain.BaseDirectory
添加引用System.Windows.Forms
并添加使用部分
using System.Windows.Forms;
通常, Application.StartupPath()
将提供应用程序的路径。 并且还缺少这个命名空间。 System.Windows.Forms
System.Windows.Forms.Application.StartupPath
必须返回正在运行的可执行文件的路径。