Is there a way to set windows to leave console windows open?

心不动则不痛 提交于 2019-12-07 20:58:53

问题


Is there some way to get it to stop closing as soon as the code finishes so I can actually read the error messages in termination scripts? I know that various commands in different languages can be used to make it wait for the user to enter a character. I am asking if there is a way to set windows itself to leave the window open either universally or for specific types of programs so that error messages can be read without any special usage conditions (such as calling from inside CMD) or added coding (such as a user input command at the end of the code).


回答1:


Try running the command in a cmd window (just type cmd in the Run box and execute your program by typing the path to it). This will have the cmd window open even after the program has ended and you can also set a buffer length for the window if your error messages are too long.




回答2:


If you're running the program from a debugger, put a breakpoint on the last line of the program.



来源:https://stackoverflow.com/questions/5493212/is-there-a-way-to-set-windows-to-leave-console-windows-open

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!