Solved

VBScript: Starting another Script, Getting relative Path-Information

Posted on 2003-10-27
10
2,552 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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…

688 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