c# - Console application not doing anything -


basically write application perform in command prompt:

sslist -h -r -h s234.ds.net /mobile > listofsnapshot.txt

then code when create c# console application:

using system; using system.collections.generic; using system.linq; using system.text; using system.io;  namespace search {     class program     {         static void main(string[] args)         {             system.diagnostics.process p = new system.diagnostics.process();             p.startinfo.filename = "sslist.exe";             p.startinfo.arguments = "-h -r -h s234.ds.net /mobile";             p.startinfo.useshellexecute = false;             p.startinfo.redirectstandardoutput = true;             p.startinfo.redirectstandarderror = true;             p.start();              string procoutput = p.standardoutput.readtoend();             string procerror = p.standarderror.readtoend();              textwriter outputlog = new streamwriter("c:\\work\\listofsnapshot.txt");             outputlog.write(procoutput);             outputlog.close();          }     } } 

why when execute console script, hangs there , not anything?

sslist.exe waiting input.

you can send input setting p.startinfo.redirectstandardinput true, writing p.standardinput.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -