Put the computer to sleep
Hi! Is there any way to put the computer to sleep (or hibernate or power off also for that matter) from within a program, with the same result as pressing the sleep (or hibernate or shut down) button in the start menu?
Sometimes I want the computer to finish a certain task or wait for a certain amount of time, while I am not by the computer, and then go into sleep mode. The task being executed before putting the computer to sleep is not important here.
I have searched quite a lot about this but there doesn't seem to be very much information about it.