Prevent Windows shutdown

Master Po

New member
Local time
3:05 PM
Messages
23
How is possible to stop windows shutdown if I accidentally click Shutdown in start menu?
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Home Premium 64bit
Memory
4GB
Keyboard
MS keyboard
Mouse
Logitech
Browser
Google Chrome
Hi Master Po,

Command line
batch file terminate shutdown
batch file shutdown with error trap
change shutdown button to sleep

What's your flavor?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
I have accidently hit Shutdown instead of Log Off before. How is there time to run any of the aborts above? You have maybe five seconds until Shutdown. Just curious.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Home Premium 32-Bit - Build 7600 SP1
CPU
Intel Core i3-2120 3.30Ghz
Motherboard
Asus P8Z68-V LX Intel Z68 Socket H2 ATX
Memory
Kingston 4 GB DDR3 1333 mhz
Graphics Card(s)
AMD Radeon HD6670
Sound Card
Sound Blaster Audigy SE 24-Bit
Monitor(s) Displays
Asus VE228
Screen Resolution
1440 X 900
Hard Drives
OCZ Vertex 3 120 GB Sata 3 SSD ==
Kingston SH103/S3 120 G Hyper X 120 GB SSD ==
Western Digital 500 GB Caviar Green 7200 RPM ==
PSU
Corsair CX600M == 600 Watt
Case
NZXT Apollo - Silver with Clear Side Panel
Cooling
Three 120 mm Fans
Keyboard
Microsoft Natural 4000
Mouse
Microsoft Custom Optical 3000
Internet Speed
AT&T Fiber Optic Wireless Network
Antivirus
Microsoft Security Essentials
Browser
Chrome
Other Info
120 mm Blue LED Fan -- Three Blue LED Lazer Light Sticks
5 seconds isn't enough time.
If you look at the batch file I uploaded, right-click edit, look for
Shutdown -r -f -t 5
Shutdown -s -f -t 5

-t is shutdown timer in seconds, currently 5.
both places, change to seconds you wish
save as type: All files (*.*)
shutdown.bat
that saves it as it is, a batch file

Here's the regedit:
If you don't feel totally comfortable editing this key, backup the registry, or full disk image backup to be on the safe side.
Registry - Backup and Restore - Windows 7 Help Forums

  1. Click :orb: type regedit
  2. Click regedit.exe when it appears
  3. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  4. In the right pane, double-click WaitToKillServiceTimeout
  5. Change it to what you wish; default is 10000 is 10 seconds, 15000 is 15 seconds, 20000 is 20 seconds, etc.
  6. Click OK
  7. Close the folder levels you opened to return to where you began. (Computer and 5 folders below)
Shutdown set to 15 seconds
View attachment 15 Second Shutdown Batch File with Icon.zip
 
Last edited:

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
Hi Snick,

The READ ME files in both your batch files are of the File type. It might be better to make them .txt files so the user doesn't have to select a program to open them with!
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Fujitsu LIFEBOOK
OS
Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux Mint 18.3
CPU
Intel(R) Pentium(R) CPU P6200 @ 2.13GHz
Motherboard
FUJITSU FJNBB06
Memory
4.00 GB
Graphics Card(s)
Intel(R) Graphics Media Accelerator HD
Sound Card
[1] Realtek High Definition Audio [2] Intel(R) Display Audio
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 59 Hz
Hard Drives
TOSHIBA MK5076GSX
Antivirus
AVG FREE
Just create a hotkey shortcut. I hate the built in windows hot keys because you have to press ctl and alt plus another key, which is hard to do very quickly. I suggest you use autohotkey and create just one file called "abort.ahk", which contains only this

#a::
Run shutdown -a
return

which maps the keyboard combination of windowskey+a to run an immediate shutdown abort

Beginner Tutorial | AutoHotkey
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
diy
OS
Win7 pro x64
CPU
stock i7 7700k
Motherboard
Gigabyte Z270N-WIFI mini-ITX
Memory
Corsair Vengeance LPX 16GB (2x8GB) DDR4 @ 3200MHz
Graphics Card(s)
integrated Intel HD 630
Sound Card
onboard Realtek ALC1220
Monitor(s) Displays
two vertically mounted samsung 55" 4k un55mu8000
Screen Resolution
1920x1280
Hard Drives
256GB Samsung EVO 960 M.2 pci-e NVMe SSD
PSU
SilverStone Nightjar ST45NF 450Watt Fanless
Case
No case. Motherboard is mounted directly onto power supply
Cooling
Evercool low profile 815EP with Panaflow 12L fan at 7v
Keyboard
Ortek MCK-86 mini
Mouse
Belkin 5-button USB
Internet Speed
spectrum 400mbps
Back
Top