Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out how to get Windows 7 to sleep at 8pm and wake at 8am on a daily basis. I'm looking at Windows' services and there is a Shutdown.exe that can run, but it only seems to have a /h flag for hibernation. For waking from sleep, there is a "wake Windows from sleep to run this task" option, but it never seems to work. There is also a Sleep.exe program I can download but it comes with 13MB of other libraries from Microsoft.

Is there a C# program I can write to make this work?

share|improve this question
Welcome! Since StackExchange hosts multiple sites, you are encouraged to choose the most appropriate site and post your question there, and if the community disagrees your question will be migrated to the correct site. No need to post the same question on multiple sites. – Stephen Jennings Jan 10 '11 at 15:31
up vote 3 down vote accepted

You can schedule a task at 8pm to run Rundll32.exe Powrprof.dll,SetSuspendState Sleep

You can then schedule some random task (like cmd /k echo wake up) at 8am and enable the "wake Windows to run this task" option.

share|improve this answer
That command "Rundll32.exe Powrprof.dll,SetSuspendState Sleep" is exactly what I need to get the machine to Sleep. I then had to run "powercfg -h off" as an administrator to make sure it slept instead of hibernated. The problem I have now, is that the "wake Windows to run this task" doesn't seem to be waking Windows. It says the task ran, but it doesn't seem to actually be "waking" Windows. – bafromca Jan 10 '11 at 16:24

AFAIK wake-up is a pure BIOS feature, so if Windows 7 can't control this BIOS setting for whatever reason (e.g if the BIOS does not allows such a method to be configured externally), wake-up can only be set-up through the BIOS settings.

share|improve this answer
Windows Scheduler has a "wake Windows to run this task" however. The BIOS unfortunately does not have a "wake" setting. That was my first hope/guess at getting this running. – bafromca Jan 10 '11 at 15:14
I guess Windows might show the option even if the BIOS does not support configuration from the OS. An alternative possibility would be to wake up the computer from outside itself. Maybe a server or a NAS can send a WoL packet timely? – Lloeki Jan 10 '11 at 15:20
The bigger problem is this has to work on 9 machines with no central server to send WoL packets, so it has to work on each individual machine. No Internet. – bafromca Jan 10 '11 at 15:26
BIOS wake and WoL is for when the machine is shut down, not asleep. – Doug A.K. Jan 10 '11 at 15:32
Even if I could send a WoL packet, how do I make the machine sleep at 8pm every day? – bafromca Jan 10 '11 at 15:32

You must log in to answer this question.

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