66

Problem:

For some reason once in a while my command prompt would hang until I press a random key, and it would continue operation as if nothing happened.

Occurrence:

This happens when I am running a long operation (such as building/compiling some code). When it hangs, it gives no indication of what's going on nor does it prompt me to press any key.

Description:

  1. After a couple minutes, the terminal stops printing out the progress, and gets stuck.
  2. I had thought that it was simply stuck on a very lengthy portion of the compile process, but after a few hours it was still stuck on the exact same place.
  3. I pressed a random key, and it suddenly jumped straight back and continued spewing out progress indicators and continued working.

After this, similar events have happened many times during lengthy processes, such as copying files.

This has happened on multiple devices running windows 7. It has also occurred on ubuntu using bash shell.

11
  • 2
    Any of these machines set to sleep at all?
    – Windos
    Jul 18, 2011 at 23:04
  • 1
    It sounds like you're having the same issue from two completely different environments (Linux and Windows). So you might ask what do these two things have in common? Is it the same script/code? Copying to the same server?
    – Nixphoe
    Jul 19, 2011 at 1:54
  • 3
    Those who are wondering if it is still an issue,Yes ! Dec 31, 2019 at 6:52
  • 6
    Still a problem in 2020
    – Bakhshi
    Jun 17, 2020 at 4:08
  • 2
    Still a problem in 2022! Apr 1, 2022 at 14:49

2 Answers 2

38

I have experienced the same issue. Answers here and here indicate this is likely an issue with Quick Edit mode in the console. If it intercepts stray mouse clicks, or if clicks get passed erroneously through RDP, for instance, it can unintentionally pause the script. You can right-click the menubar and edit properties to turn off Quick Edit mode. That, of course, makes it more difficult to copy and paste out of the CMD window.

4
  • 1
    I have quick edit mode off, and experience this often in node. No issues on linux. But windows will seem to pause, until I ctr C once. This continues the node process. Seems like it would kill the process if it was truly hanging.
    – edencorbin
    Sep 5, 2018 at 23:14
  • I have disabled quick edit mode so will keep an eye. My solution is to resize my cmd prompt, or power shell window a bit - to get the npm script to continue. Very strange indeed.
    – shanehoban
    Feb 28, 2019 at 23:07
  • 8
    I've seen this for 20 years in windows. It has appeared and disappeared many times... I think its Microsoft not doing proper regression testing, because it comes and goes every few years
    – gunslingor
    Oct 11, 2019 at 16:38
  • 1
    Experiencing this regularly these days when running python3.7 scripts in powershell, very annoying :(
    – Loknar
    Dec 18, 2019 at 12:22
0

I found this answer, and it works for me on Windows 10 20H2. The trick seems to be,

powercfg -change -standby-timeout-ac 0
2
  • If you found a question, with an answer that answers this question, you should flag it as a duplicate. We try to avoid answers that just point to another answer.
    – Ramhound
    Sep 29, 2021 at 22:51
  • 1
    Until someone flags the question as a duplicate, it's still good to have an answer here. It's a 10 year old question with 40k views and otherwise no clear answer so far. The downvotes on a potential solution make no sense for someone coming from Google.
    – Blaisem
    Oct 29, 2021 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.