How to auto shutdown laptop on AC power loss

6

I'm using Windows 7 64-bit Home Edition on a Dell Inspiron.

How do I make my laptop shut down instead of running on battery after an AC power loss?

The idea is to have µTorrent run at night but not waste battery in the event of power loss (frequent around here). It would be great if the mechanism could be turned on and off easily as I only want the laptop to auto shutdown when I'm fast asleep – not every time the power goes out.

I tried making a new task using the Task Scheduler (in Administrative Tools), but couldn't figure out where the AC power loss event is to put it in the trigger.

ali

Posted 2012-05-17T20:46:23.990

Reputation: 61

Answers

15

I would go to Power Options > "Create a power plan". Call it "Night Time", and use any of the preconfigured power plans as a template.

On the next screen where you get the options "Turn off the display" and "Put the computer to sleep", choose "Change advanced power settings".

In the new window, set "Low battery level" to 99% and choose "Shut down" for "Low battery action".

enter image description here

I would just warn you though, by using this method, you need to make sure you quickly change back when you restart the computer otherwise it will just turn itself off again.

I would recommend that you type the following - powercfg -list from the command line and take a copy of the GUID of your main plan, then, I recommend you create a scheduled task to run at system startup that looks similar to this (for high performance): powercfg.exe /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

If your house is anything like mine, I get little power cuts that last around 5 minutes once every few weeks - to counter this, consider using 80% or similar as the shut off percentage.

Hope this helps!

William Hilsum

Posted 2012-05-17T20:46:23.990

Reputation: 111 572

1Nice answer, creative use of the built-in power options. I took a screenshot and added it to your post. – Indrek – 2012-05-17T22:25:03.323

It should also be noted that some programs will keep your system awake regardless, you need to ensure that the settings of your software are configured in so way that it does not prohibit sleep. It's very likely that if you run software that intends to do a long download, that there is some sort of protection against sleep included. Carefully googling about it or looking through the settings can help not being surprised by the above suggestions not working due to some override... – Tamara Wijsman – 2012-07-16T01:46:46.987

I would do something more like 97%... Sometimes your battery will dip to 99% just randomly discharging! (or so ive found) – Simon Sheehan – 2012-07-16T15:58:34.013

1

Use Shutter. Its portable, 1.73 MB small and free for personal use.
Once started, it runs in the tray and waits for certain events to execute predefined actions

For your scenario use:

  • Event: Battery below 99% and Trigger event only when running on battery
  • Action: Shutdown Laptop and Force applications to stop

enter image description here

nixda

Posted 2012-05-17T20:46:23.990

Reputation: 23 233

-1

It is possible to shut down windows with a timer, using a DOS command.

  1. Go start >> all program>> Accessories>> Run or (keyboard shortcut)Win + r.

  2. Now write shutdown /s /t 60.

(Above command is used for 1 minute (60 seconds) you can change it according to your demand)

Source http://tech.mobiletod.com/shutdown-timer-using-command-in-windows-7-how-to/

This won't shut it on power loss though. The best, simplest way is to find the event for power loss (might be different depending on the laptop) and use it as a trigger for a task. Which I haven't found yet.

Edit : this command has arguments for certain conditions like

/d [p|u:]xx:yy Provide the reason for the restart or shutdown. p indicates that the restart or shutdown is planned. u indicates that the reason is user defined. If neither p nor u is specified the restart or shutdown is unplanned. xx is the major reason number (positive integer less than 256). yy is the minor reason number (positive integer less than 65536).

and then

(E = Expected U = Unexpected P = planned, C = customer defined) Type Major Minor Title

U 6 11 Power Failure: Cord Unplugged U 6 12 Power Failure: Environment

just type shutdown in the console and it will show a full list

anonymous

Posted 2012-05-17T20:46:23.990

Reputation: 1