system.diagnostics - How to run a tracetcp in C# and get the output result? -
system.diagnostics - How to run a tracetcp in C# and get the output result? -
below code. there someting wrong or missing in code?
using (process p = new process()) { string strcmdtext = string.empty; p.startinfo.filename = "cmd.exe"; p.startinfo.redirectstandardoutput = true; p.startinfo.useshellexecute = false; p.startinfo.arguments = "tracetcp vrtpmkap2001:445"; p.start(); string q = string.empty; while (!p.hasexited) { q += p.standardoutput.readtoend(); } string r = q.tostring(); }
i can't output of tracetcp.
use code:
string cmd = "/c tracetcp vrtpmkap2001:445" ; system.diagnostics.process proc = new system.diagnostics.process(); proc.startinfo.filename = "cmd.exe" proc.startinfo.arguments = cmd; proc.startinfo.useshellexecute = false; proc.startinfo.redirectstandardoutput = true; proc.start(); string output = proc.standardoutput.readtoend();
c# system.diagnostics
Comments
Post a Comment