Solved

calling a Vbscript from a Vbscript

Posted on 2011-02-17
6
431 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

15 Experts available now in Live!

Get 1:1 Help Now