How to put your pc to Sleep or Hibernate mode using a command line

A few days back we did an article on differences between the Sleep mode and Hibernation (available at It really does save a lot of energy having the machines hibernate or sleep, rather than being powered on 24 x 7. So, why would you want to do this using a command line rather than the available GUI ? There can be a number of reasons, primarily being that you want to put this in a batch file to be used.

You can then use the batch file to be run by normal windows task scheduler to put your computer to sleep or hibernate during certain times. If you have a LAN with few machines, you can use the PSEXEC command utility available from Sysinternals (, to run this batch file on remote machines and put them into sleep mode. It would work well if you had an Active Directory domain and you can run this batch file on your LAN or WAN using group policy for power conservation or other purposes.

The command to put the machine to sleep is as follows:

 "rundll32 powrprof.dll,SetSuspendState"

The command to put a machine in Hibernation

"%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate"

Just a FYI, you can also lock a PC remotely by the following command:

%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

Mac users, we have a little something for you too! Do you want to know how to put your Mac to sleep by just sending it a text message ? Check this article out:

did not work

rundll32 powrprof.dll,SetSuspendState this command shut down my win 7 machine