Solved

calling a Vbscript from a Vbscript

Posted on 2011-02-17
6
435 Views
Last Modified: 2012-06-22
i am getting an error when using the code below that says "Cannot use parentheses when calling a sub".


what is the correct way to call a new vbscript from an existing vbscript?
Dim oShell, a 
oShell = CreateObject("Wscript.Shell") 
a = "C:\users\administrator\desktop\test.vbs" 
oShell.run(a, 3, True)

Open in new window

0
Comment
Question by:ob1_
  • 4
6 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 34918820
0
 
LVL 6

Author Comment

by:ob1_
ID: 34918850
not sure that will work. my main script is a VBS file not a WSF file and i am not trying to pull a function from another script but pass some variables onto the 2nd script via arguments and then execute the whole thing.
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34918952
try:

Dim oShell, a
oShell = CreateObject("Wscript.Shell")
a = "cscipt C:\users\administrator\desktop\test.vbs"
oShell.run(a, 3, True)
0
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

 
LVL 6

Author Comment

by:ob1_
ID: 34919091
i still get "cannot use parentheses when calling a sub" on the oShell.run(a, 3, True) line....
0
 
LVL 6

Accepted Solution

by:
ob1_ earned 0 total points
ID: 34919152
0
 
LVL 6

Author Closing Comment

by:ob1_
ID: 34949758
found post with answer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

840 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