run script from vb.net

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
TREERAsked:
Who is Participating?
 
grayeCommented:
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
 
sirbountyCommented:
Try:

System.Diagnostics.Process.Start ("c:\PathtoScript\vbscript1.vbs")
0
 
Mikal613Commented:
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
TREERAuthor Commented:
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
 
sirbountyCommented:
This indicates that it 'is' working - but reporting back an error in the called script..
0
 
TREERAuthor Commented:
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
 
sirbountyCommented:
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
 
oleggoldCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.