Re: preventing dos window close upon program termination

Tech-Archive recommends: Fix windows errors by optimizing your registry



jrr

You can run your executable from cmd
for example: instead of executing "myExecutable.exe"
You will execute: "cmd.exe /k myExecutable.exe"

The cmd shell will remain open after myExecutable terminates

Loy



Bryan Phillips wrote:
The Dos window you are referring to is the console window and is not the
same thing as cmd.exe. The console window WILL close when the program
terminates and you can't change that. If you need to see something in
the window after your main program logic runs, add a Console.ReadLine()
as the last line in your program. Then, the console window will stay
until you press the Enter key. Keep in mind that you program is
technically still running as far as the operating system is concerned.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com




"jrr" <jrr@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2DB466E6-62D7-462B-9FC8-D102134E8BAB@xxxxxxxxxxxxx:

How can I cause the dos window that my program executes in remain open after
my program quits? (I'd like the debugger to behave as if I ran my program
from cmd.exe instead of from explorer)

I can get similar behavior by inserting a breakpoint right before
termination, but I'm looking for a breakpointless solution.

Thanks!

.



Relevant Pages

  • Re: Abnormal Thread Termination
    ... some output which the executing thread is ... Rahul Anand ... Actually in managed code when ever thread abortion takes place then ... >> thread abnormally terminates when executing .NET method. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Is main a registered word
    ... executing to the closing brace of main is the equivalent of ... C99 5.1.2.2.3 says: ... the main function as its argument; reaching the} that terminates ... It seems to contradict the preceding statement. ...
    (comp.lang.c)
  • help with a multithreaded design
    ... a scheuler, and have each thread check in before ... executing and check out before it terminates. ... >I'm writing simulator to help with testing out problems ...
    (microsoft.public.dotnet.languages.csharp)