[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

run script from vb.net

Posted on 2006-04-04
8
Medium Priority
?
387 Views
Last Modified: 2012-05-05
I Have a vb.net prog which contains a flie "vbscript1.vbs" simply i need to click a button and for the script to run
0
Comment
Question by:TREER
8 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 16370071
Try:

System.Diagnostics.Process.Start ("c:\PathtoScript\vbscript1.vbs")
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 16370154
Dim obj as new Process
obj.start("\\server\share\folder\vbscript1.vbs")


You can use obj.WaitForExit() method to wait till the process has
termintated.
0
 

Author Comment

by:TREER
ID: 16374053
unfortunately, your ideas do not work although they nearly do
the following error occurs when i attempt your code

line
char 1
error Object expected
code 800A138F
Source Microsoft jscript runtime error

so i replaced my javascript code  with a simple
 alert("try")

but still the same error occurs

 i have increased the points to 500, many thanks for your time


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 67

Expert Comment

by:sirbounty
ID: 16374077
This indicates that it 'is' working - but reporting back an error in the called script..
0
 
LVL 41

Accepted Solution

by:
graye earned 2000 total points
ID: 16375853
Here is an "in process" way to run a vbscript using a COM-based DLL

        ' Include a COM reference to "Microsoft Script Control" (MSScriptControl)
        Dim host As New MSScriptControl.ScriptControlClass

        host.Language = "VBScript"
        host.AddCode("Sub main" & vbCr & "Msgbox(""Hello"")" & vbCr & "End Sub")
        host.Run("main")
0
 

Author Comment

by:TREER
ID: 16375896
sirbounty ,

i can see your logic, and indeed that was my first thought, that is why i replaced my original script with just the one line


alert("try")

the result was the same error



graye, the script is javascript, will this be the same?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 16376302
I don't know much about javascript, but that's a vb script you're trying to run and alert("try") is not a valid command...
try

wscript.echo "Hello"

instead...
0
 
LVL 21

Expert Comment

by:oleggold
ID: 16378426
You can run VB.Net Shell() function to execute the script as simple as possible:
http://www.dotnet247.com/247reference/msgs/57/289295.aspx
0

Featured Post

Technology Partners: 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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 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