You can tell your PC’s power button exactly how you want it to act when you press it by specifying the button’s function. The power button’s possible functions vary. To change your PC power button's function:
Open your PC’s Power Options.
When you’re using the Control Panel Home, choose System and Maintenance. The Power Options heading appears in the window that opens. From the Control Panel Classic view, double-click the Power Options icon to display the Power Options window.
Click Change What the Power Buttons Do.
In System and Maintenance, choose the item beneath the Power Options heading. In Classic view, in the left side of the window, click the link.
In the window that appears, choose an option in the When I Press the Power Button drop-down list.
You have four choices: Do Nothing (which effectively disables the power button), Sleep, Hibernate, and Shut Down. For example, if you want the computer to just shut down when you press the power button, choose the option that reads Shut Down.
After making your choice, click the Save Changes button.
Your selection is saved. You can optionally close the System Settings window.