Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I set the "When I press the power button on my computer:" option in Windows XP to "Do nothing" with a registry key or script?

I found this example in searching, however it is supposed to be for the sleep button, and it doesn't seem to work.

I found these keys, but I have no idea what the correct value should be since it is REG_BINARY

HKLM\SYSTEM\ControlSet001\Control\Session Manager\Power\AcPolicy
HKLM\SYSTEM\ControlSet001\Control\Session Manager\Power\DcPolicy
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power\AcPolicy
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power\DcPolicy
share|improve this question

Do not know if you are still looking for a solution. I needed something to change the Power Button setting from the default "Shutdown" to "Do nothing", so I wrote this vbscript.

' File:             pwrDoNothing.vbs
' Author:           Joe Rawlins
' Purpose:          Set system Power Button to 'Do nothing'
' Notes:            Requires button to be held for 5 seconds to initiate shutdown
' Last Modified:    06/25/2010  jtr Initial creation
Option Explicit

Dim objShell, WshShell

Set objShell = CreateObject("Shell.Application")
Set WshShell = CreateObject("WScript.Shell")


WScript.Sleep 500
WshShell.SendKeys "+{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{RIGHT}"
WScript.Sleep 500
WshShell.SendKeys "{TAB 2}"
WScript.Sleep 500
WshShell.SendKeys "{UP 2}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"

Source of script

share|improve this answer
Thanks @Luke, I tried that but had no luck, mostly because I have no clue about HTML – Moab Aug 9 '11 at 23:50
@Luke: that looks pretty good, and would probably work, I'll give it a try if I can't find the correct registry key value. – Ryan_S Aug 10 '11 at 13:44
If someone can find the registry value it changes, that would make it work a lot smoother, especially on a wider range of hardware – Canadian Luke Aug 10 '11 at 16:45
Install Process monitor on a PC and change the setting in the gui, then search the PM snapsot for the registry – Moab Aug 10 '11 at 16:51
up vote 1 down vote accepted

Since I could not figure out the appropriate registry key values, I ended up just writing a script to automate the dialog. And since I was using AutoIT for other things, that's what I used. Hope this can help someone else.

#include <GuiTab.au3>
; Start the System control panel
Run("rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl,,3")

$title = "Power Options Properties"
$text = ""
WinWait( $title, $text)
If Not WinActive( $title, $text) Then WinActivate( $title, $text)
WinWaitActive( $title, $text)

;select the 'Advanced' tab
$hTab = ControlGetHandle( $title, $text, "[CLASS:SysTabControl32; INSTANCE:1]")
_GUICtrlTab_ClickTab($hTab, 1)

;set the combobox to 'Do nothing'
ControlCommand( $title, $text, "[CLASS:ComboBox; INSTANCE:2]", "SelectString", "Do nothing")

;click OK
ControlClick( $title, $text, "[CLASS:Button; INSTANCE:6]")

The script just opens the power options dialog, selects the advanced tab, sets the combo to 'Do nothing', and presses OK.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.