Being able to change the behavior of the on and off button can be especially useful in many scenarios. For example, in the case that we have a laptop and we want that, when pressing the button, it goes into hibernation mode instead of suspension in order to save more battery. It may also be interesting, if we have a desktop PC, that when pressing the button it goes into sleep mode instead of shutting down the equipment, in order to be able to resume the device more quickly at the same point where it we leave.
Of course, we must bear in mind that the action to configure the button is carried out when we click on it. If we keep the shutdown button pressed, we will be causing the system to force shutdown, which can cause damage to the equipment, so we must be careful in this regard.
We can change the settings of the on and off button from the Control Panel. To access it we must write control panel in the search box located next to the Start menu. Once it appears, click on “System and security” and “Power options.” Here on the left side, click on the option «Choose the behavior of the start / stop buttons».
We now go to the next screen where we can distinguish between what we want to do when we press the power button of the equipment, whether we are using the battery or when the PC is connected to the electrical network. In the case that we use a desktop PC, only the electric current option will appear.
In each of the cases, if we display the list of options, we find different options such as:
- Do nothing.
- Lay off.
- To turn off.
- Turn off the screen.
- Hibernate (not on all computers).
From here we can use the function that interests us the most and change it every time we need it. If, for example, we use a laptop, the option to Turn off the screen can be quite useful, since in this case we do not have an external screen with its own on and off button, as we do in the case of a PC of desktop.
In addition, we must bear in mind that, depending on the hardware of our equipment, the configuration may be different. For instance, the Hibernate option is not supported on all systems, so it may appear in some cases and not in others (as in our case).
Once the new function has been chosen, we only have to press the “Save changes” button that we find at the bottom of the screen so that the configuration of the on and off button becomes effective.
It is also possible to change the power button settings using the command line from the Command Prompt. If we want to define a new action for the button, we must start by typing CMD in the search box next to the Start menu. This will make the Command Prompt option appear in the list that we must run as administrator. Once it appears, we must write a command to change the default action of the on and off button and press Enter to confirm.
- To change the default action when the PC is connected to the network we use the command:
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 0
- To change the default action when the PC is using battery we use the command:
powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 0
As we can see, both commands end with a value “0”. This value is what defines the action to perform por what we should change it to reflect what we want the button to do.
The available values are as follows:
- 0: Do nothing
- 1: sleep
- 2: Hibernate (not supported on all systems)
- 3: turn off
- 4: turn off the screen
Finally, we write the following command to apply the changes made and press «Enter».
powercfg -SetActive SCHEME_CURRENT
Another option that we have available in Windows 10 to change the behavior of the on and off button is to use the Group Policy Editor. This option will only be available if we use a Pro or Enterprise version of the Microsoft operating system.
To do this, the first thing we are going to do is use the keyboard shortcut “Windows + R” to launch the Run command. Here we write gpedit.msc and we press Enter.
Once the Editor appears, we go to the section of “Equipment Configuration” and “Administrative Templates”. Here we click on «All values». Next, we move to the bottom of the list where we will find the options “Select the action of the on / off button (with battery)” and “Select the action of the on / off button (connected)”, in the in case we use a laptop and only the second option in case of using a desktop PC.
Now we must double click on each option and a new window will appear. Here we must mark the option as Enabled. This will enable a drop-down tab at the bottom, where we can choose between the options of:
- No action required.
- Lay off.
- To turn off.
We choose the desired option and click on Apply and OK to save the changes. Every time we want to make a modification, we only have to perform the previous steps again.