Cancelling Window 7 shutdown disables power button

Normally, pressing the power button once initiates a shut-down in Windows 7.

If any programs are still running that will not quit (e.g. waiting for a dialogue response), Windows overlays the screen with a dialogue allowing the user to cancel the shut-down.

I've just noticed that on two different systems here, using this cancel option disables the shut-down via power button. The power button can still be used to kill the system by holding it for a few seconds, using the Start menu button to shut the PC down still works as well.

Steps to reproduce:

  1. Open Notepad, type a few characters. Do not save.
  2. Press the computer's power button.
  3. Wait until the dark screen appears.
  4. Press cancel.
  5. Press the power button again. Notice how nothing happens.

What is the reason for this behaviour, and can it be disabled to always try and shut down the PC when the power button is pressed?


Solution 1:

This is a known issue: http://support.microsoft.com/kb/2719667/en-us?sd=rss&spid=14498 (funny enough I just happened to see it show up recently in the knowledge base RSS feed)

If an application is preventing Windows from shutting down (ex. unsaved work), Windows will wait a period of 60 seconds at the force shut down dialog before forcing the application to close so shut down can continue. If the user cancels out of the force shutdown dialog, Windows still retains the 60 second timeout value. As a result, the next time a shut down occurs, even if there are no blocking applications, shut down will be delayed until the timeout value expires.

This behavior only occurs when configuring the power button to shut down the machine. When shutting down Windows through the Start Menu, the problem does not occur as the timeout value is not retained when cancelling out of the forced shutdown dialog.

Unfortunately the work-around is:

To work around this issue, use the shut down option from the Windows Start Menu instead.

Solution 2:

I managed to reproduce this behavior on my HP DV7 (with and without SP1). Everything happened exactly as you said, until the computer suddenly shut itself down.

Further investigation showed that canceling the shutdown doesn't disable the power button. It just gets delayed.

Example of how the delay operates

  1. Open Notepad, type in a few characters. Do not save.

  2. Press the computer's power button.

  3. Wait until the dark screen appears.

  4. Click Cancel.

  5. Try either of the following:

    • Press the power button immediately.

      Nothing will happen right away, but the computer will attempt to shut itself down exactly 90 seconds after pressing the power button for the first time.

    • Wait until 90 seconds have passed after pressing the power button for the first time.

      If you press the power button now, the computer will attempt to shut itself down immediately.

Rationale

Windows prevents the power button from attempting to shut the computer down more than once in 90 seconds. I can only take an educated guess here, but I suppose this is to prevent multiple shutdown attempts due to a malfunctioning power button or pressing it accidentally.

[C]an it be disabled to always try and shut down the PC when the power button is pressed?

I couldn't find any documentation regarding this behavior, let alone a way to modify it.

But to shut the computer down after a failed attempt, just close the application preventing the shutdown and do either of the following:

  • Press the power button again. The computer will shut itself down automatically.

  • Click Start -> Shut down. There's no delay if you do it this way.

Solution 3:

When you press the power button, Windows starts a shutdown transition and starts closing all the User Session applications ( the system is then in a shutdown_in_progress state ) but when some work needs to be saved first, the transition is then pending until that application is properly closed.

enter image description here

Starting another shutdown sequence will be discarded since there is an ongoing one, if you save that file you'll see that the shutdown transition will then continue by itself.