VB.NET 获取程式路径
VB6程式大家都知道是用:app.path 获取程式的启动路径,在编程阶段是.VBP的路径,当然如果是用.exe 运行的话,是.exe所在路径。
但是VB.NET就有很多不同
程式启动路径:也就是.EXE所在路径,如果
Return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location()) '应用程式名所在的全路径,不包含“\”
'Return System.Reflection.Assembly.GetExecutingAssembly.Location().ToString '应用程式的全路径及应用程式名
另外:
'Return CurDir().ToString '当前路径,不包含“\”
'Return Environment.CurrentDirectory.ToString '当前路径,不包含“\”
'Return AppDomain.CurrentDomain.BaseDirectory.ToString '当前路径,不包含“\”
'Return System.Windows.Forms.Application.StartupPath '启动全路径.
'Return System.Windows.Forms.Application.ExecutablePath '启动全路径,包括.exe 文件名.