Tested on one machine with Win7+Win10 (dual boot) with hiberfil.sys and pagefile.sys OFF and a second Win7 machine with those ON. Admin or not made no difference.
This has been discussed already in the archived forum, but no solution was found. I can't wrap my head around this so I'm looking for help here.
These are the programs and methods I've tested divided by which was faster and which was slower.
FAST:
- Physical power button (if you "Change what the power buttons do" from the power options into Sleeping instead)
- Windows regular Start button -> Sleep
- Open-Shell Start button -> Sleep
- PsShutdown -d -t 0
- Nircmd standby
- wizmo standby
- SLEEP.EXE
- My own Assembly program using SetSuspendState
- My own Assembly program using SetSystemPowerState (SeShutdownPrivilege required)
- AutoHotkey calling CMD calling PowerShell calling Application.SetSuspendState (lol):
Spoiler
SLOW:
- AutoHotkey calling DllCall("PowrProf\SetSuspendState", "int", 0, "int", 1, "int", 1) (from the Shutdown documentation)
- AutoHotkey calling DllCall("Kernel32\SetSystemPowerState", "int", 1, "int", 1) (SeShutdownPrivilege required)
- rundll32.exe Powrprof.dll,SetSuspendState (not recommended, Standby only works if Hibernation is disabled)
- howto_shutdown_windows.exe
Useful resources:
http://blog.clockahead.com/2012/10/windows.html
https://docs.microsoft.com/en-us/windows/desktop/api/powrprof/nf-powrprof-setsuspendstate
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.application.setsuspendstate?view=netframework-4.7.2
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-setsystempowerstate
powercfg -a to check your available power states
powercfg -h off to disable hibernation (S4)
TL;DR putting the PC on standby using AHK is slow for some unknown reason, how do I make it fast like other programs?