Windows – Make Windows 7 go to sleep after x seconds

power-managementsleepwindows 7

When I start a long-processing job just before going to sleep myself, I often run

shutdown -s -t 3600

so that the computer automatically shutdowns after 3600 seconds.

How to do the same to ask the computer to go to sleep after x seconds?

I tried

shutdown -h -t 60

but 1) it didn't even work and anyway 2) this would make computer go to hibernation, which I don't want (I prefer sleep mode).

Note: this answer doesn't solve the problem because it doesn't allow to specify a time before going to sleep.

Best Answer

How do I make Windows 7 go to sleep after x seconds?

Use the following batch file, and run as an Adminstrator

@echo off
rem disable hibernate
powercfg -hibernate off
rem wait x seconds, eg 1 hour
timeout 3600 /nobreak
rem sleep
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Further Reading