Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Currect Directory

Status
Not open for further replies.

RClarkeJr

Programmer
Nov 10, 2004
20
US
I have a webpage which will load on a number of servers, and each webpage must load a txt file within its root folder. Since the folder name will change from server to server, I need a way to find the current directory and then load the txt file from that location via vbscript.

Any Ideas? Thanks in advance.
 
try this:

Code:
strAppPath = Left (WScript.ScriptFullName,(Len(WScript.ScriptFullName) - Len(WScript.ScriptName)))

Hope this helps...

--------------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
 
If in asp you may consider the Server.MapPath method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I decided to go this route

Function 1
Set fso = CreateObject("Scripting.FileSystemObject")
STRFILENAME = fso.GetAbsolutePathName("imgs")
End Function

Function 2
Set fso = CreateObject("Scripting.FileSystemObject")
pathstring = STRFILENAME & "\maildates.txt"
Set ts = fso_OpenTextFile(pathstring, ForReading)
End Function

When I test this through Visual InterDev it works perfectly. But when I open the webform on the server, it is looking for the file on my c:\documents and settings\username\desktop\imgs

What is going? Please help. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top