FastRodas Posted April 27, 2004 Posted April 27, 2004 Hi to all, i am developing a window application in c# and i want it to run another aplication that i did. what the other aplication does is receives a specific number of arguments and return a string. The basics, in main function i do a Console.Write(String). With my new application i want to get this string. So how can i execute the application and how can i get the string? thx to all Quote
Arch4ngel Posted April 27, 2004 Posted April 27, 2004 System.Diagnostic.Process.Start("Application.exe"); For retrieving your information... you could make your application to write to a file and retrieive information from this file once it's finished. By the way... it's not the best solution but if someone know how to do better... I'm ready to learn. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
Administrators PlausiblyDamp Posted April 27, 2004 Administrators Posted April 27, 2004 System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo(); ps.FileName="CMD.EXE"; //change to your exe ps.Arguments="/?"; //change to you arguments ps.RedirectStandardOutput=true; System.Diagnostics.Process p = new System.Diagnostics.Process(); ps.UseShellExecute=false; p.StartInfo=ps; p.Start(); string s = p.StandardOutput.ReadToEnd(); Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
FastRodas Posted April 27, 2004 Author Posted April 27, 2004 well.....it worked great...fantastic....it was exactly what i needed Thx to all Quote
AlexCode Posted April 27, 2004 Posted April 27, 2004 Devellopers must be the most imaginative persons there is... :) Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
michael_hk Posted April 28, 2004 Posted April 28, 2004 System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo(); ps.FileName="CMD.EXE"; //change to your exe ps.Arguments="/?"; //change to you arguments ps.RedirectStandardOutput=true; System.Diagnostics.Process p = new System.Diagnostics.Process(); ps.UseShellExecute=false; p.StartInfo=ps; p.Start(); string s = p.StandardOutput.ReadToEnd(); Excellent :) Exactly what now I am looking for. Quote There is no spoon. <<The Matrix>>
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.