How to get other programs output results

xiaoxiao2021-03-06  39

Topic: How to get the result of the console program? Servers: Answered (Talent) Isometric: 100 Community: .NET Technology C # Problem Point: 100 Repos: 3 Posted: 2005-02-28 22:36:23 I mean:

I want to make a program, just like the compilation output window below EditPlus or VS.Net 2003, there is an output window to display the current compilation when compiling.

For example, if I click on a button on the form (the button's role is to perform CSC C: /A.cs), I want to display the results of this CSC C: /A.CS to the THIS form, Can you give a thinking or code?

Use system.diagnostics.process to run your command, and read from its standardoutput, for example, see

Http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemDiagnostcturestartStartInfoclassRedirectStandOrdOrdoutputtopic.asp

Process p = new process (); p.startinfo.useshellexecute = false; p.startinfo.redirectstandardoutput = true; p.startinfo.filename = "test.exe"; p.start (); p.WaitForeXit (); string Output = p.standardoutput.readtoend ();

转载请注明原文地址:https://www.9cbs.com/read-52472.html

New Post(0)