How do I call a function inside a VBScript file from C#? The function has 2 parameters.
1 Answer
There are a few ways you can do this. The simplest would be to execute the VBScript file from a command line inside C#. You would need to pass your parameters in at the command line, but the code would look similar to this:
System.Diagnostics.Process.Start(@"cscript //B //Nologo c:\yourfile.vbs");
Here are more examples of how to execute command line functions in C#:
http://www.dotnetperls.com/process-start
You can also get more advanced with these methods:
-
+1 for dotnetpearls.com ... great site with some good tutorials and a respectable source for info. Commented May 29, 2011 at 0:53