On the occasion of writing the article, I opened it in an old archive on my parent's PC. I am sure that many of the same "home programmers" who bought or cut into MSDN discs studied Windows programming all night long. I wrote it myself, because at that time I did not have any familiar programmers and access to the Internet. There is a well-known expression that many people like:īack in 2003, a simple program was quickly written to turn off the PC on a timer. Rundll32.exe PowrProf.dll,SetSuspendState You can disable it by running the following as administrator: It should be noted that if you have enabled hybrid sleep mode ( Hibernate ), then it will enter this mode. In this case, SetSuspendState with the parameters we need. The rundll32.exe program is called to execute a DLL routine. And the > nul construct tells the interpreter that the standard output will be sent to nul in order to get rid of unnecessary output to the screen. The -n switch specifies the number of repetitions 20 minutes x 60 seconds = 1200 + 1 (since the first ping is returned in less than 1 ms). The default interval is 1000 ms = 1 second. We ping an IP address that is always available (unless your firewall is configured "fancy"). Links to ready-made scripts at the end of the article.įor the most part, everything new is well forgotten old.įirst, let's look at what these lines do: Who is still curious, please, under the cat. I use this before going to bed, including my favorite online radio "for sleep to come" also from the command line, which will be discussed under the cut. Rundll32 powrprof.dll,SetSuspendState 0, 1, 0īut if you just need to turn it off, then everything will be even shorter, namely 47 bytes. Save these lines in CMD and after starting in 20 minutes (1200 seconds) the computer will go into sleep mode.
The value of this article is not in the solution itself, but in a reminder how to quickly solve simple problems.īut if you need a simple solution, please: