none
Visual studio 2012 close console window after execution RRS feed

  • Question

  • My English is poor , sorry

    Visual studio 2008 doesn't close the console window after executed a console application, but 2012 does close.

    I know that use "system("pause")" or getchar() to pause.

    but I want to know whether the Visual studio 2012 offer an option to turn on? 

    Not use code.

    Tuesday, November 6, 2012 12:09 PM

Answers

All replies

  • Hi lingdhox,

    Thank you for posting in the MSDN forum.

    Just to make this issue clearly, do you mean that the console window will be closed when you click “Start Without Debugging (Ctrl +F5)” in your VS2012? If so, whether all console projects have the same issue? I try to create a simple VC# console app, I run it in VS2012, but the console window will not be closed.

    To make sure that it is not related to your VS, I suggest you try to run it in other machine, if it worked well in other machine, I’m afraid that it is related to your VS, if possible, I suggest you reset your VS settings, and try to open it in SafeMode, check it again. If still no help, how about repairing your VS?

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 9:28 AM
    Moderator
  • Hi lingdhox,

    Thank you for posting in the MSDN forum.

    Just to make this issue clearly, do you mean that the console window will be closed when you click “Start Without Debugging (Ctrl +F5)” in your VS2012? If so, whether all console projects have the same issue? I try to create a simple VC# console app, I run it in VS2012, but the console window will not be closed.

    To make sure that it is not related to your VS, I suggest you try to run it in other machine, if it worked well in other machine, I’m afraid that it is related to your VS, if possible, I suggest you reset your VS settings, and try to open it in SafeMode, check it again. If still no help, how about repairing your VS?

    Best Regards,


    Jack Zhai [MSFT]

    Thank you for your reply .

    I created a C# console app, then ran it(start without debugging). The result was the same as you (the console window will not be closed) . So the vs 2012 is no problem.

    But the VC/VC++ console app will be closed.  I don't kown why the c# console app not have the issue?


    Wednesday, November 7, 2012 10:02 AM
  • Hi lingdhox,

    Please right click your project ->Properties ->Configuration Properties -> Linker -> System, please select Console (/SUBSYSTEM:CONSOLE) in “SubSystem” option. Check it again.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 10:13 AM
    Moderator
  • Hi lingdhox,

    Please right click your project ->Properties ->Configuration Properties -> Linker -> System, please select Console (/SUBSYSTEM:CONSOLE) in “SubSystem” option. Check it again.

    Best Regards,


    Jack Zhai [MSFT]

    Thank you for your help.

    Yes, The VC console app's “SubSystem” option is empty(none selected). It's very strange why the option is null. Maybe I should reinstall vs.

    The application works well now after I select the  Console (/SUBSYSTEM:CONSOLE) option. Thank you very much!

    Best Regards,

    Wednesday, November 7, 2012 11:32 AM
  • You're welcome! J

    Have a nice day,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 8, 2012 1:46 AM
    Moderator
  • It works for me. Thank you very much!
    Saturday, November 23, 2013 8:34 AM
  • Hi,

    I am having the same issue with VS 2013. Has the menu system changed? I am unable to see "Configuration Properties" under Project -> Properties.

    Details of my problem: I was running Console Applications successfully with the default "Press any key to continue" displaying cleanly at the end. Suddenly it started behaving differently with the following symptoms:

    - A new command window (cmd.exe) opening alongside my Console Application.

    - My Console Application closing abruptly without the default clean "Press any key" message

    - cmd.exe hangs and I am unable to close it, even through the Task Manager -> End Process

    My System Properties:

    Visual Studio 2013 Ultimate
    Windows 8, x64


    Any help would be greatly appreciated! Thanks!

    - G

    Monday, December 23, 2013 6:42 PM
  • Thanks a lot. This solved it for me.

    One interesting fact. It did this just when selecting empty project. When making a Win32 console app and selecting empty project afterwards it works fine.

    Saturday, February 22, 2014 9:04 AM