Implement a Shutdown Confirmation?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--------------------------------------------------
Track title: CC E Schuberts Piano Sonata D 784 in A
--
Chapters
00:00 Question
00:32 Accepted answer (Score 19)
01:51 Answer 2 (Score 1)
02:31 Answer 3 (Score 1)
03:13 Answer 4 (Score 0)
03:55 Thank you
--
Full question
https://superuser.com/questions/1075582/...
Question links:
[image]: https://i.stack.imgur.com/j1Fu3.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #windows10 #shutdown
#avk47
ACCEPTED ANSWER
Score 20
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, expandComputer Configuration
, expandAdministrative Templates
, and clickAll 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 toAlways
- Click
OK
You will have to select a reason for the shutdown, like so:
ANSWER 2
Score 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
ANSWER 3
Score 1
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.
ANSWER 4
Score 1
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