12

I've got a Lenovo Yoga 2 11 running Windows 10. I currently have it set to stay awake when the lid is closed and it is plugged in, and that is working exactly as intended. However, if the lid is closed and it is plugged in, when I unplug it, I want it to go to sleep.

Scenario: When I'm finished using my laptop at my desk (plugged in), I shut the lid. It does not go to sleep. When I grab my laptop to go to work, I unplug it (without opening and closing the lid). It is still awake.

This has led to numerous occasions where my laptop is dead when I go to use it since it sits and churns for a few hours until it dies.

Is there a way I can make it so it'll go to sleep when I unplug and the lid is closed?

3
  • Not naively, that I'm aware of. Maybe there is something promising in the Lenovo Power Manager? In the Windows Power Options you can set the On Battery option to Sleep and the Plugged In option to Do Nothing, but I see your point, as the On Battery setting would not take effect after unplugging and would require you to open and close the lid.
    – root
    Commented Feb 17, 2016 at 15:08
  • 1
    @root There is a method for that.
    – ds_secret
    Commented Feb 4, 2018 at 2:38
  • Can’t you create a power profile for “plugged in” mode vs. “running on battery” then just set your rules differently for each profile? Commented Nov 9, 2020 at 6:07

3 Answers 3

1

As you see here, all you need to do is

  1. Go to Control Panel
  2. Click on Hardware & Sound
  3. Click on Power Options
  4. Click on Choose when to turn off the display of Change when the computer sleeps
  5. Follow the Given Directions
2
  • 2
    This does not work! I have the above reference settings configured as follows: When power is connected: Do not sleep when lid is closed. When power is not connected: Sleep when lid is closed. If I close the lid with power connected then subsequently disconnect power the laptop stays on! This makes it very easy to stow the laptop in a bag and have it overheat! At the very least it should switch to the on battery profile so it sleeps after a set number of minutes but this doesn't happen either on my laptop!
    – Jules
    Commented Mar 29, 2018 at 14:19
  • @Jules, that is exactly the problem. Windows powercfg.cpl menu should have a 4th selection for what to do when lid is already closed AND power is THEN unplugged. Sleep should be default action, and hibernate should be another option.
    – reikred
    Commented Aug 29, 2020 at 16:30
1

You have to dig into the power setting a bit to find this:

  1. Click start, then type “edit power plan”, click “edit power plan”
  2. Click “change advanced power settings”
  3. Expand “power buttons and lid”
  4. Expand “lid close action”
  5. Here you have two options for what happens when you close the lid, "on battery" and "plugged in" - set the "on battery" option to sleep

That will give you the desired effect.

0

Method using a VBS background script that starts a batch script (made in windows 10). Turn on hibernation option when using this (explained below). Note that this isn't a super solid solution to your problem. The batch script will put your computer into a hybrid-sleep-hibernate mode if you have the hibernation option turned on (I do). I recommend turning on the hibernation option because, although turning it off will likely sleep the computer instead, there is a small possibility that it will power your computer down. In general, the batch method isn't very solid.

VBS portion:

Set Shell = CreateObject("WScript.Shell")
do
WScript.sleep 60000
Shell.run "batterysleep.bat"
loop

BAT portion:

set OnAC=false
set cmd=WMIC /NameSpace:\\root\WMI Path BatteryStatus Get PowerOnline
%cmd% | find /i "true" > nul && set OnAC=true
if %OnAC% == false %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby
  1. So first, you need to paste the VBS code into a .vbs file.
  2. Then, paste the BAT code into a .bat file in the same file location as the VBS file.
  3. After that, you will need to make a shortcut of your VBS file, copy it, and paste it into the startup folder (to make it run automatically on startup): C:\Users\[YOU USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Basically, this code runs a VBS file in the background which opens a batch script every minute. This batch script will do the sleep action if your computer is not on A.C. power. To kill the process, type "taskkill /f /im wscript.exe" into the search, but note that this will kill all WScript processes. Again, please note that this is not a completely reliable solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .