I would like to start a vbscript from a VB application. I need to be able to get the output of the script from the VB app. To create a file as buffer between them is not the best as I will call the vbscript several time. Any idea would be appreciate it
Asked
Active
Viewed 73 times
0
-
1You could use [`Process.Start'](https://msdn.microsoft.com/en-us/library/0w4h05yb%28v=vs.110%29.aspx) to run the script and capture standard output. See [this](http://stackoverflow.com/questions/10397452/how-do-i-call-a-vbs-script-from-vb-net), [this](http://stackoverflow.com/questions/200422/how-to-call-a-vbscript-file-in-a-c-sharp-application), [this](http://stackoverflow.com/questions/285760/how-to-spawn-a-process-and-capture-its-stdout-in-net) and [this](http://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output) for some pointers. – Mark Nov 12 '15 at 20:27
-
Thanks Mark, I appreciate your help. Do you know how to start a vbscript from Visual Basic and pass parameters to the script? I will use StdOutPut to get the results from the script – JC Nunez Nov 12 '15 at 21:25
-
This [answer](http://stackoverflow.com/a/200429/2278086) (from the second "this" link above) shows how to use `Process.Start` and `cscript.exe` to run a VBScript file. You can pass parameters after the name of the script file, as you would on the command line. – Mark Nov 13 '15 at 00:37
-
Thanks a lot Mark. This is working but I am not getting the right result. I have been trying to read the value of the DefaultUserName and Autologon register keys from a VB.Net application but I am getting "Nothing" as result. I have a vbscript that can get those values so I am trying to start that script from the VB application. However, when I start the vbscript from the VB application I got "Nothing" again. Looks like I am missing a setting on the VB app to read those values. Do you have any idea? – JC Nunez Nov 13 '15 at 02:10