windows - How to record echo mssage displayed on command prompt using C#? -


i using below function call ear_encrypt_ftp.bat in c#. there way trace echo messages dispayed in cmd.exe while running batch file??

i need process echo messages displayed on command prompt screen log process.

private static short batchfileinvoke(string ftpfilename, string headerfile) {     short value = 0;     process p = null;     try     {         p = new process();         processstartinfo startinfo = new system.diagnostics.processstartinfo();         startinfo.filename = "cmd.exe";         string argument1 = "ear_encrypt_ftp.bat";         string test = "\"" + ftpfilename + "\"";         string argument2 = test;         string test1 = "\"" + headerfile + "\"";         string argument3 = test1;         p.startinfo.workingdirectory = path.getdirectoryname(argument1);         startinfo.arguments = "/c earencryptftp.bat " + argument2 + " " + argument3;         p.startinfo = startinfo;         p.start();         p.waitforexit();         int value2 = p.exitcode;         value = (short)value2;         if(value==0)         {             console.writeline("encryption process done");         }                     }     catch (exception ex)     {         console.writeline("exception occurred :{0},{1}",                     ex.message, ex.stacktrace.tostring());         value = -4;     }     return value; }   


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -