Solved

VBScript problem.

Posted on 2003-11-05
3
180 Views
Last Modified: 2010-05-03
Dear all experts,

I would like to write a .vbs VBScript program to popup the current path. How can I get such result?

TestPath.vbs
-----------------------------
msgbox (App.Path)

It is seem that the App.Path is not work in above program.

Please advise, thank you very much.

superleo
0
Comment
Question by:superleo
3 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 50 total points
ID: 9691912
See my post at:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20788448.html

Try use the GetAbsolutePathName method in FSO, example:

test.vbs:

function ShowAbsolutePath(path)
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")  
   ShowAbsolutePath = fso.GetAbsolutePathName(path)  
end function

msgbox ShowAbsolutePath(".")
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9693567
This will get the file and/or folder path

scriptfile = WScript.ScriptFullName
Msgbox scriptfile

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(scriptfile)
Msgbox f.ParentFolder

Leon
0
 

Author Comment

by:superleo
ID: 10020674
Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now