Monday, July 21, 2014

Windows 7 : how to script hibernation with cygwin

This will create a command for bash in cygwin, which will put your PC in hibernate state.
    alias hibernate='/cygdrive/c/Windows/System32/rundll32.exe powrprof.dll,SetSuspendState Hibernate'
So now you can launch a compilation or a test, launch the following command, lock your screen and go home.
    sleep 3600; hibernate
After one hour, the PC will dump his memory to the hard disk and turn the power off.

The next morning, turn the PC on, it will restore his state, and you can review the result of your last task.

No comments:

Post a Comment