Vb.net 取程序运行的绝对路径
来源:百度文库 编辑:神马文学网 时间:2024/05/07 10:50:00
Vb.net 取程序运行的绝对路径
━━━━━━━━━━━━━━━━━━━━━━━━━━取程序运行的绝对路径用 application.startuppath()
而CurDir是当前运行路径,但如果期间进行了打开文件或其它改变路径的操作后,CurDir返回的可能就不是程序运行的路径了,所以不推荐使用。
━━━━━━━━━━━━━━━━━━━━━━━━━━
Application.StartupPath 得到可执行文件的路径(bin文件夹下的)。
━━━━━━━━━━━━━━━━━━━━━━━━━━
Imports system.reflection.assembly
imports system.diagnostics.fileversioninfo
getExecutingassembly.location
━━━━━━━━━━━━━━━━━━━━━━━━━━
string curPath;
curPath = space(256);
GetCurrentDirectory(256, curPath)
if right(curPath,1)<>'\' then curPath +="\"
return curPath;
━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━取程序运行的绝对路径用 application.startuppath()
而CurDir是当前运行路径,但如果期间进行了打开文件或其它改变路径的操作后,CurDir返回的可能就不是程序运行的路径了,所以不推荐使用。
━━━━━━━━━━━━━━━━━━━━━━━━━━
Application.StartupPath 得到可执行文件的路径(bin文件夹下的)。
━━━━━━━━━━━━━━━━━━━━━━━━━━
Imports system.reflection.assembly
imports system.diagnostics.fileversioninfo
getExecutingassembly.location
━━━━━━━━━━━━━━━━━━━━━━━━━━
string curPath;
curPath = space(256);
GetCurrentDirectory(256, curPath)
if right(curPath,1)<>'\' then curPath +="\"
return curPath;
━━━━━━━━━━━━━━━━━━━━━━━━━━