Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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.

"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
Posted
	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();

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
	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.

There is no spoon. <<The Matrix>>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...