If you ever accidentally shut down your computer by hitting the power button, there's an easy way to disable the power button (or make it do something different) in Windows 10. You can control your Sleep button, too, if your computer has one of those. Here's how.

Changing the way your computer's power button works in Windows 10 requires a trip to Control Panel. First, launch Control Panel by opening the Start menu and typing "control," and then hit Enter or click the Control Panel icon.

Open Start menu, type "control," then select the "Control Panel" icon.

In Control Panel, click "Hardware and Sound."

In Control Panel, click "Hardware and Sound."

Locate the "Power Options" section and click "Change what the power buttons do."

In Hardware and Sound, click "Change what the power buttons do."

Next, you'll see a screen that defines what happens when you push power or sleep buttons on your machine. Under "Power and Sleep Button Settings," click the drop-down menu beside "When I Press the Power Button."

Click the drop-down menu beside "When I press the power button."

In the "When I Press the Power Button" menu, you'll see several choices. Here's what all the options do:

  • Do Nothing: When you push the power button, nothing happens.
  • Sleep: Your PC goes into a low-power sleep mode but stays running.
  • Hibernate: Your PC saves the state of your system memory on disk and shuts down. Your session can be resumed later when you power back up.
  • Shut Down: This shuts down Windows and powers off your PC. (This is the default.)
  • Turn off the Display: Your display turns off, but your PC keeps running.

To avoid losing your work if you hit the power button, choose any option other than "Shut Down." This will prevent accidental shutdowns. If you want no interruptions whatsoever as a result of hitting the power button, choose "Do Nothing."

In the drop down menu, choose any option other than "Shut Down."

Click "Save Changes" and close Control Panel.

To change what your computer's Sleep button does, choose an option from the "When I press the sleep button" drop-down box here.

The next time you press your PC's power button, it won't automatically shut down. If you chose "Do Nothing" in the last step, you can still shut down your PC when necessary by choosing "Shut Down" from the Start menu. Hope you have a productive day!

Related: What's the Difference Between Sleep and Hibernate in Windows?