26

How do I configure Windows 10 so that it displays a confirmation dialog every time I press the Shut down button?

Sometimes I would shutdown my computer accidentally, as the sleep button is just above shutdown button, and lose my unsaved work:

enter image description here

Excellll
  • 12,627
  • 11
  • 51
  • 78
Jeremy
  • 516
  • 3
  • 7
  • 11
  • Did you use google? there are tons of entries for your problem. I guess this should work, please try it: http://winaero.com/blog/how-to-set-the-default-action-for-the-shutdown-dialog-in-windows-10/ – SimonS May 11 '16 at 12:16
  • 1
    @Jeremy how about the answer with 6 upvotes in this thread (even though it's windows 7?) http://superuser.com/questions/89957/how-to-force-a-confirm-shutdown-in-windows-7 – SimonS May 11 '16 at 12:26
  • @SimonS All I want is a simple confirmation dialog with yes/no buttons. – Jeremy May 11 '16 at 12:32
  • There's plenty of info out there on ways to do it. IE: [Disable shutdown key on my keyboard?](http://superuser.com/questions/816088/disable-shutdown-key-on-my-keyboard), [Disabling Power button on keyboard](http://superuser.com/questions/55833/disabling-power-button-on-keyboard), [etc.](https://www.google.com/search?q=site%3Asuperuser.com+disable+keyboard+power+button+windows) – Ƭᴇcʜιᴇ007 May 11 '16 at 13:01
  • 1
    @Ƭᴇcʜιᴇ007 Ah. What I actually mean is the buttons on screen. http://i.imgur.com/2Iph8RQ.png – Jeremy May 11 '16 at 13:04
  • @ths As you can see from the image in my post. I don't have problem selecting those buttons but, when I'm in a rush I may click the wrong button. – Jeremy May 11 '16 at 16:00

4 Answers4

18

One way to get a confirmation dialog upon hitting the shutdown button is to enable Shutdown Event Tracker:

Configure Shutdown Event Tracker on the Local Computer

Since the link above is not up-to-date for Windows 10, the following are step-by-step instructions for Windows 10 (verified with version 21H1):

  • Start gpedit.msc
  • In the Local Computer Policy navigation pane, expand Computer Configuration, expand Administrative Templates, and click All Settings
  • In the console pane, scroll down to the list of objects and double-click Display Shutdown Event Tracker
  • Click Enabled
  • Verify that in Options, Shutdown Event Tracker should be displayed: is set to Always
  • Click OK

You will have to select a reason for the shutdown, like so:

enter image description here

Nassbirne
  • 1,591
  • 2
  • 15
  • 26
  • This is same as SimonS' answer in comment. I don't want to choose a reason every time I shutdown my computer. – Jeremy May 11 '16 at 15:46
  • 5
    Well you can just click "Continue" without changing the default reason. – Nassbirne May 11 '16 at 15:49
  • This is mainly a feature of the server versions of Windows which have it enabled by default. It generates entries in the event log which can be useful for system administrators. – Nassbirne May 11 '16 at 17:00
  • 3
    This does exactly what you asked for: Confirmation on shutdown. You don't even have to select a reason from the reason box. – Bort May 11 '16 at 20:45
  • @xtian and others noticing the option isn't available: mine was semi-hidden. `gpedit.msc > Local Computer Policy > Computer Configuration > Administrative Templates > All Settings > Display Shutdown Event Tracker` worked for me. – Tydaeus Mar 05 '21 at 15:27
1

Create the following batch file and use instead.

@ECHO OFF

:choice
set /P c=Are you sure you want to shutdown[Y/N]?
if /I "%c%" EQU "Y" goto :yesplease
if /I "%c%" EQU "N" goto :nothanks
goto :choice


:yesplease

shutdown /s /t 10
exit

:nothanks
exit

Paste this text into notepad, and save it as "shutdown.bat" (include the quotations.) The quotes force it to save as a .bat file.

edit: removed unecessary pause statements

Narzard
  • 3,557
  • 14
  • 27
  • 2
    I'm not asking how to code the confirmation dialog. It'd be nice if the bat file can be ran when I click the shutdown button. – Jeremy May 11 '16 at 13:41
0

A confirmation by itself can cause a problem, you might forget about it and leave the computer without it shutting down. The solution is like in Macs to have a confirmation but also auto-shutdown after some time if you don't cancel it.

I don't know of a way to do that natively on Windows, I think you need a 3rd party app for that. I know Penteract CMD GUI Creator can do it (See here and scroll to "Shutdown with confirmation and auto-execute"), but there might be other apps that do it as well.

User42
  • 210
  • 1
  • 6
0

Because Windows 10 Home does not have gpedit.msc, you need to directly modify the registry to add Shutdown Event Tracker (even if gpedit.msc is forcibly added through cmd bat, the modification is useless).

Modify the registry method refer to https://www.tenforums.com/tutorials/78343-enable-disable-shutdown-event-tracker-windows-10-a.html

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability]
"ShutdownReasonOn"=dword:00000001
"ShutdownReasonUI"=dword:00000001

hrdom
  • 9
  • 2