Solved

VBScript: Starting another Script, Getting relative Path-Information

Posted on 2003-10-27
10
2,542 Views
Last Modified: 2008-01-09
I need to start another script from one script.
And I need to know from which path, I starte the first script.

I.e I have a script at C:\Temp and I want to sart another one in C:\Winnt, knowing that I actually started the first one from C:\Temp

Txs for an answer, db
0
Comment
Question by:db_tiger
  • 4
  • 3
  • 3
10 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 63 total points
ID: 9629041
what kind of script are you talking about?, vbscript?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9629051
To run a vbscript from another script:

dim sh
set sh =createobject("wscript.shell")
sh.run "c:\winnt\otherscript.vbs"
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9629056
0
 
LVL 1

Author Comment

by:db_tiger
ID: 9632228
leonstryker, txs, I already looked in MSDN etc. but didn't find the answer fast enough, that's why I asked thze experts.

RichieSimonettie, that's half of the answer thanks; but now I need to know a variable, with the actually path-variable; best for both scripts. The reason is the following; the first script will take a Ini-File, will then call the second script passing some parameeteres and the starting folder; the seconde script will take the Init-Values, will do some action with them and then take some further files from the location of the first script.
The reason for this kind of strange situation, is that wie have several different configurations and don't want to copy the files (that's) how we solve it for the moment. So, how do I get the Path-Informations?

Thxs
db
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9633450
I don't remember the exactly name but .path or ,actualpath should be a property of script that returns what you need. Sorry i haven't VB installed so i cannot test it but, as i told you there is a property, just i don't remember which...
0
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

 
LVL 29

Expert Comment

by:leonstryker
ID: 9633487
You can run them with:

dim sh
set sh =createobject("wscript.shell")
sh.run "wscript c:\winnt\otherscript.vbs"

OR

dim sh
set sh =createobject("wscript.shell")
sh.run "cscript c:\winnt\otherscript.vbs"
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9633494
The path information I believe can be determined with App.Path
0
 
LVL 1

Author Comment

by:db_tiger
ID: 9633595
App.Path: Nope.
Other part of answer was already given by Richie_Simonetti.

Richie
Path doesn't work.
0
 
LVL 29

Assisted Solution

by:leonstryker
leonstryker earned 62 total points
ID: 9633675

I think this is it to get the file with the path:
scriptfile = WScript.ScriptFullName
Msgbox scriptfile


To get just the folder:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(scriptfile)
Msgbox f.ParentFolder
0
 
LVL 1

Author Comment

by:db_tiger
ID: 9634078
There we go, 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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 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

19 Experts available now in Live!

Get 1:1 Help Now