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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -