Operating System Shut down when I press the sleep button (1 Viewer)

Stéphane Lenclud

Development Group
  • Team MediaPortal
  • April 29, 2013
    2,563
    1,288
    Germany Germany
    Country flag
    I like my HTPC to shut down when I hit the power button on my remote control.
    The problem is that an MCE remote actually sends the sleep command when you hit the power button.
    By default on Windows (7, 8 and 10) the sleep button sends your computer into sleep mode.
    In your settings you can actually configure what is Windows doing in response to both power and sleep buttons.

    upload_2016-2-3_23-45-8.png


    Here are the options you have for your power button:

    upload_2016-2-3_23-46-0.png


    Now sadly the sleep button won't let you choose that shut down option:

    upload_2016-2-3_23-56-2.png


    However you can still tell Windows to shut down when the sleep button is pressed and that's how:
    • Run a command prompt as administrator.
    • Run powercfg -getactivescheme and note the scheme UID.
    • Run powercfg -q <scheme_guid> and note the UID for "Power buttons and lid" subsection.
    • Run powercfg -q <scheme_guid> <sub_guid> and note the UID for "Sleep button action" power setting.
    • Run powercfg -setacvalueindex <scheme_guid> <sub_guid> <setting_guid> <setting_index> where setting index is 3 for shut down.
    The command you will end up running to change that setting should look like:
    powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 3
    Obviously the UIDs on your machine should be different so make sure you don't just copy and paste that command. You need to workout the UIDs for your setup as described above.

    Once you have executed that command properly, go back to your system settings where you should see the following:

    upload_2016-2-4_0-14-59.png


    Notice how the sleep button entry is empty. That's ok, it's just that the UI still won't show that shut down option.
    Now restart Windows for the changes to take effect, then you can try out your newly programmed sleep button.

    Special thanks goes to Wray Smallwood for publishing that solution.
    Microsoft community post
     
    Last edited:

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    Top Bottom