Solved

VBScript: Starting another Script, Getting relative Path-Information

Posted on 2003-10-27
10
2,549 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
change vba from autofit to 13.5 width? 4 29
Best way to parse out a json string in VB6? 10 218
Excel - Save a copy of work book 13 88
How to read File Date Created using VB6 8 50
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 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…
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…

839 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