is there anyway I could program windows 7 to automatically sleep for about 2hrs and then wake up after than. and then after 4hrs sleep again? thank you!

Dani AI

Generated

Short answer: yes — use Task Scheduler to wake the PC and a small “sleep” action (a script or tool) to put it back to standby. That’s the approach and pointed toward, but it needs a couple of extra settings and a reliable sleep command to behave predictably. Use one scheduled task that is allowed to wake the machine at the times you want it awake, and separate tasks (run as scheduled) that put the system to sleep. (learn.microsoft.com)

Steps (conceptual):

  • Create a scheduled task to run at the wake time; in Conditions check “Wake the computer to run this task” and in General choose “Run whether user is logged on or not” (store credentials). Use “Run with highest privileges” if the action needs admin rights. In Settings enable “Run task as soon as possible after a missed start” if you need resilience. (learn.microsoft.com)
  • Create a scheduled task that runs a sleep command at the desired sleep times. Prefer a small, supported utility (example below) rather than ad-hoc rundll32 calls so behavior is consistent across machines. (learn.microsoft.com)

Example sleep tool (Sysinternals PsShutdown). Place PsShutdown in your PATH or Windows folder, then point the scheduler action to:

psshutdown -d -t 0

This requests suspend/standby; PsShutdown is maintained by Sysinternals/Microsoft and is more explicit than calling undocumented helpers. Download and docs: PsShutdown (Sysinternals). (learn.microsoft.com)

Troubleshooting tips:

  • Inspect what’s waking the PC with built‑in tools:
    powercfg -waketimers
    powercfg -devicequery wake_armed
    powercfg -lastwake
    powercfg -requests

    These commands show scheduled wake timers, devices allowed to wake the PC and the last wake cause. If Task Scheduler is being used, check Event Viewer (System → Power‑Troubleshooter, Event ID 1) to see the Wake Source. Also ensure “Allow wake timers” is enabled in the active power plan (laptops may treat this differently on battery). (learn.microsoft.com)

Notes: some apps (backups, printer utilities, update orchestrators) set wake timers themselves — if so prefer the app’s scheduler or disable those tasks if they conflict. This approach gives precise wake times and a reliable sleep command without relying on a single magic rundll32 line.

Recommended Answers

All 3 Replies

Could you please provide more detail about your application?

You could configure these events in Task Scheduler . . . maybe.

We need more information.

Thank you!

/David C.

David is right - we need to know more about what you are wanting to do. In example:

If this is to do a backup, defrag, or other "system" task, many applications have a scheduling component that will put this is the Task Scheduler for you.

If you are wanting to access your machine remotely, there may be something in the remoting application that will help with this.

Hey britoniah3480,

Did some searching for you and found this thread and it looks like they were able to solve the same problem 2 people confirmed.

http://www.tomshardware.com/forum/2324-63-sleep-timer-help

"Ok i might have a solution
I try this on my computer and it wouldn't come back from sleep. and i had to reset . But i have been having some problems with sleep doing this, so it is very possible that it is just me.
Anyways here is your sleep/Hibernate command.

C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0 (if your windows directory is on the C drive)

when i first try this in it when to Hibernation so your will need to disable Hibernation so it if forced to go in to sleep.

to do this, go a administrative command prompt. (just type in cmd on your search and right click and run as admin

then type in "powercfg -h off" now Hibernation is turned off and your can go to your task scheduler and put in that C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0 command and set your time and your are done!!

Hopefully your will have better luck on your computer then i did on mine"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.