Click the "start" button, select "control Panel". There, find the section "power supply". If in "control Panel" is set to organize icons by category, first click "System and security" and then choose "power options".
You will see a list of your power plans. Click on the link "change plan settings" on the contrary, which is constantly being used on your computer.
In the opened window you can configure the settings of sleep mode: set the time of inactivity after which the computer will automatically take in the sleep mode. To disable hibernation, select the value "Never". If you are configuring a laptop, for mains operation and on battery you can choose different options. After everything is configured, hit "Save changes".
You can also visit the "change plan settings" click "Change advanced power settings". A window will open which will have a list of settings that can be adjusted. Select "Sleep".
If you are working with a desktop computer, to cancel automatic sleep mode, select it in the list of values of "Never". Laptop need to choose separately the values for mains operation and on battery. When all the correct settings are set, click "OK" to save them.
If you completely disable hibernation and sleep mode on a laptop when running on battery, in the case of low power, the computer still shuts down, but any unsaved data will be lost. It is therefore advisable not to set "Never", if we are talking about setting the sleep mode when operating on battery.