为什么我的命令提示符在Windows 10上冻结?
我花了整整一天的时间努力解决Windows 10命令提示符这一令人沮丧的功能之后,添加了这个问题,这让我认为控制台应用程序代码有问题。我希望它能对某人有所帮助。
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?
问题最终成为Windows 10控制台的新功能。在默认配置下,每当您在Windows 10中单击命令窗口时,它在尝试写入控制台时都会立即停止应用程序进程。发生这种情况时,命令窗口将进入选择模式。
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" :
要重新运行程序,则必须按Escape键或单击其他位置。
To get your program running again, you have to press escape or click somewhere else.
要摆脱这种奇怪的行为,可以禁用QuickEdit模式:
To get rid of this strange behavior, you can disable QuickEdit mode: