获取当前文件所在目录

'dim s,dir0,dir1,dir2
's=wscript.scriptfullname
'on error resume next
'dir0=left(wscript.scriptfullname,instrrev(s,"\")-1)
'dir1=left(wscript.scriptfullname,instrrev(dir0,"\")-1)
'dir2=left(wscript.scriptfullname,instrrev(dir1,"\")-1)
'msgbox dir0'当前目录
'msgbox dir1'上层目录
'msgbox dir2'上上层目录
Option Explicit
Dim FullFileName
FullFileName = Wscript.ScriptFullName
Dim CurrentPath
CurrentPath = Left(FullFileName,InstrRev(FullFileName,"\") -1)
MsgBox CurrentPath
原文地址:https://www.cnblogs.com/BeyondTechnology/p/1959376.html