May 10, 2024
Contribute to the Windows forum!
Click here to learn more 💡
May 10, 2024
Windows 10 Forum Top Contributors:
Ramesh Srinivasan - neilpzz - Volume Z - franco d'esaro - _AW_ ✅
Anyone know a batch/script/program/exe that can put Windows 10 to 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?
Report abuse
Thank you.
Reported content has been submitted
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.
Report abuse
Thank you.
Reported content has been submitted
1 person found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
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:
- Right-click the Start button and click Command Prompt (Admin).
- Type the following command and press [Enter]: powercfg -h on
- Close the command window.
- Right-click the Start button and click Power Options.
- Click Choose what the power buttons do.
- Click Change settings that are currently unavailable.
- Scroll down (if needed), tick Hibernate, and click [Save changes].
- 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:
- Hibernate (Boolean; Standby if false)
- Force (Boolean)
- NoWakeTimers (Boolean)
All would be fine and dandy if Rundll32 passed the parameters on as specified. However, it does not. Rundll32 uses the following preset parameters, regardless of the arguments passed to it:
- hWnd (dWord preset to the parent window specified in the start command for Rundll32)
- hInst (dWord preset to the loaded instance of the specified DLL)
- sCmdLine (address to string containing all the arguments you passed to Rundll32)
- 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:
- Download Sysinternals PsTools.
- The download should be a ZIP file. Open it and copy PsShutdown.exe to your desktop.
- On your desktop, right-click PsShutdown.exe and click Copy. Right-click it again and click Properties.
- Tick Unblock and click [OK].
- Open File Explorer, navigate to "C:\Windows", scroll down, right-click the system32 folder and click Paste.
- To enter standby, you can now use this command: psshutdown -d -t 0
Report abuse
Thank you.
Reported content has been submitted
46 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
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
Report abuse
Thank you.
Reported content has been submitted
3 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
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
Report abuse
Thank you.
Reported content has been submitted
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
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!
Report abuse
Thank you.
Reported content has been submitted
2 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
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,...
Report abuse
Thank you.
Reported content has been submitted
6 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Report abuse
Thank you.
Reported content has been submitted
2 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Report abuse
Thank you.
Reported content has been submitted
3 people found this reply helpful
·Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Question Info
Last updated April 6, 2024 Views 29,505 Applies to: