PC上获取程序当前运行目录,常用作法:
1> path = System.Windows.Forms.Application.StartupPath; //不包括EXE的名称
2> path = System.Windows.Forms.Application.ExecutablePath; //包括EXE的名称
3> path = System.Reflection.Assembly.GetExecutingAssembly().Location;
4> path = System.Environment.CurrentDirectory;
PDA(WINCE)上获取方法:
path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.Load(
System.Reflection.Assembly.GetExecutingAssembly().GetName()).GetName().CodeBase);
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);