Not sure, but I dont think there is a setting to actually prevent the computer from shutting down. Is your computer reasonably old? In that case, perhaps the motherboard, and, in particular, the cpu needs a good clean (overheating)
But, try this.
Try, in the settings, - Power and sleep . Additional Power settings.
Choose, under balanced, "change plane settings"
Scroll to the hard disk option and select never for the time to turn off the HD.