Solved

VBScript: Starting another Script, Getting relative Path-Information

Posted on 2003-10-27
10
2,547 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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
 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

803 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