0

The second app is a console application and I want to see it's output window.

I know how to use Process.Start() but it doesn't show the console window for the app. This is what I have tried:

Process.Start("MyApp.exe", "arg1 arg2");

So how to do it?

1
  • "I know how to use Process.Start()" please share with us your attempt. It would make things much easier to find the problem Commented Sep 4, 2019 at 11:22

2 Answers 2

2

Perhaps this helps:

ProcessStartInfo info = new ProcessStartInfo(fileName, arg); 
info.CreateNoWindow = false;
info.UseShellExecute = true;
Process processChild = Process.Start(info);
Sign up to request clarification or add additional context in comments.

Comments

0

I figured it out. I have to run cmd command with /k argument (to keep the console window open) and then my whole command-line:

var command = "MyApp.exe arg1 arg2";
ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd", "/k " + command);
processStartInfo.UseShellExecute = false;
Process process = new Process();
process.StartInfo = processStartInfo;
process.Start();
//In case you need the output. But you have to wait enough for the output
//string text = process.StandardOutput.ReadToEnd();

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.