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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Current Folder ????

Status
Not open for further replies.

annandap

IS-IT--Management
Dec 9, 2001
11
AU
Hi,
Can anyone please provide me with information on how to determine the current folder using VB Script. In VB you can use App.Path how is this done in VBScript, everything (example) I have seen you have to feed the FSO object information on the folder first.

As I want to open a file and it needs to be in the current application directory which could be different on any machine I need to be able to get the path to this directory.

Thanks..

Peter.
 
Hello annandap,

This is what I have in my record.
Code:
wscript.echo wscript.scriptfullname
wscript.echo wscript.scriptname
wscript.echo createobject("wscript.shell").currentdirectory
regards - tsuji
 
Try something like this:
Code:
Sh=WScript.CreateObject("WScript.Shell")
cwd=Sh.CurrentDirectory
WScript.Echo "CurrentDirectory=" & cwd[/code}

Hope This Help
PH.
 
Thanks for the prompt responses. Neither of these work in my application, they look like they're for a web page.

I am working on a script in an outlook form and want to open a text file that will be in the outlook application directory, I am assuming that if I can determine the current directory it should be the outlook executable directory.

Thanks..

Peter.
 
They are for WSH (.VBS file), not web page.
Try something like this:
Code:
Set Sh=CreateObject("WScript.Shell")
cwd=Sh.CurrentDirectory
MsgBox "CurrentDirectory=" & cwd

Hope This Help
PH.
 
Thanks.. that works fine now. From this I can manipulate the path to what I want..

Thanks once again.

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top