Is there any commands or registry keys that can be edited to standby/hibernate a computer and wake it up again autonomously. I know there are programs to do this so it is possible but anyone really know the exact way it's done? It going to be used for some testing scripts.

Thank You.

to put the machine into suspend/hibernate state, use SetSuspendState
to wakeup from suspend/hibernate, use SetWaitableTimer with the last parameter (fResume) as TRUE and have a thread wait for the timer to be signalled or specify an APC to be called. note: to wake up from hibernate, hardware support for S4 power mode is required. this may not be available on all machines. check by calling GetLastError.