Windows 8 and 8.1 Forums

Looking for a Shell command (or API call) to emulate Sleep

  1. #1

    Posts : 1
    Win 8.1

    Looking for a Shell command (or API call) to emulate Sleep

    Good day,

    In Win 8.1, I have set the following power button options:

    Control Panel > Power Options > Choose what the power buttons do:
    When I press the power button = Sleep.
    Password protection on wakeup = Don't require a password.
    "Turn on fast startup" is checked.

    This does the following:

    (1) When I press the power button, my system shuts down perfectly well, within a few seconds my harddisk blinkenlight goes from flashing blue to a sleepy orange.
    (2) After that, I do physically disconnect the power supply (power cable).
    (3) After several hours, I re-attach the power cable, and without further a-do (not even switching on the power button), the system is there where it was before doing (1).

    Is there a shell command, which simulates exactly this shutdown behavior?

    Shutdown.exe does not seem to have an appropriate argument, all tested options fail on (3): in most cases I have to manually switch on the power button and then go through the login procedure, i.e. swipe the intro screen away etc.

    Alternately, is there an API function I can use? (Neither InitiateSystemShutdown nor SetSystemPowerState seem to work here, the former requires formal log-in, the latter shows no reaction on my notebook, whether fSuspend is True or False).

    Thanks in advance!

      My System SpecsSystem Spec

  2. #2

    Posts : 87
    Win 8 and Linux (MINT)

    Windows only allows the hardware Power button or the Start Menu/Start screen power button to enter Sleep (standby) mode. It does not provide a command line tool to directly enter sleep.

    If hibernation is disabled on your PC, you can enter Sleep mode using the following command:

    rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    But if you have enabled hibernation, then the above command hibernates the PC instead of entering sleep mode. So you need to apply a workaround which isn't exactly ideal, something like this.

    powercfg -h off
    rundll32.exe powrprof.dll,SetSuspendState 0,1,0
    powercfg -h on

    In the example above, I've used the powercfg command to disable hibernation, just before using the Rundll32 command. Then the rundll32 command will work correctly and put the PC into sleep. When it wakes up, the last line will turn on hibernation. Another issue with this workaround is that it must be executed from an elevated command prompt.


    You can enter sleep without disabling hibernation and without requiring elevated (administrator) privileges.

    Download the PsShutdown tool by SysInternals. Using this tool, you will be able to make the PC enter sleep mode directly by giving a single command:

    psshutdown.exe -d -t 0 -accepteula
      My System SpecsSystem Spec

Looking for a Shell command (or API call) to emulate Sleep

Similar Threads
Thread Forum
Wake-up from "sleep" for incoming Skype call
I have searched for a solution that will enable my Win8.1 ASUS X54C laptop to wake-up from 'sleep' when an incoming Skype call occurs. I am in the habit of putting my laptop in "sleep mode" when I know I will not use it for more than 30 minutes or so. Being retired, I am on and off my laptop...
General Support
call us over protective,
I'm trying to use a hotmail account I've had for at least 10 years, and get the message above, only problem is I am overseas for an extended period, my phone is in my home country and I can't receive the text they have sent or take a phone call with that phone and find myself locked out of my...
Browsers & Mail
Shell Command List
I just stumbled upon this list of W8 shell commands: As example you can enter this in the Run line to open Quick Launch folder: shell:Quick Launch
General Support
Maybe They Should Just Call It Windows 7.8
Windows 8.1 is bringing back some familiar parts of Windows 7. Source: Let the fun began. . .:thumbsup:
Windows 8 News
Windows 8 RTM can emulate isos
Im so surprised windows 8 could already do this, bye bye daemon tools so happy i had to post this :party:
General Support
Microsoft: Don't call it Metro. Call it 'Windows 8'
Read more at: Microsoft: Don't call it Metro. Call it 'Windows 8' | ZDNet
Windows 8 News

Eight Forums Android App Eight Forums IOS App Follow us on Facebook