Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holding cmd.exe open on Vista

Tags:

c++

cmd

vista64

I'm writing C++ console programs. After compilation, when I run the program from my file browser, cmd.exe automatically closes such that I can't see my programs output.

The only way to work around this I've found is to run the program from inside cmd.exe

Is there anyway to keep cmd.exe open after a program finishes running?

Is there a setting I can change somewhere? I don't want to run a batch script with cmd.exe /K

Thanks!

[Edit] Don't know if this matters, but I'm on Vista x64

like image 418
hahuang65 Avatar asked Dec 03 '22 08:12

hahuang65


1 Answers

You can setup a shortcut with the /K switch when launching cmd.exe to have it not terminate after running a given command:

 cmd.exe /K YourProgram.exe
like image 107
Doug T. Avatar answered Dec 11 '22 11:12

Doug T.