0

Sometimes I put my laptop to sleep (suspend to RAM, not hibernate), but could happen that I don’t reactivate it for days: in such case, despite the fact that the sleep state consume little percentage of battery, I would however avoid any consumption of the battery (which will exponentially grow after days of suspension). I know that I can set “Hibernate after” in the advanced power settings, but in this case, I don’t want/need to find open documents and running applications when I reactivate my laptop. So I was searching for a way to replace the "Hibernate after" with “Shutdown after” (in my case, eg, after 12 hours after sleep). Well, here on SuperUser I found the suggestion of another user, which suggested (by creating a task in the Task Scheduler) to trigger the Shutdown after an amount of time after that the system goes to sleep, but does’nt works at all for me: https://superuser.com/a/934949/386950

To summarize: the suggestion is to create a task in the Task Scheduler, which is triggered after X minutes that the laptop has gone to sleep, then by using the following action in the Actions tab: shutdown -s, but as I’ve said, this task doesn’t work at all for me. I also tried to enable the “Wake the computer to run this task” option, but this task doesn’t work at all, however.

I am aware of the fact that there are available some software utilities like “Shutdown Timer” https://www.makeuseof.com/tag/automatically-turn-computer-shutdown-timer-windows/ but I would avoid to rely on third-party applications: i’d like to rely on Windows’s abilities.

So: what I have to change, check or activate, to achieve my need?

1
  • Your chief problem is that whatever code will be responsible for shutting down your computer will necessarily execute when the computer is sleeping. The Task Scheduler solution is going to be the only approach that will work, assuming you can get the task to wake Windows to run itself. Commented Oct 22, 2018 at 19:26

1 Answer 1

0
  1. Create a batch file ,the code is simple.

    echo on
    title :ShutdownBatch:
    shutdown.exe /s /t 00
    
  2. Create a new task at Task Scheduler,

  3. Decide how you want the General tab to be set (I recommend selecting "Run whether user is logged on or not").

  4. I chose "Run with highest privileges", but this depends on your requirements.

  5. At the conditions tab,you can specify if the batch will run when the machine is in idle mode.

  6. Create a Trigger that describes when you want the task to run.(You can set a specific time to run the batch file).

  7. Create a new Action (browse the ShutdownBatch script, at the program/script field--this is the key step: The Action must be "Start a program").

You must log in to answer this question.

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