I'm adding this question after spending an entire day wrestling with this incredibly frustrating feature of the Windows 10 command prompt which made me think there was something wrong with my console application code. I hope it will help someone.
Issue: My console application seems to randomly stop running. What is going on?
If Command Prompt is not opening on your Windows PC, you can try alternative ways to launch CMD. You can try launching Command Prompt from File Explorer or Task Manager. If that doesn't work, you can try running a System File Checker (SFC) scan to fix the corrupted system files and make CMD work.
It is quite possible that Command Prompt is not opening in Windows 10 because there are corrupt system files. For this, you can take the aid of Windows PowerShell and run the SFC command to fix and detect missing or corrupt system files. After you have opened the Windows PowerShell (Admin) type SFC/scannow.
The issue ended up being a new feature of the windows 10 console. Under the default config, whenever you click on a command window in windows 10, it immediately halts the application process when it attempts to write to the console. When this happens, the command window has gone into "selection" mode.
You can tell it has happened because it will prefix the title bar of the command window with the word "Select" :
To get your program running again, you have to press escape or click somewhere else.
To get rid of this strange behavior, you can disable QuickEdit mode:
What I'd like to add here to Shaun Rowan's answer is that for it to work in all console windows you have to click "Defaults", instead of "Properties" and make your changes there, as described in this post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With