I'm creating a simple console application under Windows XP and wondering if there is a way to keep the console window open after the application is run from the Windows run prompt, without putting an endless loop at the end of main(). I want the app to behave like it was run from the run prompt after first typing cmd.
views:
597answers:
3
+6
A:
I think you'll need a second application which invokes the command prompt then tells it to execute your console application.
You can even do it with a single application that when called parameterless invokes the prompt and itself with a parameter that disables this behavior.
Jader Dias
2009-12-13 17:41:40
That's another good way to do it.
Michael Todd
2009-12-13 17:42:43
A:
ask the user for input will stop the application flow , i think it was
string x = console.ReadLine();
From.ME.to.YOU
2009-12-13 17:42:12
Good try, but this will still not guarantee that a prompt appears after the user started the application.
Michael Todd
2009-12-13 17:43:40
While this answers the question, it does not in a way that satisfies tkyle requirements.
Jader Dias
2009-12-13 17:44:13
Good idea, but what I was looking for was maybe a property or something to modify the way the console application window behaves.
tkyle
2009-12-13 18:29:50
A:
I found an answer to a similar question that satifies how to handle this question. See http://stackoverflow.com/questions/1173208/what-is-the-best-practice-for-combating-the-console-closing-issue/1173925#1173925
tkyle
2009-12-17 20:44:24