Anyone know a batch/script/program/exe that can put Windows 10 to sleep?

I have an old desktop with out of date bios that will not sleep

Someone gave me this dos script that works perfectly on Windows 7 when run as scheduled task

powercfg -HIBERNATE OFF
rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Now Windows 10 no longer supports hibernating (tried 46372846312 methods/suggestions to activate it) so Ive given up on that

Anyone know a script that can put Windows 10 to sleep?
 

Question Info


Last updated May 13, 2020 Views 13,647 Applies to:

Hi

Right click on the Start Menu icon on the far left of the taskbar, and click on Control panel.

There click on the Power Option icon.

In the Preferred plans chose "Balanced [Recommended]".

Then set it to your preference's.

Regards.

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

I have an old desktop with out of date bios that will not sleep

Someone gave me this dos script that works perfectly on Windows 7 when run as scheduled task

powercfg -HIBERNATE OFF
rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Now Windows 10 no longer supports hibernating (tried 46372846312 methods/suggestions to activate it) so Ive given up on that

Anyone know a script that can put Windows 10 to sleep?

    Check and make sure that your graphics card/device is using an OEM driver.  Drivers for Windows 8/8.1 may work if you cannot find a driver for Windows 10.  If it's using a Microsoft Basic Display driver (or something like that), sleep will not work.

    Secondly, Windows 10 fully supports hibernating, and hibernation sometimes works even if sleep will not.  Just in case, it may be worth following the steps below to enable hibernation:

  1. Right-click the Start button and click Command Prompt (Admin).
  2. Type the following command and press [Enter]: powercfg -h on
  3. Close the command window.
  4. Right-click the Start button and click Power Options.
  5. Click Choose what the power buttons do.
  6. Click Change settings that are currently unavailable.
  7. Scroll down (if needed), tick Hibernate, and click [Save changes].
  8. Click Start -> Power -> Hibernate to try out the new feature.

    If the hibernate option is missing in steps 7 and/or 8, your laptop probably has a driver issue preventing it from using low power states.

    Regarding commands, the very popular "rundll32.exe powrprof.dll,SetSuspendState 0,0,0" command on the Internet is totally invalid.  It is not supposed to work, and does only inadvertently.  The SetSuspendState function expects three parameters:

  1. Hibernate (Boolean; Standby if false)
  2. Force (Boolean)
  3. NoWakeTimers (Boolean)

    All would be fine and dandy if Rundll32 passed the parameters on as specified.  However, it does notRundll32 uses the following preset parameters, regardless of the arguments passed to it:

  1. hWnd (dWord preset to the parent window specified in the start command for Rundll32)
  2. hInst (dWord preset to the loaded instance of the specified DLL)
  3. sCmdLine (address to string containing all the arguments you passed to Rundll32)
  4. nCmdShow (dWord preset to the start mode you ran Rundll32 with, e.g. minimized, maximized, normal, normal no focus).

    All those parameters will be non-zero numbers regardless of what you specify in the command line.  Therefore, any call to SetSuspendState from Rundll32 will equal calling SetSuspendState (True, True, True), which asks the system to force hibernate and disable all scheduled tasks that are scheduled to wake the computer up.  Disabling hibernation and then asking Windows to enter hibernation is not a very good workaround to accomplish standby.

So, here are some valid commands:

Lock rundll32 user32,LockWorkStation
Log off shutdown -l
Restart (requires admin) shutdown -r -t 0
Full Shutdown (requires admin) shutdown -s -t 0
Fast Shutdown (requires admin) shutdown -s -t 0 -hybrid
Hibernate shutdown -h
Standby (requires PsShutdown tool) psshutdown -d -t 0

    Unfortunately, after all the features it has, the Microsoft shutdown command is missing the standby feature!  So, it you want to put your computer to sleep via command line, you'll need to install a more capable tool before you can use the last command above:

  1. Download Sysinternals PsTools.
  2. The download should be a ZIP file.  Open it and copy PsShutdown.exe to your desktop.
  3. On your desktop, right-click PsShutdown.exe and click Copy.  Right-click it again and click Properties.
  4. Tick Unblock and click [OK].
  5. Open File Explorer, navigate to "C:\Windows", scroll down, right-click the system32 folder and click Paste.
  6. To enter standby, you can now use this command: psshutdown -d -t 0
Dear Microsoft, please make Windows 10 functional, pretty & intuitive, not boring, clumsy & buggy!

16 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

You Sir, are a bloody genius, gent and a scholar.

And not necessarily in that order!

I've scoured the internet for months looking high and low for info about Windows 10 power schemes, having run into what seems to be completely contradictory information. This is the first time I've found the solution to my observations.

For quite some time I have been trying to utilize batch files to use Task Scheduler for Sleep and Wake timers on my Windows 10 PC without consistent success. The main issue (and I've seen plenty others allude to this) is that creating a batch file DOES NOT provide the same results as when using the Windows 10 Sleep function in the Start menu.

Thanks to you, now we know. I'd like to say we ALL know, but this doesn't seem to have become as widespread as it should, but I'd like to say a VERY welcome thanks for me anyway, even if this doesn't seem to have reached as wide an audience as it should.

Regards

Mike

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Can someone explain how to creat a task to wake him up,...

I follow the steps and create a task to wake up but it still doesn`t works,...

Bat file to sleep :

@echo off

psshutdown -d -t 0

exit

ok it goes to sleep

bat file to wake up from task

@echo off

hi

exit

Nothing happen onle when I click a key the computer wakes up.

thank you

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

    I am not aware of any command that can wake the computer, because nothing can execute while it's asleep.  However, in the Task Scheduler you can specify a task to wake the computer to execute on time.  Right-click your "wake" task -> click Properties -> Conditions (tab) -> Tick Wake the computer to run this task.

    With this option enabled, as long as the computer is shut down or put to sleep properly, it should power on or wake from sleep/hibernation to run your task.  By "properly" I mean that it wasn't unplugged, or axed by using the reset button or holding the power button for 4 seconds to force it to power off.  This is because Windows has to set a hardware wake timer, and it can only do this when it enters sleep/hibernation or is shutting down normally.

    I hope that helps!

Dear Microsoft, please make Windows 10 functional, pretty & intuitive, not boring, clumsy & buggy!

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Thank you for the reply,

The thing is I have that task running like you said:

"click Properties -> Conditions (tab) -> Tick Wake the computer to run this task" and also with high privileges.

And she works fine when  I use the menu - > power - > sleep or the power botton ( config to sleep ) the task run great, the computer wakes up, but if I use the script to sleep, the computer doesn`t wake up.

I even tryed this script to see if it would work but nothing is weird.

I found a work aroud, I use this script to sleep : sleep.vbs

Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShutdownWindows
set objShell = nothing
Set WshShell = CreateObject("WScript.Shell")
With objShell
WScript.Sleep 200
WshShell.AppActivate "Shut Down Windows"
WshShell.SendKeys "s"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{Enter}"
End With
Set objShell=Nothing

and this one wake.vbs to wake up and for now is working

set WshShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Quit()

thank you,...

4 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Bro, I can't thank you enough for this.  Could not figure this out for the life of me.  Nothing worked.  Could get it to sleep but not wake up with the mouse, or could wake up with the mouse but had to disable hybrid sleep.  This is perfect.

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Brilliant - worked fine. Thank ;you for sharing your knowledge and taking the time to give such a full and easily understandable solution. Rundll stopped working for me after  update 1709 and I've spent some hours trying to find the answer until I chanced on your solution. How much time is wasted because microsoft don't bother to tell anyone about changes they make to basics like rundll - or deliberately keep us in the dark.

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.