0

Is it possible to run another console application in running console. Lets say I got program that write hello world, i got her as exe file. Now I am running another program, can i run the other one in the second one? i want to run the hello world in the second program, its like running a process but in this console. I want to run the code and then continue the program that called it.

Is it possible some how?

I didn't find the answer anywhere... My idea is to write scripts and shell for them which will run them. If you got another idea i would like to hear it to. I want it in C# so cygwin or any other shell (which is not c#) won't help me.

1
  • 1
    @I4V as far as I understand OP is asking to run another process but in same console Commented Sep 15, 2013 at 12:25

2 Answers 2

1

You should use System.Diagnostics.Proces class to run the secondary process More details here

Sign up to request clarification or add additional context in comments.

1 Comment

Correct me if im wrong but this open the other process in another console. Can i open it in the console that is already open?
0

What do you mean by same console? you want to run a program and get the result, If you don't want it to run in the background, the use:

Process p = Process.Start("exe fullname");
p.WaitForExit();
if (p.ExitCode == 0)
{
    //everything is good
}
else
{
    //the program wasn't successful
}

If however, you want it in the background, then you need to use a Task.
Here is a complete article regading tasks

Note: If it's another Console application, and you want to use the result, then use ProcessStartInfo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.