How can I put the computer to sleep from Command Prompt/Run menu?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated
--
Chapters
00:00 How Can I Put The Computer To Sleep From Command Prompt/Run Menu?
00:22 Accepted Answer Score 134
01:24 Answer 2 Score 31
01:54 Answer 3 Score 107
02:14 Answer 4 Score 14
02:34 Thank you
--
Full question
https://superuser.com/questions/42124/ho...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline #sleep #shutdown #rundialog
#avk47
ACCEPTED ANSWER
Score 134
You will find shutdown.exe
to be your friend.
Other handy commands see this post:
Sleep Computer (read more at https://superuser.com/a/463652/249349 )
Lock Workstation
Hibernate Computer - see answers by Scott Chamberlain and Eric L.
Restart Computer
Shutdown.exe -r -t 00
Shutdown Computer
Shutdown.exe -s -t 00
EDIT/UPDATE:
It seems that sleeping a computer is problematic if hibernate is turned on.
Copying from other answers:
You can either try PsShutdown or:
The command rundll32.exe powrprof.dll,SetSuspendState 0,1,0 for sleep is correct - however, it will hibernate instead of sleep if you don't turn the hibernation off.
Here's how to do that:
Go to the Start Menu and open an elevated Command Prompt by typing cmd.exe, right clicking and choosing Run as administrator. Type the following command:
powercfg -hibernate off
ANSWER 2
Score 107
The methods posted by other people do not work correctly if a computer has hibernation enabled, the computer will not wake on Keyboard or, more importantly, not wake on scheduled task.
One of Microsoft's Sysinternals tool is PsShutdown using the command psshutdown -d -t 0
it will correctly sleep, not hibernate, a computer
ANSWER 3
Score 31
The command rundll32.exe powrprof.dll,SetSuspendState 0,1,0
for sleep is correct - however, it will hibernate instead of sleep if you don't turn the hibernation off.
Here's how to do that:
Go to the Start Menu and open an elevated Command Prompt by typing cmd.exe
, right clicking and choosing Run as administrator. Type the following command:
powercfg -hibernate off
ANSWER 4
Score 14
NirCmd workes on Windows 8 (I assume it also works with Windows 7) → http://www.nirsoft.net/utils/nircmd.html
The command is standby
, but it puts the computer to sleep.
nircmd.exe standby
If you have hybrid sleep enabled, it will work; i.e., it puts the computer to sleep and copies the memory to disk in case of power loss.