c# - Get error output from vbscript -
how can correctly error output runnung vbscript in c#?
here code:
system.diagnostics.process p = new system.diagnostics.process(); p.startinfo = new system.diagnostics.processstartinfo("cscript"); p.startinfo.createnowindow = true; p.startinfo.useshellexecute = false; p.startinfo.redirectstandardoutput = true; p.outputdatareceived += (proc, outline) => messagebox.show(outline.data, "data:", messageboxbuttons.ok, messageboxicon.information); p.errordatareceived += (proc, outline) => messagebox.show(outline.data, "error!", messageboxbuttons.ok, messageboxicon.error); p.startinfo.arguments = "c:\\test.vbs"; p.start(); p.beginoutputreadline();
this way able data cscript, if there error in script - process closed, without message...
oops. fault - forgot add
p.beginerrorreadline();
and answer
Comments
Post a Comment