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:
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
One way to get a confirmation dialog upon hitting the shutdown button is to enable Shutdown Event Tracker:
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):
Local Computer Policynavigation pane, expand
Computer Configuration, expand
Administrative Templates, and click
Display Shutdown Event Tracker
Shutdown Event Tracker should be displayed:is set to
You will have to select a reason for the shutdown, like so:
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
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.