Sometimes you need to know where a script is living, without having to change a hard coded value when you deploy it. The following code is a cheap and easy way to find the current path where the script resides.
You can get the full script path, including the name of the script file by accessing the wscript object.
wscript.scriptfullname
Or to get the folder it's currently living in, minus the name:
function scriptPath()
Full_Path = wscript.scriptfullname
Name1 = wscript.scriptname
Path = Left(Full_Path, Len(Full_Path) - Len(Name1))
scriptPath = Path
end function
No comments:
Post a Comment