Is there a way of shutting down a Windows 7 computer after sleeping for X amount of time?
Solution 1:
Building on oldmud0's excellent answer in Automatically hibernate Windows 8.1 after 15+ minutes inactivity, it should be possible to do indirectly, which may be enough for your purposes.
1) Set computer to sleep after the desired time, say When plugged in, PC goes to sleep after 2 hours
2) Using Task Scheduler (win+r -> taskschd.msc
) go to Action -> Create Task
3) On the General tab, enable Run whether or not user is logged on or not
and Run with highest privileges
4) On the Triggers tab, add a New...
condition with On idle
and leave it enabled.
5) On the Conditions tab, check Start the task only if the computer is idle for
and enter your desired 'hibernate-after' time + 2h
(since the sleep duration must be considered).
If you set 4 hours for example, the computer should sleep after 2 hours of being inactive (as per step 1) and then hibernate after a further 2 hours.
6) On the Actions tab, add a New...
action to run shutdown
with the additional argument of -h
(for hibernate)
That combination should get you the desired behaviour - sleeping after a certain period of inactivity, and then hibernating.
Note: I haven't tested this but it sounds like a good idea, so I may well try tonight!
Edit:
blink
I could swear this asked about hibernating after sleeping; not shutting down after sleeping. I will leave pre-edit as is, but at point 6), use the additional parameter -s
(for shutdown) instead of -h
.