方法1:直接調用
CODE:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName="wscript";
proc.StartInfo.Arguments=" hello.js";
proc.StartInfo.UseShellExecute = false;
proc.Start();
方法2:
使用MS的Windows Script Control
CODE:
string scr = "function hello(){var WshShell = new ActiveXObject(/"WScript.Shell/");"
+"var code = /"WScript hello.js/";"
+"WshShell.Exec(code);}";
MSScriptControl.ScriptControl sc = new ScriptControl();
sc.Language = "JScript";
sc.AllowUI = true;
sc.AddCode(scr);
object[] parameters = new Object[0];
sc.Run("hello",ref parameters);