ASP.NET C# Run VBS file

Is it possible / does anyone know how in a ASP.NET C# 2.0 page to run a vbs file passing it a value and getting a string back from it?

Regards,

Nigel
Nigel_TaylorAsked:
Who is Participating?
 
RobSampsonCommented:
Hi,

I am by NO means a C# programmer (never touched it actually), but, in other languages, you would use a Shell command to execute an external program, so you could try something like this:
'============
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="cscript.exe c:\\dotnetstuff\\scrip1.vbs";
proc.Start();
'============

As for retrieving a string back from it, I think you could only do this if you know how to read STDOUT, which cscript will give you, provided that somewhere in the VBScript is a WScript.Echo statement.

Regards,

Rob.
0
 
RobSampsonCommented:
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.