Solved

VBScript: Starting another Script, Getting relative Path-Information

Posted on 2003-10-27
10
2,545 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 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

9 Experts available now in Live!

Get 1:1 Help Now