How to disable your PC's power button in Windows 10 and 11
This tutorial will show you step by step how to disable your PC's power button in Windows 10 and 11.
Methods:
How to disable your PC's power button in Windows 10
1. Right-click on the Windows start menu button.

2. Click on Power Options.

You can also open Settings > System > Power & sleep (left menu) to open Windows 10's Power Options.
Or click on the Windows start menu button, type power options and then click on Power & sleep settings in the results.
3. Click on Additional power settings located at the top right.

A “Power Options” window will appear.
4. Click on Choose what the power buttons do in the top left corner of the window.

5. At When I press the power button, you click on the selection menu button and select Do nothing.
Note: If you're using a laptop, then you will have two selection menus (“On battery” and “Plugged in”).

6. Click on the Save changes button at the bottom of the window.
That's it. You've now disabled the power button of your PC.
You'll still be able to turn your computer on using the power button.
How to disable your PC's power button in Windows 11
1. Click on the Windows start menu button or search icon.

2. Type control panel.
3. Click on Control Panel when it appears in the search results.

You can also open Control Panel by pressing the Windows + R keys on your keyboard > type control in the “Run” window > click on OK or press the Enter key on your keyboard.

4. Click on Hardware and Sound.
5. Click on Power Options.

A “Power Options” window will appear.
6. Click on Choose what the power buttons do in the top left corner of the window.

7. At When I press the power button, you click on the selection menu button and select Do nothing.
Note: If you're using a laptop, then you will have two selection menus (“On battery” and “Plugged in”).

8. Click on the Save changes button at the bottom of the window.
That's it. You've now disabled the power button of your PC.
You'll still be able to turn your computer on using the power button.
Related:
How to keep your laptop on when the lid is closed on Windows 11