Thursday, October 21, 2010

Windows 7 laten slapen met een script

How to put windows 7 to sleep in a script
For English version, see below

In een DOS script kun je b.v. na het afronden van het script de PC laten slapen. Tot nu toe lukte dat niet omdat mijn PC steeds in hibernation ging i.p.v. slaap.

Om de PC te laten slapen moet je eerst hibernation uitschakelen. Dit kan vaak lastig zijn, maar Microsoft komt je hier te hulp. Op deze pagina zie je twee kleine programmaatjes waarmee je hibernation kunt uitschakelen en aanschakelen. Door eerst het hibernation uitschakelen programma te draaien kun je het volgende commando gebruiken om je PC te laten slapen aan het einde van een DOS script.

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Nadat je het Fixit programmaatje voor het herstellen van hibernation hebt gedraaid, zal het boven genoemde commando de PC weer in hibernation brengen.

How to put your PC to sleep through a DOS command

When I tried to put my PC to sleep through a DOS command, it used Hibernation, not the sleep (suspend) mode. In order to force the PC to use the sleep mode, you have to disable hibernation. This turning hibernation on/off has been made easy by Microsoft through two Fixit tools, which can be found here. After you ran the disable hibernation tool, the command below will put your PC to sleep. If you want to change back to use hibernation, just run the other tool and the command will put your PC back into hibernation.

Command:
rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Success.

No comments:

Post a Comment